Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MIPS Gnome Sort # Sort a list of numbers using gnome sort. # gnomeSort(a[0..size-1]) { # i := 1 # j := 2 # while

MIPS Gnome Sort

image text in transcribed

# Sort a list of numbers using gnome sort.

# gnomeSort(a[0..size-1]) {

# i := 1

# j := 2

# while (i

# if (a[i-1] >= a[i])

# i := j

# j := j + 1

# else

# swap a[i-1] and a[i]

# i := i - 1

# if (i = 0) i := 1

# }

# -----

# Procedure must:

# display headers via provided displayHeaders() procedure

# display unsorted list via provided printList() procedure

# sort list

# display sorted list via provided printList() procedure

# -----

# HLL call: gnomeSort(array, len);

# Arguments:

# $a0 - starting address of the list

# $a1 - list length

# $a2 - data set count

# Returns:

# n/a

.globl gnomeSort

.ent gnomeSort

gnomeSort:

jr $ra

.end gnomeSort

Write a MIPS assembly language function, gnomeSort). The function should display some headers, display the unsorted numbers, sort a list of numbers into ascending order (small to large), and display the sorted numbers. The function should call a routine displayHeaders0 and printList0 which is called twice. The displayHeaders0 and printListO routines are provided. To sort the numbers, use the following Gnome sort algorithm: gnome sort (a[o..size-11) 0 j 2 while (i

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_2

Step: 3

blur-text-image_3

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

Database Processing Fundamentals Design And Implementation

Authors: David M. Kroenke

5th Edition

B000CSIH5A, 978-0023668814

More Books

Students also viewed these Databases questions

Question

2. How will the team select a leader?

Answered: 1 week ago