【正文】
puter Science Hai Mo Page 51 Stacks and Queues Queue(隊列 ) An abstract data type in which items are entered at one end and removed from the other end ? FIFO, for First In First Out ? No standard queue terminology ? Enqueue, Enque, Enq, Enter, and Insert are used for the insertion operation ? Dequeue, Deque, Deq, Delete, and Remove are used for the deletion operation. 2022/2/16 Fundamentals of Computer Science Hai Mo Page 52 Stacks and Queues ? Implementation of A linked stack 2022/2/16 Fundamentals of Computer Science Hai Mo Page 53 Implementation of A linked queue 2022/2/16 Fundamentals of Computer Science Hai Mo Page 54 Trees ? Tree - At the top of the hierarchy would be the parents, the children would be at the next level, the grandchildren at the next level, and so on. These hierarchical structures are called trees. 2022/2/16 Fundamentals of Computer Science Hai Mo Page 55 Trees ? Binary tree(二分樹 ) - A container object with a unique starting node called the root, in which each node is capable of having two child nodes, and in which a unique path exists from the root to every other node ? Root - The top node of a tree structure。 a node with no parent ? Leaf node - A tree node that has no children 2022/2/16 Fundamentals of Computer Science Hai Mo Page 56 A Binary tree 2022/2/16 Fundamentals of Computer Science Hai Mo Page 57 A Binary tree Root node Node with two children Node with right child Leaf node Node with left child 2022/2/16 Fundamentals of Computer Science Hai Mo Page 58 Two variations of a binary tree 2022/2/16 Fundamentals of Computer Science Hai Mo Page 59 Trees ? Binary Search Tree(二分查找樹) - a node in a binary search tree can have zero, one, or two children. The value in any node is greater than the value in any node in its left subtree and less than the value in any node in its right subtree. 2022/2/16 Fundamentals of Computer Science Hai Mo Page 60 Trees ? Building a Binary Search Tree 2022/2/16 Fundamentals of Computer Science Hai Mo Page 61 A binary search tree built from strings 2022/2/16 Fundamentals of Computer Science Hai Mo Page 62 Trees ? Printing the Data in a Binary Search Tree BCLNS 2022/2/16 Fundamentals of Computer Science Hai Mo Page 63 Graphs ? Graph: A data structure that consists of a set of odes and a set of edges that relate the nodes to each other ? Vertex: A node in a graph ? Edge (Arc): A pair of vertices representing a connection between two nodes in a graph ? Undirected graph: A graph in which the edges have no direction ? Directed graph: A graph in which each edge is directed from one vertex to another (or the same) vertex 2022/2/16 Fundamentals of Computer Science Hai Mo Page 64 Examples of graphs 2022/2/16 Fundamentals of Computer Science Hai Mo Page 65 Examples of graphs 2022/2/16 Fundamentals of Computer Science Hai Mo Page 66 Examples of graphs