Algorithm
文章平均质量分 82
t
dénnnnnnnnnnn
这个作者很懒,什么都没留下…
展开
-
[GeneralAlgorithm] Binary Tree Algorithm 单链表算法 (in Python)
Binary Tree Algorithm (in Python) 简易二叉树算法,包含可视化打印,附三类顺序表达和额外查找方法。 最后一部分代码用以根据两种 data orders (inorder & preorder) 识别并创建Binary tree object. class BinaryTree: def __init__(self, rootElement): self.key = rootElement self.left = None原创 2020-12-01 12:59:12 · 143 阅读 · 0 评论 -
[GeneralAlgorithm] Stack Algorithm 栈算法 (in Python)
Stack Algorithm (in Python) 栈算法,携Sample Test部分 class Stack: def __init__(self): self.items = [] def push(self, item): self.items.append(item) def pop(self): return self.items.pop() def peek(self):原创 2020-12-01 12:51:33 · 109 阅读 · 0 评论 -
[GeneralAlgorithm] Bounded Queue Algorithm 有界队列算法 (in Python)
Bounded Queue Algorithm (in Python) 简易有界队列算法,携Sample Test部分 class BoundedQueue: def __init__(self, capacity): assert isinstance(capacity, int), ('Error: Type error: {}'.format(type(capacity))) self.__items = [] self.__capacity原创 2020-12-01 12:35:46 · 171 阅读 · 0 评论 -
[GeneralAlgorithm] Circular Queue Algorithm 循环队列算法 (in Python)
Circular Queue Algorithm (in Python) 简易循环队列算法 class CircularQueue: def __init__(self, capacity): """ Constructor, which creates a new empty queue. """ # Check validity of capacity type and value if type(capacity)原创 2020-12-01 12:35:08 · 84 阅读 · 0 评论 -
[GeneralAlgorithm] Single-linked List Algorithm 单链表算法 (in Python)
Single-linked List Algorithm (in Python) 简易单链表算法,携Sample Test部分 class SLinkedListNode: def __init__(self, initData, initNext): self.data = initData self.next = initNext def getNext(self): return self.next def getData(s原创 2020-12-01 11:15:16 · 83 阅读 · 0 评论 -
[GeneralAlgorithm] Double-linked List Algorithm 双链表算法 (in Python)
Double-linked List Algorithm (in Python) 简易双链表算法,部分功能待补充。 class DLinkedListNode: def __init__(self, initData=None, initNext=None, initPrevious=None): self.data = initData self.next = initNext self.previous = initPrevious原创 2020-12-01 11:08:48 · 106 阅读 · 0 评论