mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-02 21:24:53 +08:00
1. Remove Pair class from hash coliision code.
2. Fix the comment in my_list code. 3. Add a Q&A to the summary of sorting.
This commit is contained in:
@ -51,7 +51,7 @@ class MyList:
|
||||
# 元素数量超出容量时,触发扩容机制
|
||||
if self.__size == self.capacity():
|
||||
self.extend_capacity()
|
||||
# 索引 i 以及之后的元素都向后移动一位
|
||||
# 将索引 index 以及之后的元素都向后移动一位
|
||||
for j in range(self.__size - 1, index - 1, -1):
|
||||
self.__nums[j + 1] = self.__nums[j]
|
||||
self.__nums[index] = num
|
||||
|
||||
@ -4,12 +4,10 @@ Created Time: 2023-06-13
|
||||
Author: Krahets (krahets@163.com)
|
||||
"""
|
||||
|
||||
class Pair:
|
||||
"""键值对"""
|
||||
import sys, os.path as osp
|
||||
|
||||
def __init__(self, key: int, val: str):
|
||||
self.key = key
|
||||
self.val = val
|
||||
sys.path.append(osp.dirname(osp.dirname(osp.abspath(__file__))))
|
||||
from chapter_hashing.array_hash_map import Pair
|
||||
|
||||
|
||||
class HashMapChaining:
|
||||
|
||||
@ -4,13 +4,10 @@ Created Time: 2023-06-13
|
||||
Author: Krahets (krahets@163.com)
|
||||
"""
|
||||
|
||||
import sys, os.path as osp
|
||||
|
||||
class Pair:
|
||||
"""键值对"""
|
||||
|
||||
def __init__(self, key: int, val: str):
|
||||
self.key = key
|
||||
self.val = val
|
||||
sys.path.append(osp.dirname(osp.dirname(osp.abspath(__file__))))
|
||||
from chapter_hashing.array_hash_map import Pair
|
||||
|
||||
|
||||
class HashMapOpenAddressing:
|
||||
|
||||
Reference in New Issue
Block a user