摘要:
# 基本的方式 list = [x for x in range(1, 101)] print(list) # 循环中使用if print("*" * 100) list = [x for x in range(1, 101) if x % 3 == 0] print(list) print("*" * 100) # 循环中使用循环 list = [(x, y) for x in rang... 阅读全文
摘要:
import copy # 浅拷贝 print("浅拷贝:") a = [1, 2, 3] b = a a.append(4) print(a, "-" * 5, b) print(id(a), "=" * 5, id(b)) print("结论:a、b指向同一内存空间,并没有新开辟空间") # 深拷贝 print("*" * 60) print("深拷贝:") a = [1, 2, 3] ... 阅读全文
摘要:
# is 是比较两个引用是否指向了同一个对象(引用比较)。 # == 是比较两个对象是否相等。 # 注意:小整数对象池 a = [1, 2, 3] b = [1, 2, 3] print(a == b) print(a is b) 阅读全文
摘要:
package doublelinklist; public class Node { int item; Node pre; Node next; public Node(int item) { this.item = item; this.pre = null; this.next = null; }... 阅读全文
摘要:
package sincyclinkedlist; public class Node { int item; Node next; public Node(int item) { this.item = item; this.next = null; } } package sincyclinkedlist; publi... 阅读全文
摘要:
package singlelinklist; public class Node { int item; Node next; public Node(int item) { this.item = item; this.next = null; } } package singlelinklist; public cl... 阅读全文
摘要:
package sort; import java.util.Arrays; public class SearchUtils { public static void main(String[] args) { int[] arr = { 54, 26, 93, 17, 77, 31, 44, 55, 20 }; // 二分查找要求数组有序 ... 阅读全文
摘要:
package sort; import java.util.Arrays; public class SortUtils { public static void main(String[] args) { int[] arr = { 54, 26, 93, 17, 77, 31, 44, 55, 20 }; // bubbleSort(arr); ... 阅读全文