CSCI-401 Examlet #5. Name: Class: Date: True/False Indicate whether the sentence or statement is true or false.

Similar documents
Chapter 20: Binary Trees

Associate Professor Dr. Raed Ibraheem Hamed

Trees. Q: Why study trees? A: Many advance ADTs are implemented using tree-based data structures.

Friday Four Square! 4:15PM, Outside Gates

Binary Trees

Trees. Tree Structure Binary Tree Tree Traversals

Binary Trees, Binary Search Trees

Trees. CSE 373 Data Structures

March 20/2003 Jayakanth Srinivasan,

Programming II (CS300)

CSE 230 Intermediate Programming in C and C++ Binary Tree

Trees. Truong Tuan Anh CSE-HCMUT

a graph is a data structure made up of nodes in graph theory the links are normally called edges

TREES. Trees - Introduction

Trees : Part 1. Section 4.1. Theory and Terminology. A Tree? A Tree? Theory and Terminology. Theory and Terminology

Trees. (Trees) Data Structures and Programming Spring / 28

Section 5.5. Left subtree The left subtree of a vertex V on a binary tree is the graph formed by the left child L of V, the descendents

Tree Structures. A hierarchical data structure whose point of entry is the root node

Trees! Ellen Walker! CPSC 201 Data Structures! Hiram College!

Computational Optimization ISE 407. Lecture 16. Dr. Ted Ralphs

CS24 Week 8 Lecture 1

Trees. Introduction & Terminology. February 05, 2018 Cinda Heeren / Geoffrey Tien 1

CE 221 Data Structures and Algorithms

Garbage Collection: recycling unused memory

Successor/Predecessor Rules in Binary Trees

Trees 11/15/16. Chapter 11. Terminology. Terminology. Terminology. Terminology. Terminology

CSC148 Week 6. Larry Zhang

Binary Search Trees. See Section 11.1 of the text.

Data Structures and Algorithms for Engineers

CSE2331/5331. Topic 6: Binary Search Tree. Data structure Operations CSE 2331/5331

Programming II (CS300)

Algorithms in Systems Engineering ISE 172. Lecture 16. Dr. Ted Ralphs

Abstract Data Structures IB Computer Science. Content developed by Dartford Grammar School Computer Science Department

Chapter 4 Trees. Theorem A graph G has a spanning tree if and only if G is connected.

Data Structures. Binary Trees. Root Level = 0. number of leaves:?? leaves Depth (Maximum level of the tree) leaves or nodes. Level=1.

Advanced Tree Data Structures

Trees and Tree Traversals. Binary Trees. COMP 210: Object-Oriented Programming Lecture Notes 8. Based on notes by Logan Mayfield

DATA STRUCTURES AND ALGORITHMS. Hierarchical data structures: AVL tree, Bayer tree, Heap

Binary Tree. Preview. Binary Tree. Binary Tree. Binary Search Tree 10/2/2017. Binary Tree

Data Structure - Binary Tree 1 -

CS 206 Introduction to Computer Science II

COSC 2011 Section N. Trees: Terminology and Basic Properties

1 Binary trees. 1 Binary search trees. 1 Traversal. 1 Insertion. 1 An empty structure is an empty tree.

Friday, March 30. Last time we were talking about traversal of a rooted ordered tree, having defined preorder traversal. We will continue from there.

BBM 201 Data structures

Data Structures - Binary Trees and Operations on Binary Trees

Data Structure Lecture#10: Binary Trees (Chapter 5) U Kang Seoul National University

Introduction to Computers and Programming. Concept Question

Chapter 11.!!!!Trees! 2011 Pearson Addison-Wesley. All rights reserved 11 A-1

Chapter 11.!!!!Trees! 2011 Pearson Addison-Wesley. All rights reserved 11 A-1

(2,4) Trees. 2/22/2006 (2,4) Trees 1

Module 4: Index Structures Lecture 13: Index structure. The Lecture Contains: Index structure. Binary search tree (BST) B-tree. B+-tree.

Self-Balancing Search Trees. Chapter 11

Todays Lecture. Assignment 2 deadline: You have 5 Calendar days to complete.

Uses for Trees About Trees Binary Trees. Trees. Seth Long. January 31, 2010

COSC 2007 Data Structures II Final Exam. Part 1: multiple choice (1 mark each, total 30 marks, circle the correct answer)

First Semester - Question Bank Department of Computer Science Advanced Data Structures and Algorithms...

CS350: Data Structures Tree Traversal

