Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions