Test 2 with Answer Key - Data Structures - Development | CS 2605, Exams of Data Structures and Algorithms

Material Type: Exam; Professor: McQuain; Class: Data Structs & OO Development; Subject: Computer Science; University: Virginia Polytechnic Institute And State University; Term: Spring 2008;

Typology: Exams

Pre 2010

Uploaded on 05/13/2008

trogdor
trogdor 🇺🇸

11 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
pf3
pf4
pf5

Partial preview of the text

Download Test 2 with Answer Key - Data Structures - Development | CS 2605 and more Exams Data Structures and Algorithms in PDF only on Docsity!

CS 2605 Designing Data Structures and OU Software 1 Test lL Short Answer 1. Explain what, if anything, is wrong with the following recursive definition of a binury search tree: A binary search tree is a binary tree thal is either empty or satisfies the following propertias: * The value in the root of the left subtree of the root, if there is a lel subirea, is less than the value of the root. * The value in the root of the right subtree of the rool, if there is a right subtree, is greater than or equal to the valve of the root. » Both subtrees are themselves binary search trees. ee 4 Aan} be 7 ee te she raf olf wes loes « jo We PH sebtne: ~ ove boss Why fh ue bor at tL, iio a ad tae ell Wel ues in He. find Subly of€ aveeter hey or equ) BNE Foes, a “i Alse ay perdint con fhe. Gy hearty def es doplicedte lee i be 2 lowed {hore fore the fae s We eK ee a ss ee ee ce Ateeten the, the yoOt, bt not 2. Assume a binary tree that has.a height of 3. J aj Whatis the minimum number of nodes that the ree could comain? ' 3 abde = UW b) What is the maximum number of nodes thal the tree cuuld contain’ ede. 3. Assume a binary tree that hus a height of 64_ a} What is the minimum number of nodes that the tree could comtain’? Explain wiry. if Pee a wiped lef Gt, aedes it @ecrh ade hed emmetly Ona. wd except fee last sede phil as have ae children, hy what le gis of nodes that the wee could contain? Explain wicy. The Pre fuer al Aedes jie Iver fe/d conte a S a AQ =i, Wwe gt! tad fhe base ss egu/ Yo 2 be ena eg Node meg hace chkdeer, The power is E44 beceuse COI on ate e{ levels ‘Spring 203 Page 2of 8