Design a binary tree, Data Structure & Algorithms

Assignment Help:

(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.


Related Discussions:- Design a binary tree

Write a program for linear search, In the book the following methods are pr...

In the book the following methods are presented: static void selectionSort(Comparable[] list) static void insertionSort(Comparable[] list) static boolean linearSearch(Comparable

Multiple queue, How to create multiple queue on single array?

How to create multiple queue on single array?

Explain the arrays in ruby, Explain the Arrays in Ruby Ruby arrays are ...

Explain the Arrays in Ruby Ruby arrays are dynamic arrays which expand automatically whenever a value is stored in a location beyond current end of the array. To the programmer

Importance of object-oriented over java, Importance of Object-Oriented over...

Importance of Object-Oriented over java Java is basically based on OOP notions of classes and objects. Java uses a formal OOP type system that should be obeyed at compile-t

Name the five popular hashing functions, Five popular hashing functions are...

Five popular hashing functions are as follows: 1) Division Method 2) Midsquare Method 3) Folding Method 4) Multiplicative method 5) Digit Analysis

Explain about greedy technique, Explain about greedy technique The  gre...

Explain about greedy technique The  greedy  method  suggests  constructing  a   solution  to  an  optimization  problem   by  a sequence of steps, every expanding a partially c

Definition of algorithm, Definition of Algorithm Algorithm must have th...

Definition of Algorithm Algorithm must have the following five characteristic features: 1.      Input 2.      Output 3.      Definiteness 4.      Effectiveness 5

Signals, How does cpu''s part tming and controls generate and controls sign...

How does cpu''s part tming and controls generate and controls signls in computer?

Linked list implementation of a queue, The fundamental element of linked li...

The fundamental element of linked list is a "record" structure of at least two fields. The object which holds the data & refers to the next element into the list is called a node .

Red-black trees, A Red-Black Tree (RBT) is a type of Binary Search tree wit...

A Red-Black Tree (RBT) is a type of Binary Search tree with one extra bit of storage per node, i.e. its color that can either be red or black. Now the nodes can have any of the col

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd