JAVA 应用与开发 - 集合与映射JAVA 应用与开发 集合与映射 让我们愉快的 Coding 起来吧... ��� �������������� November 4, 2019 ���� �����List����Set�����Map�的������� ���������� ������iterator��Enumeration ��������� API ������的������������ 1 28 集合�� 集合�����用���������������合����� �� O 集合类型分类 � Set ��������的������������� ������������的��� �� List ������的��������������� ������的���������������� �������� �� Map �����的��¡���Key-Value������ �������的��������������� 集合�� 集合�����用���������������合����� �� O 集合类型分类 � Set ��������的������������� ������������的��� �� List ������的��������������� ������的���������������� �������� �� Map �����的��¡���Key-Value������ �������的���������������0 码力 | 66 页 | 713.79 KB | 1 年前3
Hello 算法 1.0.0b5 Dart版?(?) ,其中 ? 为数组或链表的长度: // === File: time_complexity.dart === /* 线性阶(遍历数组) */ int arrayTraversal(Listnums) { int count = 0; // 循环次数与数组长度成正比 for (var num in nums) { count++; } return count; === File: time_complexity.dart === /* 平方阶(冒泡排序) */ 第 2 章 复杂度分析 hello‑algo.com 33 int bubbleSort(List nums) { int count = 0; // 计数器 // 外循环:未排序区间为 [0, i] for (var i = nums.length - 1; i > 0; i--) worst_best_time_complexity.dart === /* 生成一个数组,元素为 { 1, 2, ..., n },顺序被打乱 */ List randomNumbers(int n) { final nums = List.filled(n, 0); // 生成数组 nums = { 1, 2, 3, ..., n } for (var i = 0; i < n; i++) 0 码力 | 376 页 | 30.67 MB | 1 年前3
Hello 算法 1.1.0 Dart版// === File: recursion.dart === /* 使用迭代模拟递归 */ int forLoopRecur(int n) { // 使用一个显式的栈来模拟系统调用栈 Liststack = []; int res = 0; // 递:递归调用 for (int i = n; i > 0; i--) { // 通过“入栈操作”模拟“递” stack ?(?) ,其中 ? 为数组或链表的长度: // === File: time_complexity.dart === /* 线性阶(遍历数组) */ int arrayTraversal(List nums) { int count = 0; // 循环次数与数组长度成正比 for (var _num in nums) { count++; } return count; 此时间复杂度为 ?((? − 1)?/2) = ?(?2) : // === File: time_complexity.dart === /* 平方阶(冒泡排序) */ int bubbleSort(List nums) { int count = 0; // 计数器 // 外循环:未排序区间为 [0, i] for (var i = nums.length - 1; i > 0; i--) 0 码力 | 378 页 | 18.45 MB | 1 年前3
Hello 算法 1.2.0 简体中文 Dart 版// === File: recursion.dart === /* 使用迭代模拟递归 */ int forLoopRecur(int n) { // 使用一个显式的栈来模拟系统调用栈 Liststack = []; int res = 0; // 递:递归调用 for (int i = n; i > 0; i--) { // 通过“入栈操作”模拟“递” stack ?(?) ,其中 ? 为数组或链表的长度: // === File: time_complexity.dart === /* 线性阶(遍历数组) */ int arrayTraversal(List nums) { int count = 0; // 循环次数与数组长度成正比 for (var _num in nums) { count++; } return count; 此时间复杂度为 ?((? − 1)?/2) = ?(?2) : // === File: time_complexity.dart === /* 平方阶(冒泡排序) */ int bubbleSort(List nums) { int count = 0; // 计数器 // 外循环:未排序区间为 [0, i] for (var i = nums.length - 1; i > 0; i--) 0 码力 | 378 页 | 18.46 MB | 10 月前3
Hello 算法 1.0.0 Dart版// === File: recursion.dart === /* 使用迭代模拟递归 */ int forLoopRecur(int n) { // 使用一个显式的栈来模拟系统调用栈 Liststack = []; int res = 0; // 递:递归调用 for (int i = n; i > 0; i--) { // 通过“入栈操作”模拟“递” stack ?(?) ,其中 ? 为数组或链表的长度: // === File: time_complexity.dart === /* 线性阶(遍历数组) */ int arrayTraversal(List nums) { int count = 0; // 循环次数与数组长度成正比 for (var _num in nums) { count++; } return count; 此时间复杂度为 ?((? − 1)?/2) = ?(?2) : // === File: time_complexity.dart === /* 平方阶(冒泡排序) */ int bubbleSort(List nums) { int count = 0; // 计数器 // 外循环:未排序区间为 [0, i] for (var i = nums.length - 1; i > 0; i--) 0 码力 | 377 页 | 17.56 MB | 1 年前3
python3学习手册(python3无long长整型) True=1, False=0 string 有序strx='xxxx' stry="xxx" 不区别单引号与双引号, 单个字符也是string list 有序 列表,数组 tuple 有序 元组 set 无序 不重复(自动删除重复项) 集合 py3新 增 dic�onary 无序 字典 数 组 , 其 元 素 值 可 变 , 其 元 素 类 型 为 int (0~255) py3新增 不可变类型: Number String Tuple bytes 可变类型: List Dic�onary Set bytearray set 集合是由若干个元素组成的,基本功能是 进行成员关系测试 和 删 除重复元素 set可以进行数学上的集合运算(差集,并集,交集等) listxx) 将字符串str型list转为int型list strlist = ["23","15","6","44"] #元素类型为str strnn = list(map(int, strlist)) #map()将strlist的元素 都转为int型,map()返回的是map类型,需要再使用 list()转为list型 tuple(map(int0 码力 | 213 页 | 3.53 MB | 1 年前3
Hello 算法 1.0.0b4 Python版视为输 入数据大小;在下面遍历数组的示例中,数据大小 ? 为数组的长度。 # === File: time_complexity.py === def array_traversal(nums: list[int]) -> int: """ 线性阶(遍历数组)""" count = 0 # 循环次数与数组长度成正比 for num in nums: count += 1 return count 时间复杂度为 ?(?2) 。 ?((? − 1)? 2 ) = ?(?2) # === File: time_complexity.py === def bubble_sort(nums: list[int]) -> int: """ 平方阶(冒泡排序)""" count = 0 # 计数器 # 外循环:未排序区间为 [0, i] for i in range(len(nums) - int) -> list[int]: """ 生成一个数组,元素为: 1, 2, ..., n ,顺序被打乱""" # 生成数组 nums =: 1, 2, 3, ..., n nums = [i for i in range(1, n + 1)] # 随机打乱数组元素 random.shuffle(nums) return nums def find_one(nums: list[int])0 码力 | 329 页 | 27.34 MB | 1 年前3
Hello 算法 1.0.0b5 Python版遍历数组和遍历链表等操作的时间复杂度均为 ?(?) ,其中 ? 为数组或链表的长度: # === File: time_complexity.py === def array_traversal(nums: list[int]) -> int: """ 线性阶(遍历数组)""" count = 0 # 循环次数与数组长度成正比 for num in nums: count += 1 return count /2 次,因 此时间复杂度为 ?((? − 1)?/2) = ?(?2) 。 # === File: time_complexity.py === def bubble_sort(nums: list[int]) -> int: """ 平方阶(冒泡排序)""" count = 0 # 计数器 # 外循环:未排序区间为 [0, i] for i in range(len(nums) - int) -> list[int]: """ 生成一个数组,元素为: 1, 2, ..., n ,顺序被打乱""" # 生成数组 nums =: 1, 2, 3, ..., n nums = [i for i in range(1, n + 1)] # 随机打乱数组元素 random.shuffle(nums) return nums def find_one(nums: list[int])0 码力 | 361 页 | 30.64 MB | 1 年前3
Hello 算法 1.1.0 Python版遍历数组和遍历链表等操作的时间复杂度均为 ?(?) ,其中 ? 为数组或链表的长度: # === File: time_complexity.py === def array_traversal(nums: list[int]) -> int: """ 线性阶(遍历数组)""" count = 0 # 循环次数与数组长度成正比 for num in nums: count += 1 return count /2 次,因 此时间复杂度为 ?((? − 1)?/2) = ?(?2) : # === File: time_complexity.py === def bubble_sort(nums: list[int]) -> int: """ 平方阶(冒泡排序)""" count = 0 # 计数器 # 外循环:未排序区间为 [0, i] for i in range(len(nums) - int) -> list[int]: """ 生成一个数组,元素为: 1, 2, ..., n ,顺序被打乱""" # 生成数组 nums =: 1, 2, 3, ..., n nums = [i for i in range(1, n + 1)] # 随机打乱数组元素 random.shuffle(nums) return nums def find_one(nums: list[int])0 码力 | 364 页 | 18.42 MB | 1 年前3
Hello 算法 1.0.0 Python版遍历数组和遍历链表等操作的时间复杂度均为 ?(?) ,其中 ? 为数组或链表的长度: # === File: time_complexity.py === def array_traversal(nums: list[int]) -> int: """ 线性阶(遍历数组)""" count = 0 # 循环次数与数组长度成正比 for num in nums: count += 1 return count /2 次,因 此时间复杂度为 ?((? − 1)?/2) = ?(?2) : # === File: time_complexity.py === def bubble_sort(nums: list[int]) -> int: """ 平方阶(冒泡排序)""" count = 0 # 计数器 # 外循环:未排序区间为 [0, i] for i in range(len(nums) - int) -> list[int]: """ 生成一个数组,元素为: 1, 2, ..., n ,顺序被打乱""" # 生成数组 nums =: 1, 2, 3, ..., n nums = [i for i in range(1, n + 1)] # 随机打乱数组元素 random.shuffle(nums) return nums def find_one(nums: list[int])0 码力 | 362 页 | 17.54 MB | 1 年前3
共 645 条
- 1
- 2
- 3
- 4
- 5
- 6
- 65













