TAILIEUCHUNG - Lecture Algorithms and data structures: Chapter 26 - Trees

This chapter provided a broad presentation about the database development process. You learned about the relationship between database development and information systems development, the phases of database development, and the kinds of skills you need to master. This chapter presents the notation of entity relationship diagrams to provide a foundation for using entity relationship diagrams in the database development process. | Review 1 Queue Operations on Queues A Dequeue Operation An Enqueue Operation Array Implementation Link list Implementation Examples Review Circular queue Double Ended Queue Priority queue 2 Trees Binary Tree Binary Tree Representation Array Representation Link List Representation Operations on Binary Trees Traversing Binary Trees Pre-Order Traversal Recursively In-Order Traversal Recursively Post-Order Traversal Recursively 3 Trees Trees are very flexible, versatile and powerful non-liner data structure It can be used to represent data items possessing hierarchical relationship A tree can be theoretically defined as a finite set of one or more data items (or nodes) such that There is a special node called the root of the tree Remaining nodes (or data item) are partitioned into number of subsets each of which is itself a tree, are called sub tree A tree is a set of related interconnected nodes in a hierarchical structure 4 4 Trees Where have you seen a tree structure before? Examples of trees: - Directory tree - Family tree - Company organization chart - Table of contents - etc. 5 Basic Terminologies Root is a specially designed node (or data items) in a tree It is the first node in the hierarchical arrangement of the data items For example, Figure 1. A Tree 6 In this example ‘A’ is the root node Each data item in a tree is known as node It specifies the data information and links to other data items Degree of a node Degree of a node is the number of subtrees of a node in a given tree In the above example the degree of node A is 3 the degree of node B is 2 the degree of node C is 2 the degree of node D is 3 7 The Degree of a Tree The degree of a tree is the maximum degree of node in a given tree The degree of node J is 4 All other nodes have less or equal degree So the degree of the above tree is 4 A node with degree zero (0) is called terminal node or a leaf In the above example, nodes M,N,I,O etc are leaf nodes Any node whose degree is not zero is called a .

TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.