Presentation is loading. Please wait.

Presentation is loading. Please wait.

Abstract Data Structures

Similar presentations


Presentation on theme: "Abstract Data Structures"— Presentation transcript:

1 Abstract Data Structures
Binary Trees

2 Root The top node in a tree.

3 Parent A node within a tree that has nodes that branch off from it (children)
Examples: Orlando is a parent to Hartford and Stamford Danbury is parent to Greenville

4 Child A node within a tree that branches off from another (parent)
Examples: Quincy is a child of Stamford Greenville is a child of Danbury

5 Subtree The grouping of a parent and a child in a tree.
Example:

6 Leaf A node with no children within a tree.
Examples: Nashua Greenville Quincy Warwick

7 Traversal Going through each of the nodes of a tree

8 Breadth-first traversal Traversing trees in level-order, where every node on a level is visited before going to a lower level. Example: Orlando Hartford Stamford Danbury Nashua Quincy Tampa Greenville Warwick

9 Depth-first traversal Includes the three traversal methods in-order, preorder, and postorder

10 Inorder A type of depth-first traversal where a left subtree is processed, then the parent, and then the left subtree. Algorithm: Perform inorder traversal of left subtree Visit node of right subtree

11 Inorder A type of depth-first traversal where a left subtree is processed, then the parent, and then the left subtree. Example: Danbury Greenville Hartford Nashua Orlando Quincy Stamford Tampa Warwick

12 Preorder A type of depth-first traversal where a where a node is visited before its children
Algorithm: Visit node Perform inorder traversal of left subtree of right subtree

13 Preorder A type of depth-first traversal where a where a node is visited before its children
Example: Orlando Hartford Danbury Greenville Nashua Stamford Quincy Tampa Warwick

14 Postorder A type of depth-first traversal where a where a node is visited after its children
Algorithm: Perform inorder traversal of left subtree of right subtree Visit node

15 Postorder A type of depth-first traversal where a where a node is visited after its children
Example: Greenville Danbury Nashua Hartford Quincy Warwick Tampa Stamford Orlando

16 Dynamic Data-Structure A data structure in which the number of elements can change during program execution


Download ppt "Abstract Data Structures"

Similar presentations


Ads by Google