Menu

(Solved) : 1 Modify J 5 0 Length 1 Odd 1 1 1 1 Else J J Endif Endfor Endalg Q26162840 . . .

솔 moodle.griffith..e a Given an Array BI] consisting of N elements, use pseudocode to describe how Bubble Sort would be performed. (8 marks) b) The table below displays an array of animal types being sorted. Column A = the starting Array, Column G shows the final, sorted, order. The columns in between show different sorting algorithms (listed below) at different stages of the sorting process. Identify which sorting algorithm produced which: A: Start B End vark le cat vark horse Cit at ark horse lephant horse le dvark cat ctopus Octopus le Squid le Octopus Squid TO Algorithm list: HeapSort(Max) BubbleSort, MergeSort, InsertionSort, SelectionSort, (10 marks) e) The Pseudocode in Appendix A.1 will fail if run as is. Correct edit) and apply the function to the the issue (requires following Array: 11 142721 22 196 Write out the final Array values when the algorithm has completed (7 marks) Total (25 marks)

A.1.

Modify(A)

J ß5

           For i=0 , i=A.length-1 , i++

                       IF A[i] = odd

                       A[i] ß A[i]+A[i+1]

                       A[i+1] ß A[i] –A[i+1]

                       A[i] ß A[i+1] – A[i]

                       Else

                       A[i] ß A[i]+J

                       J++

                       EndIF

           EndFor

EndAlg

솔 moodle.griffith..e a Given an Array BI] consisting of N elements, use pseudocode to describe how Bubble Sort would be performed. (8 marks) b) The table below displays an array of animal types being sorted. Column A = the starting Array, Column G shows the final, sorted, order. The columns in between show different sorting algorithms (listed below) at different stages of the sorting process. Identify which sorting algorithm produced which: A: Start B End vark le cat vark horse Cit at ark horse lephant horse le dvark cat ctopus Octopus le Squid le Octopus Squid TO Algorithm list: HeapSort(Max) BubbleSort, MergeSort, InsertionSort, SelectionSort, (10 marks) e) The Pseudocode in Appendix A.1 will fail if run as is. Correct edit) and apply the function to the the issue (requires following Array: 11 142721 22 196 Write out the final Array values when the algorithm has completed (7 marks) Total (25 marks) Show transcribed image text

Expert Answer


Answer to 1 Modify J 5 0 Length 1 Odd 1 1 1 1 Else J J Endif Endfor Endalg Q26162840 . . .

OR