Design a binary tree, Data Structure & Algorithms

(a) Suppose that t is a binary tree of integers (that is, an object of type BinTree of Int.) in the state shown in Figure 3.

 

1533_Give the binary tree.png

Give the vectors returned by each of the following expressions.

(i) LEVEL_ORDER(t)

(ii) IN_ORDER(t.leftTree( ))

(b) suppose that v is an object of type VectorPlus of mString in the state ["tawny", "little", "barn", "long-eared", "eagle", "scops"]

In answering this part of the question you may, if you wish, use the WorkPad.

(i) Suppose that the strings in the vector v are rearranged into a sorted vector (where the strings in v arc compared using the lexicographic order described on page 32 of Unit 8). G i v e t h e vector that results from this rearrangement

(ii) Suppose that, the function GROW_TREE is applied to the sorted vector which you gave in part (i). Give the binary search tree which is returned by GROW_TREE.

(iii) Suppose that. The string "hawk" is inserted into the binary search tree which you gave in part (ii), using Strategy 3.2 of Unit 8. Give the resulting tree.

(c) The tree in Figure is a heap tree. Use Strategy 3.4 of Unit 8 to remove the root item from that tree. Give the binary tree produced by this strategy.

Posted Date: 3/7/2013 2:18:31 AM | Location : United States







Related Discussions:- Design a binary tree, Assignment Help, Ask Question on Design a binary tree, Get Answer, Expert's Help, Design a binary tree Discussions

Write discussion on Design a binary tree
Your posts are moderated
Related Questions
Explain in detail the algorithmic implementation of multiple stacks.

Using the cohen sutherland. Algorithm. Find the visible portion of the line P(40,80) Q(120,30) inside the window is defined as ABCD A(20,20),B(60,20),C(60,40)and D(20,40)

Properties of colour Colour descriptions and specifications generally include three properties: hue; saturation and brightness. Hue associates a colour with some position in th

Write a program that uses the radix sort to sort 1000 random digits. Print the data before and after the sort. Each sort bucket should be a linked list. At the end of the sort, the

Example which cause problems for some hidden-surface algorithms Some special cases, which cause problems for some hidden-surface algorithms, are penetrating faces and cyclic ov

Write steps for algorithm for In-order Traversal This process when implemented iteratively also needs a stack and a Boolean to prevent the execution from traversing any portion

Ruby implementation of the Symbol ADT Ruby implementation of the Symbol ADT, as mentioned, hinges on making Symbol class instances immutable that corresponds to the relative la

Operations on B-Trees Given are various operations which can be performed on B-Trees: Search Create Insert B-Tree does effort to minimize disk access and t

Explain binary search with an example

In computer programming, Trees are utilized enormously. These can be utilized for developing database search times (binary search trees, AVL trees, 2-3 trees, red-black trees), Gam