Question

Consider the following three sorting algorithms: MergeSort (as studied), TreeSort (as described in Q14, and HeapSort described here: (1) iterate over a vector of values and insert next values one by one into a min-heap; then (2) repeat taking the top of the heap and re- inserting it into the next vector position (starting at index 0 and counting up), followed by popping the heap; once the heap is empty, the vector is sorted in ascending order. Complete each with a brief phrase or sentence completion (2 pts): (a) TreeSort and HeapSort are similar in that (b) HeapSort and MergeSort are similar to each other and differ from TreeSort in that

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

A)They both uses tree data structure to sort the data value.TreeSort creates a Binary Search tree from the value given and performs an inorder traversal to generate value in sorted format , Whereas Heap Sort creates a heap data structure(minheap or maxheap ,basically it is a binary tree with some other properties) and uses it for sorting the data.

B)HeapSort and MergeSort both have the worst case time complexity as O(n log n) whereas TreeSort has Worst Case Time Complexity as O( n2  ) .

Add a comment
Know the answer?
Add Answer to:
Consider the following three sorting algorithms: MergeSort (as studied), TreeSort (as described in Q14, and HeapSort...
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
  • Objective: in Java Write a program that implements 3 sorting algorithms and times them in real ti...

    Objective: in Java Write a program that implements 3 sorting algorithms and times them in real time. These algorithms will sort Cylinders by their volume. First, download the driver and include it in your project. Write a class Cylinder with the following properties baseRadius: a non-negative number that corresponds to the Cylinder’s base’s radius. height: a non-negative number that corresponds to the Cylinder’s height. Next, write a class Sorter with the following bubbleSort: This static method takes in an array...

  • I need the report like this (idea) *Sorting Algorithms: A sorting algorithm is an algorithm that...

    I need the report like this (idea) *Sorting Algorithms: A sorting algorithm is an algorithm that puts elements of a list in a certain order. The most-used orders are numerical order and lexicographical order. Efficient sorting is important for optimizing the use of other algorithms (such as search and merge algorithms) which require input data to be in sorted lists; it is also often useful for canonical zing data and for producing human-readable output. More formally, the output must satisfy...

  • A test harness program for testing sorting methods is provided with the rest of the textbook...

    A test harness program for testing sorting methods is provided with the rest of the textbook program files. It is the file Sorts.java in the ch11 package. The program includes a swap method that is used by all the sorting methods to swap array elements. Describe an approach to modifying the program so that after calling a sorting method the program prints out the number of swaps needed by the sorting method. Implement your approach. Test your new program by...

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