Tree. A path is a connected sequence of edges. A tree topology is acyclic there is no loop.

Programming Languages and Techniques (CIS120)

CS 206 Introduction to Computer Science II

Course Review for. Cpt S 223 Fall Cpt S 223. School of EECS, WSU

Computer Science 210 Data Structures Siena College Fall Topic Notes: Trees

Binary Trees and Binary Search Trees

Tree: non-recursive definition. Trees, Binary Search Trees, and Heaps. Tree: recursive definition. Tree: example.

Multi-Way Search Tree

Binary Trees. College of Computing & Information Technology King Abdulaziz University. CPCS-204 Data Structures I

Tree traversals and binary trees

Cpt S 122 Data Structures. Data Structures Trees

CSI33 Data Structures

Binary Trees. Directed, Rooted Tree. Terminology. Trees. Binary Trees. Possible Implementation 4/18/2013

(2,4) Trees Goodrich, Tamassia (2,4) Trees 1

! Tree: set of nodes and directed edges. ! Parent: source node of directed edge. ! Child: terminal node of directed edge

Introduction to Trees. D. Thiebaut CSC212 Fall 2014

Data Structure Advanced

Chapter 10: Trees. A tree is a connected simple undirected graph with no simple circuits.

Binary search trees (chapters )

TREES Lecture 10 CS2110 Spring2014

Data Structures And Algorithms

Data Structures. Trees. By Dr. Mohammad Ali H. Eljinini. M.A. Eljinini, PhD

Programming II (CS300)

Balanced Search Trees. CS 3110 Fall 2010

CS350: Data Structures B-Trees

F453 Module 7: Programming Techniques. 7.2: Methods for defining syntax

Binary Trees. Examples:

INF2220: algorithms and data structures Series 1

! Tree: set of nodes and directed edges. ! Parent: source node of directed edge. ! Child: terminal node of directed edge

Definitions A A tree is an abstract t data type. Topic 17. "A tree may grow a. its leaves will return to its roots." Properties of Trees

7.1 Introduction. A (free) tree T is A simple graph such that for every pair of vertices v and w there is a unique path from v to w

A set of nodes (or vertices) with a single starting point

STUDENT LESSON AB30 Binary Search Trees

Name CPTR246 Spring '17 (100 total points) Exam 3

[ DATA STRUCTURES ] Fig. (1) : A Tree

CSI33 Data Structures

Binary Search Trees. What is a Binary Search Tree?

CSE 373 APRIL 17 TH TREE BALANCE AND AVL

Why Do We Need Trees?

Trees, Binary Trees, and Binary Search Trees

Binary Trees Fall 2018 Margaret Reid-Miller

CS61B Lecture #20: Trees. Last modified: Mon Oct 8 21:21: CS61B: Lecture #20 1

Transcription:

Name: Class: Date: CSCI-401 Examlet #5 True/False Indicate whether the sentence or statement is true or false. 1. The root node of the standard binary tree can be drawn anywhere in the tree diagram. 2. Each node in a binary tree contains data and a link to the left child and a link to the right child. 3. Any node in a binary tree can be called a leaf node. 4. The level of a node in a binary tree is the number of branches on the path from the root to the node. 5. The level of the root node of a binary tree is 1, and the level of the children of the root node is 0. 6. The height of a binary tree is the number of nodes on the longest path from the root to a leaf. 7. In an inorder traversal, the binary tree is traversed as follows: 1) Traverse the left subtree, 2) Visit the node, and 3) Traverse the right subtree. 8. In an preorder traversal, the binary tree is traversed as follows: 1) Traverse the left subtree, 2) Visit the node, and 3) Traverse the right subtree. 9. In an postorder traversal, the binary tree is traversed as follows: 1)Traverse the left subtree, 2) Visit the node, and 3) Traverse the right subtree. 10. The listing of the nodes produced by the inorder traversal of a binary tree is called the preorder sequence. 11. In a binary search tree the key in the root node is larger than every key in the left subtree and smaller than every key in the right subtree. 12. When deleting a node from a binary search tree you must consider three cases. 13. Recursive functions are more efficient then their iterative versions. 14. A perfectly balanced binary tree is a binary tree such that: 1) the height of the left and right subtrees of the root are equal, and 2) the left and right subtrees of the root are perfectly balanced binary trees. Multiple Choice Identify the letter of the choice that best completes the statement or answers the question. 15. If a binary tree x has two subtrees, left and right, which of the following must be true about left and right? a. left and right are binary trees c. left and right are linked lists b. left and right are lists d. left and right are queues 1

