Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Convert this C Code: # void sort(char **list, int n){ # int sorted=0, i=1, j; # char *temp; # while(i < n && !sorted){ #

Convert this C Code:

# void sort(char **list, int n){ # int sorted=0, i=1, j; # char *temp; # while(i < n && !sorted){ # j=0; # sorted = 1; # while(j 0){ # temp = list[j]; # list[j] = list[j+1]; # list[j+1] = temp; # sorted = 0; # } # j++; # } # i++; # } # } # int cmp(char *str1, char *str2){ # while(*str1 && (*str1 == *str2)){ # str1++; # str2++; # } # return *str1 - *str2; # }

To assembly sort function starting with ".globl sort" that receives a pointer to an array of strings and the number of elements in the array. The function uses bubble sort to sort the array. test cases include "./prog2 sort bla blo obl abl lab bol bal lob" giving "sorted list = {abl, bal, bla, blo, bol, lab, lob, obl}"; "./prog2 sort 300 500 200 600 400 100 800 700" outputting "sorted list = {100, 200, 300, 400, 500, 600, 700, 800}", and "./prog2 sort kiwi strawberry apple orange banana peach blueberry mango" outputting "sorted list = {apple, banana, blueberry, kiwi, mango, orange, peach, strawberry}"

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

How Do I Use A Database Research Tools You Can Use

Authors: Laura La Bella

1st Edition

1622753763, 978-1622753765

More Books

Students also viewed these Databases questions