Using
Insertion sort
Original list is [2, 5, 4, 6, 3, 7, 8, 1]
Iteration: 1
> Insert element at position 2 which is 5 into
already sorted previous array: [2]
> List after iteration 1 is [2, 5, 4, 6, 3, 7, 8,
1]
Iteration: 2
> Insert element at position 3 which is 4 into
already sorted previous array: [2, 5]
> List after iteration 2 is [2, 4, 5, 6, 3, 7, 8,
1]
Iteration: 3
> Insert element at position 4 which is 6 into
already sorted previous array: [2, 4, 5]
> List after iteration 3 is [2, 4, 5, 6, 3, 7, 8,
1]
Iteration: 4
> Insert element at position 5 which is 3 into
already sorted previous array: [2, 4, 5, 6]
> List after iteration 4 is [2, 3, 4, 5, 6, 7, 8,
1]
Iteration: 5
> Insert element at position 6 which is 7 into
already sorted previous array: [2, 3, 4, 5, 6]
> List after iteration 5 is [2, 3, 4, 5, 6, 7, 8,
1]
Iteration: 6
> Insert element at position 7 which is 8 into
already sorted previous array: [2, 3, 4, 5, 6, 7]
> List after iteration 6 is [2, 3, 4, 5, 6, 7, 8,
1]
Iteration: 7
> Insert element at position 8 which is 1 into
already sorted previous array: [2, 3, 4, 5, 6, 7, 8]
> List after iteration 7 is [1, 2, 3, 4, 5, 6, 7,
8]
Sorted list is [1, 2, 3, 4, 5, 6, 7,
8]
Sort the sequence 3, 10, 7, 2, 11, 6, 9, 4 using Merge sort. Show the intermediate steps .
Using an insertion sort, sort the array 5, 7, 4, 9, 8, 6, 3 into ascending order. After the first swap, what will the array look like?
Please come up with an array of 9 random integers then sort the array. Show the contents of the array each time a sorting algorithm changes it while sorting the array into ascending order. The 6 sorting algorithm we are using are: 1. Selection Sort 3 points 2. Insertion Sort 3 points 3. Shell Sort 6 points 4. Bubble Sort 3 points 5. Merge Sort 10 points 6. Quick Sort 10 points It is OK to do this assignment on...
DATA STRUCTURE
1) Sort 3, 4, 5, 6,1, 9, 2, 5, 6 using insertion sort.
4. Please illustrate the process of sorting the sequence 3, 1, 4, 1, 5, 9, 2, 6 using merge sort. (2 marks)
4. Please illustrate the process of sorting the sequence 3, 1, 4, 1, 5, 9, 2, 6 using merge sort. (2 marks)
C programming Strictly -
Write a program to sort an array of
integers via arrays of pointers to those integers as shown in the
figure.
Problem 1 (68 points): Write a program to sort an array of integers via arrays of pointers to those integers as shown in the figure. The code should contain the following functions: 1)to randomly generate an array of integer numbers; 2) to allocate memory and build the arrays of pointers as shown in the figure...
You are given an input array of integers: [8, 3, 7, 1, 2, 10, 5]. (a) Build a min-heap for the input data. Draw a figure just to show the min-heap. (b) Using the min-heap built above, sort the input data in non-descending order using the heap sort algorithm.
1. Show the steps in order to sort {11,5,6,3,8,1,9,2} using Mergesort algorithm. 2. Show the element sequences of running Shellsort on the input {15,2,8,1,10,7,4,3,9,11,12,6} at the increments {7, 3, 1}, respectively. 3. Show the steps in details of sorting {15, 2, 8, 1, 10, 7, 4, 3, 9, 11, 12, 6} using quicksort with median-of-three partitioning and a cutoff 3 (if the elements are less than 3, using insertion sort).
data structure
draw:
3) Sort 3, 4, 5, 6,1, 9, 2, 5, 6, 5 ,3 using quick sort with median of three pivot, with insertion sort cutoff at 4.
Sort the same array [3, 5, 1, 4, 8, 7,9, 2] in the ascending order by applying the Merge sort algorithm. Write down the intermediate results step by step in a tree structure. (20 points)