Name: 16. In the figure above we see a. a. binary tree with six nodes c. binary tree with seven nodes b. binary tree with four branches d. binary tree with eight branches 17. In the figure above, the root node contains. a. 20 c. 60 b. 28 d. 88 18. In the figure above, the leftmost node contains. a. 20 c. 70 b. 28 d. 88 19. In the figure above, the rightmost node contains. a. 28 c. 88 b. 60 d. 90 20. There is a unique path from the to every node in the binary tree. a. branch c. reference b. root d. info 21. The of a node in a binary tree is the number of branches on the path from the root to the node. a. level c. width b. height d. depth 22. The of a binary tree is the number of nodes on the longest path from the root to a leaf. a. level c. width b. height d. depth 2

Name: 23. In the figure above, the inorder sequence is. a. A B D C c. B D A C b. D B C A d. B D C A 24. In the figure above, the preorder sequence is. a. B D A C c. D B C A b. A B D C d. D B A C 25. In the figure above, the postorder sequence is. a. B D A C c. D B C A b. A B D C d. D B A C 26. Which of the following is not an operation performed on a binary tree? a. search the tree c. delete an item from the tree b. move the tree d. copy the tree 27. In a binary search tree, the key in the node is larger than every key in the left subtree and smaller than every key in the right subtree. a. child c. right b. root d. head 28. There are cases to consider when deleting a node from a binary search tree. a. two c. four b. three d. five 29. With respect to binary trees, the recursive tree traversal functions are than their iterative versions. a. equally efficient c. less efficient b. more efficient d. more complex 30. In a perfectly balanced binary tree. a. the height of the left and right subtrees of the root are equal b. the height of the left and right subtrees of the root differ by 1 c. the height of the left and right subtrees of the root is 1 d. b or c only 31. In a perfectly balanced binary tree. a. the left and right subtrees of the root are binary trees b. the left and right subtrees of the root have the same depth c. the left and right subtrees of the root have the same width d. the left and right subtrees of the root are perfectly balanced binary trees 3

Name: 32. What is the level of the children of the root node of a binary tree? a. -1 c. 1 b. 0 d. 2 33. The inorder traversal of the tree above is. a. 46-30-58-50-77-80-70-60 c. 30-46-50-58-60-70-77-80 b. 80-77-70-60-58-50-46-30 d. 60-50-30-46-58-70-80-77 34. The postorder traversal of the tree above is. a. 46-30-58-50-77-80-70-60 c. 30-46-50-58-60-70-77-80 b. 80-77-70-60-58-50-46-30 d. 60-50-30-46-58-70-80-77 35. The preorder traversal of the tree above is. a. 46-30-58-50-77-80-70-60 c. 30-46-50-58-60-70-77-80 b. 80-77-70-60-58-50-46-30 d. 60-50-30-46-58-70-80-77 4

CSCI-401 Examlet #5 Answer Section TRUE/FALSE 1. ANS: F REF: 594 2. ANS: T REF: 598 3. ANS: F REF: 599 4. ANS: T REF: 599 5. ANS: F REF: 599 6. ANS: T REF: 599 7. ANS: T REF: 601 8. ANS: F REF: 602 9. ANS: F REF: 602 10. ANS: F REF: 602 11. ANS: T REF: 613 12. ANS: F REF: 618 13. ANS: F REF: 626 14. ANS: T REF: 630 MULTIPLE CHOICE 15. ANS: A REF: 594 16. ANS: C REF: 597 17. ANS: C REF: 597 18. ANS: B REF: 597 19. ANS: C REF: 597 20. ANS: B REF: 599 21. ANS: A REF: 599 22. ANS: B REF: 599 23. ANS: C REF: 604 24. ANS: B REF: 604 25. ANS: C REF: 604 26. ANS: B REF: 605 27. ANS: A REF: 613 28. ANS: A REF: 618 29. ANS: B REF: 626 30. ANS: A REF: 630 31. ANS: D REF: 630 32. ANS: C REF: 599 33. ANS: C REF: 601 34. ANS: A REF: 602 35. ANS: D REF: 602 1

CSCI-401 Examlet #5 [Answer Strip] C 32. F 1. T 2. F 3. T 4. F 5. T 6. T 7. C 23. F 8. C 16. B 24. F 9. C 17. C 25. F 10. T 11. B 18. B 26. C 33. F 12. F 13. C 19. A 27. A 34. T 14. B 20. A 28. D 35. A 21. B 29. A 15. B 22. A 30. D 31.