Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

6. Merge Bubble Sort: a) How does the merge bubble sort break the array into sub

ID: 3745672 • Letter: 6

Question

6. Merge Bubble Sort: a) How does the merge bubble sort break the array into sublists? b) What does it need to use for each sublist and then what does it do with all of the sublists? c) What is the Big-O notation for this sort? 7. Merge Sort: a) How does the merge sort use recursion to break the array into sublists? b) What happens to each of these sublists to get the final sorted list? c) What is the best and worst case Big-O notation for this sort? 8. External File Sort: a) Why are three files used to implement this sort and how is each used? b) What is its major advantage and its major disadvantage over internal sorts? 9. Quick Sort: a) How do you select the pivot value and how is it used to create two sublists? b) When every sublist of 1 or 2 elements is sorted, what assertion ensures that the entire array must be sorted? c) What is the best and worst case Big-O notation for this sort? d) What are the kinds of lists for which it is best? 10. Heap Sort: a) How is the initial array of data values conceptually represented? b) what are the two subscripts that are used to access the two children of node #X? c) What is the definition of a heap? d) Explain the basic process of filtering," "swapping," and "freezing" to get each element of the array in its final location.

Explanation / Answer

Answer)

Q8) Why are 3 files used to implement the external sort and how is each used?

External sorting using the merge sort is done to handle a mass amount of data. This is done when the data from the huge file does not fit into the memory or RAM and thus resides in the secondary storage. Here, in external sort chunks of the data which is small enough is fitted into the main memory to read, sort and then a temporary file is generated. After this, for the merge, the sorted sub-files are combined into one single larger file. As merge sort uses the 2-way split where the files are split into 2 files from a larger file to be sorted and merged back up as the sorted file. Thus the 3 files approach is here, where one is the input file, one is to store the creation of sub-files or files being split and also another is the final output and sorted file.

b) What is advantage and disadvantage over internal sorts?

External sorting is advantageous over integral sorts when the size of the file is greater than what the memory's capacity to take it in is. Thus, external sorting proves handy when data can't fit into memory entirely. The disadvantage is that, like internal sorting in external sort, you cannot access any element of data in the array or file at any time as data is loaded in small chunks, and also the data loading and unloading is slow as secondary disk is involved.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote