Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a function called bubble_sort() that accepts an array of pointers to strin

ID: 3827087 • Letter: W

Question

Write a function called bubble_sort() that accepts an array of pointers to strings and the number of strings as arguments, and returns nothing. The function sorts the strings according to the following algorithm:

1.      set the marker U for the unsorted section at the end of the list (U is an integer index value)

2.      while the unsorted section has more than one element do steps 3 through 7

3.           set the current element marker C at the second element of the list (C is an integer index value)

4.       while C has not passed U do steps 5 and 6

5.                if the item at position C is less than the item to its left then

exchange these two items

6.                move C to the right one position

7.       move U left one position

8.   stop

Your implementation for this function may NOT use strcpy(). You may only exchange or swap pointers, but NOT actually make copies of the strings!

Explanation / Answer

#include void bubble_sort(long [], long); int main() { long array[100], n, c, u, swap; printf("Enter number of elements "); scanf("%ld", &n); printf("Enter %ld integers ", n); for (c = 0; c
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote