Question

a) We have discussed level-filled binary and BST: both are rooted trees. What is the main...

a) We have discussed level-filled binary and BST: both are rooted trees. What is the main

difference between level-filled binary and BST?

b) We have discussed two data structures heap and BST. They have similarities and

differences. List two similarities and two differences between BST and heap

c) Give a situation where BST can be fully unbalanced

0 0
Add a comment Improve this question Transcribed image text
Answer #1

a)Main difference between the two is filling of data inside these two trees i.e in BST the data is ordered(left sub-tree contains nodes with data lesser in value of root node and right sub-tree contains nodes with data greater in value than value of root node).As in case of level filled data is filled irrespective of these constraints.Also in BST, left and right sub-tree are also BST in nature.

b)

i)Similarities Between Heap And BST:

1.Both follows a certain pattern.

2.For a special case(pattern of left to right increasing node value) heap is BST only.

3.Both are of good use for searching algorithms.

i)Difference Between Heap And BST:

1.Heap Guarantees that the elements on higher level are greater and on the lower level are smaller, While BST does the same while going from left to right.

2.heap is best for finding min/max (O(1)),whereas BST is good for all searches(O(log(n))).

c) Max Heap and Min Heap can act as A fully unbalanced BST because in both cases the value differs from top to bottom whereas in BST the value differs from left to right.the time to convert both of them to BST is huge and works as Fully unbalanced BST.

Add a comment
Know the answer?
Add Answer to:
a) We have discussed level-filled binary and BST: both are rooted trees. What is the main...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • A. What are some of the key aspects of each of the levels of awareness we discussed in class-be s...

    A. What are some of the key aspects of each of the levels of awareness we discussed in class-be specific as to what occurs within each of the levels of awareness Be as specific as possible noting what occurs in each of these levels; one or two lines is not sufficient. 1. Higher Level 2 Lower Level 3 Subconscious Level 5. Altered States of Consciousness OR B Both Pavlov's and Skinner's theories of learning f differences in how each explains...

  • PLEASE ANSWER BOTH. 1. We have discussed in detail numerous cases of microstrucure development from binary...

    PLEASE ANSWER BOTH. 1. We have discussed in detail numerous cases of microstrucure development from binary phase diagrams. For all these diagrams make sure you understand: (a) The overall system composition (b) The composition of the individual phases in equilibrium (tie-line and x-axis label) (c) The relative amounts of the phases in equilibrium (lever rule) (d) The microstructure development on slow cooling 2. Draw a typical pressure-temperature phase diagram for a one-component system. (a) Identify the component’s melting point and...

  • In class, we discussed the priority queue (PQ) ADT implemented using min-heap. In a min-heap, the...

    In class, we discussed the priority queue (PQ) ADT implemented using min-heap. In a min-heap, the element of the heap with the smallest key is the root of the binary tree. On the other hand, a max-heap has as root the element with the biggest key, and the relationship between the keys of a node and its parent is reversed of that of a min-heap. We also discussed an array-based implementation of heaps. In this assignment, your task is to...

  • Can someone please help me with the following: Implement a Binary Search Tree that can be...

    Can someone please help me with the following: Implement a Binary Search Tree that can be used to store data values that are strings. The data values will be stored in nodes in a binary search tree. Each node will have a unique integer key. Provide functions to add, get and remove elements to/from the tree. Also provide functions to print the elements (both the key and the data values) in forward (dump) and reverse (dump_rev) order. To help in...

  • Interfaces 1. What is inside an interface definition? What does a class do to an interface...

    Interfaces 1. What is inside an interface definition? What does a class do to an interface and what keyword is involved? How does a class do this to an interface (what should we find in the class)? Can an interface have a generic parameter? How do you instantiate an interface as an object? What methods can’t you use on an interface type? Abstract Data Types 2. What does an ADT define? Does an ADT specify programming language and/or data structures...

  • SHORT ANSWER QUESTIONS Part 1 Classes Abstraction: What is Abstraction in terms of representation? Specifically what...

    SHORT ANSWER QUESTIONS Part 1 Classes Abstraction: What is Abstraction in terms of representation? Specifically what choices does one make when creating a class that is an example of Abstraction? Encapsulation: What is encapsulation? What is information hiding? What does a public interface to a class consist of (not in the sense of actual java interfaces but what the client uses to manipulate objects of the class) What is an object of a class? What is the constructor? How do...

  • Recursion and Trees Application – Building a Word Index Make sure you have read and understood...

    Recursion and Trees Application – Building a Word Index Make sure you have read and understood ·         lesson modules week 10 and 11 ·         chapters 9 and 10 of our text ·         module - Lab Homework Requirements before submitting this assignment. Hand in only one program, please. Background: In many applications, the composition of a collection of data items changes over time. Not only are new data items added and existing ones removed, but data items may be duplicated. A list data structure...

  • Since we do not want to have to rewrite this code when the element type changes,...

    Since we do not want to have to rewrite this code when the element type changes, this classes uses a Comparator to assist in ordering the elements. You will need to complete the siftUpComparator() and siftDownComparator() methods in the LinkedHeap Class. siftUp §Added element may violate heap-order property §siftUp() restores order starting at added node §Processing will continue working up the tree until: úFinds properly ordered node & parent úReaches the root (reaches node without parent) siftDown §Restores heap’s order...

  • I need help in C++ implementing binary search tree. I have the .h file for the...

    I need help in C++ implementing binary search tree. I have the .h file for the binary search tree class. I have 4 classic texts, and 2 different dictionaries. Classic Texts: Alice In Wonderland.txt A Tale of Two Cities.txt Pride And Prejudice.txt War and Peace.txt 2 different dictionaries: Dictionary.txt Dictionary-brit.txt The data structures from the standard template library can not be used.The main program should open the text file, read in the words, remove the punctuation and change all the...

  • SCREENSHOTS OF CODE ONLY!! PLEASE DON'T POST TEXT!! C++ CODE! PLEASE DON'T REPOST OLD POSTS! Objective...

    SCREENSHOTS OF CODE ONLY!! PLEASE DON'T POST TEXT!! C++ CODE! PLEASE DON'T REPOST OLD POSTS! Objective To gain experience with the operations involving binary search trees. This data structure as linked list uses dynamic memory allocation to grow as the size of the data set grows. Unlike linked lists, a binary search tree is very fast to insert, delete and search. Project Description When an author produce an index for his or her book, the first step in this process...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT