BST and Graph Questions PDF

Title BST and Graph Questions
Author Nadia Merrigan
Course Data Structure and Algorithms
Institution Institute of Technology Blanchardstown
Pages 4
File Size 164.3 KB
File Type PDF
Total Views 157

Summary

Download BST and Graph Questions PDF


Description

Sample of Short Binary Search Tree Questions Question 1 a) Draw a binary search tree that contains the following sequence and write out a PreOrder and PostOrder traversal.! ! {25, 21, 28, 18, 22, 24, 10, 16, 8, 26, 27, 30, 34, 31, 35} b) Redraw the tree completed in part a) after the node 21 has been removed. Also label all the leaf nodes after removal and write down the height of the new tree. c) Confirm that the following tree is unbalanced by creating a table containing the balance factors for each node.

Question 2 a) Draw a binary search tree that contains the following sequence and write out a PreOrder and PostOrder traversal.! ! {21, 50, 18, 16, 25, 53, 12, 22, 19, 17, 26} b) Redraw the tree completed in part a) after the node 18 has been removed. Also label all the leaf nodes after removal and write down the height of the new tree. ! c) Confirm that the following tree is balanced by creating a table containing the balance factors for each node. !

Question 3 a) Draw a binary search tree that contains the following sequence and write out a InOrder and PostOrder traversal.! ! {100, 90, 70, 96, 75, 30, 110, 102, 120, 130, 98} ! b) Redraw the tree completed in part a) after the node 18 has been removed. Also label all the leaf nodes after removal and write down the height of the new tree. ! c) Confirm that the following tree is unbalanced by creating a table containing the balance factors for each node. !

Sample of Short Graph Questions Question 1 a) Draw the graph represented by the following set notation:! ! G = { {A,B,C,D,E,F} { {A,B}, {A,F}, {B,C}, {B,D}, {B,E}, ! {B,F}, {C,D}, {D,E}, {E,f} }}! b) Write down a depth first and breath first traversal of the graph in part a).! c) Write down an Adjacency Matrix for graph in part a).

Question 2 a) Draw the graph represented by the following set notation:! ! G = { {1,2,3,4,5} { {1,2}, {1,3}, {1,5}, {2,3}, {3,4}, ! {3,5}, {4,5} }}! b) Write down a depth first and breath first traversal of the graph in part a).! c) Write down an Adjacency Matrix for graph in part a).

Question 3 a) Draw the graph represented by the following set notation:! ! G = { {1,2,3,4,5,6,7} { {1,2}, {1,7}, {2,3}, {2,5}, {2,7}, ! {3,4}, {4,5}, {4,6}, {5,7}, {6,7} }}! b) Write down a depth first and breath first traversal of the graph in part a).! c) Write down an Adjacency Matrix for graph in part a)....


Similar Free PDFs