Question

1) For the list shown below, illustrate each of following sorts as shown in the slide(s)...

1) For the list shown below, illustrate each of following sorts as shown in the slide(s) listed: 68, 12, 46, 23, 97, 38, 76, 64 :

a) Insertion sort :

b) Shell sort with sequence 5,3,1

c) Merge sort

e) Radix sort

Note: continue each until the final list is sorted!

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

(a) Insertion sort:

  • It is a simple sorting algorithm that builds the final sorted array one item at a time.
  • It is less efficient than heap sort, merge sort and quick sort.
  • It is based on the idea that one element from the input elements is consumed in each iteration to find its correct position.

Finally the sorted array is 12,23,38,46,64,68,76,97

(b) Shell sort:

  • The shell sort is also called diminishing increment sort.
  • It improves on the insertion sort by breaking the original list into number of smaller sub lists.
  • By sorting the sub lists we have moved the items closer to where they actually belong.
  • We should calculate the gap value recursively until we get the value of gap as '1'.
  • The method starts by sorting elements far apart from each other and progressively reducing the gap between them.

Finally we have sorted the array.

(c) Merge sort:

  • It is a sorting technique based on divide and conquer technique.
  • It first divides the array into equal halves and then combine them in sorted manner.

(e) Radix sort:

  • Radix sort is an integer sorting algorithm.
  • It uses radix or digit as a key.
  • It implements counting sort to do the work of sorting.

Add a comment
Know the answer?
Add Answer to:
1) For the list shown below, illustrate each of following sorts as shown in the slide(s)...
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
  • Written in Java Your job is to produce a program that sorts a list of numbers...

    Written in Java Your job is to produce a program that sorts a list of numbers in ascending order. Your program will need to read-in, from a file, a list of integers – at which point you should allow the user an option to choose to sort the numbers in ascending order via one of the three Sorting algorithms that we have explored. Your program should use the concept of Polymorphism to provide this sorting feature. As output, you will...

  • Puodace a char showing the number of moves required to solve the Towers of Hanoi puzle using t 30...

    Puodace a char showing the number of moves required to solve the Towers of Hanoi puzle using t 30. What is an execution frame? What is an activation record? What is contained in it? 31. Write a recursive Java method that computes the factorial of a number 2. Linear search may require up to comparisons while binary search will only require roughly comparisons 33. Sort sorts a list of values by repetitively putting a particular value into its final, sorted,...

  • Modify the sorts (selection sort, insertion sort, bubble sort, quick sort, and merge sort) by adding code to each to tally the total number of comparisons and total execution time of each algorithm. E...

    Modify the sorts (selection sort, insertion sort, bubble sort, quick sort, and merge sort) by adding code to each to tally the total number of comparisons and total execution time of each algorithm. Execute the sort algorithms against the same list, recording information for the total number of comparisons and total execution time for each algorithm. Try several different lists, including at least one that is already in sorted order. ---------------------------------------------------------------------------------------------------------------- /** * Sorting demonstrates sorting and searching on an...

  • Alfa The first column in the table below contains an unsorted list of words. The last...

    Alfa The first column in the table below contains an unsorted list of words. The last column contains a sorted list of words. Each intermediate column contains a partially sorted list. Each intermediate column was constructed by beginning with the unsorted list at the left and running one of the sorting algorithms that we learned about in class, stopping at some point before it finishes. Each algorithm is executed exactly as described in the lecture notes. (One column has been...

  • Complete function long_list_printer.print_list(). When it's finished, it should be able to print this list, a =...

    Complete function long_list_printer.print_list(). When it's finished, it should be able to print this list, a = [ [93, 80, 99, 72, 86, 84, 85, 41, 69, 31], [15, 37, 58, 59, 98, 40, 63, 84, 87, 15], [48, 50, 43, 68, 69, 43, 46, 83, 11, 50], [52, 49, 87, 77, 39, 21, 84, 13, 27, 82], [64, 49, 12, 42, 24, 54, 43, 69, 62, 44], [54, 90, 67, 43, 72, 17, 22, 83, 28, 68], [18, 12, 10,...

  • Consider the below matrixA, which you can copy and paste directly into Matlab.

    Problem #1: Consider the below matrix A, which you can copy and paste directly into Matlab. The matrix contains 3 columns. The first column consists of Test #1 marks, the second column is Test # 2 marks, and the third column is final exam marks for a large linear algebra course. Each row represents a particular student.A = [36 45 75 81 59 73 77 73 73 65 72 78 65 55 83 73 57 78 84 31 60 83...

  • Assignment 6, Merge Arrays (java) Instructions In this assignment, you will write a program which merges...

    Assignment 6, Merge Arrays (java) Instructions In this assignment, you will write a program which merges two arrays of positive integers and removes any duplicate entries. Your program will first ask for a valid length which must be an integer which is 10 or greater. The program should continue to ask until a valid length is entered. The program will then create two arrays of the length entered, fill these with random integers between 1 and 100 inclusive, and print...

  • For each variable of interest, do the following: 1. Find the mean, five-number summary, range, variance,...

    For each variable of interest, do the following: 1. Find the mean, five-number summary, range, variance, and standard deviation. Display these numbers in a format that is easy to understand. 2. For each variable of interest, use its five-number summary to construct a boxplot. Each boxplot must be constructed horizontally, and must be accompanied by a brief descriptive paragraph that assesses whether the data appear to be symmetrical, left-skewed, or right-skewed. Construct a 95% confidence interval for the mean μ...

  • 7. (a) (15 pts.) With Figure 1 below showing shifts A and B, fill in the blank Table 1 showing the computation of the...

    7. (a) (15 pts.) With Figure 1 below showing shifts A and B, fill in the blank Table 1 showing the computation of the fraction of Bin Hours in each shift for the different time groups. VI V IV Group 1 A 9-12 13-16 17-20 21-24 Sunday Monday Tuesday Wednesday B B Thursday Friday Saturday Figure 1 Table 1 Computation of Fraction of Bin Hours in Each Shift Days Total in Shift A Fraction in Each Shift B Fraction in...

  • In JAVA please The "Emoji_List.txt" file contains a list of emojis that were introduced in 2017....

    In JAVA please The "Emoji_List.txt" file contains a list of emojis that were introduced in 2017. Create a class that acts as a placeholder for the individual entries (number and identifier string). Implement a doubly-linked generic List from scratch that will hold the instances of emojis. Implement a selection sort for the implemented list that sorts the read-in items alphabetically. (Hint: look at compareTo for Strings) Print the sorted list and paste the result at the bottom of your submitted...

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