Python数据结构
文章平均质量分 75
Python数据结构
Amos98
这个作者很懒,什么都没留下…
展开
-
Python数据结构目录
参考视频:https://www.youtube.com/watch?v=kQDxmjfkIKY&ab_channel=CodDevX 参考代码:https://github.com/joeyajames/udemy_data_structures Strings, Lists, Tuples, Sets, Dicts List综合 String, List, Tuple为线性结构,Sets与Dicts为集合结构 Tuple是不可变的,但成员对象可能是可变的,如Tuple的某个元素是一个Lis.原创 2021-12-11 22:16:56 · 778 阅读 · 0 评论 -
Graph Implementation Using Adjacency Lists and Matirx
Graph Implementation Using Adjacency Lists for an undirected graph. © Joe James, 2019. Vertex Class The Vertex class has a constructor that sets the name of the vertex (in our example, just a letter), and creates a new empty set to store neighbors. The ad.转载 2021-12-11 21:52:05 · 149 阅读 · 0 评论 -
Binary Search Tree
Binary Search Tree Constructor sets three attributes: data, left subtree and right subtree. Each node is greater than every node in its left subtree, and is less than every node in its right subtree. Insert inserts a new subtree into the proper location. F转载 2021-12-11 16:43:09 · 102 阅读 · 0 评论 -
Python Linked Lists: Singly Linked List, Circular Linked List, and Doubly Linked List
Python Linked Lists Node Class Node class has a constructor that sets the data passed in, and optionally can set the next_node and prev_node. It also has a str method to give a string representation for printing. Note that prev_node is only used for Doubly转载 2021-11-21 15:35:55 · 256 阅读 · 0 评论 -
Stacks, Queues & Heaps in Python
Stacks, Queues & Heaps © Joe James, 2019. Stack using Python List Stack is a LIFO data structure – last-in, first-out. Use append() to push an item onto the stack. Use pop() to remove an item. my_stack = list() my_stack.append(4) my_stack.append(7) my_转载 2021-11-21 13:26:59 · 148 阅读 · 0 评论 -
Python List Comprehensions
Python List Comprehensions basic format: new_list = [transform sequence [filter] ] © Joe James, 2019. import random get values within a range under_10 = [x for x in range(10)] print('under_10: ' + str(under_10)) under_10: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]转载 2021-11-20 16:30:07 · 179 阅读 · 0 评论 -
Intro to Python Data Structures
Intro to Python Data Structures Strings, Lists, Tuples, Sets, Dicts Created in Python 3.7 © Joe James, 2019. Sequences: String, List, Tuple Documentation indexing - access any item in the sequence using its index. Indexing starts with 0 for the first elem转载 2021-11-20 16:06:45 · 121 阅读 · 0 评论