Follow Me

Sorting exercises in C Programming in C

  • Sorting using insertion algorithm: Sort the elements of an array A in ascending order. Method: Every repetition of insertion sort, removes an element from the input data, inserts it into the correct position in the already sorted list until no input elements remain. Sorting is typical...
  • Placing characters in alphabetical order: Input a string and change it is that the characters are placed in alphabetical order. For example, the string "motivate" should be changed to "aeimottv"...
  • Function sorting an array of strings: Write a program that reads 10 words and stores them in an array of strings. write a function that sorts the 10 words lexicographically using the strcmp and strcpy functions. Display the sorted array....
  • Sorting an array by minimum selection: Sort the elements of an array A in ascending order. Method: Traverse the array from left to right using the index I. For each element A[I] of the array, determine the PMIN position of the (first) minimum to the right of A[I] and exchange A[I] and A[P...
  • Sorting by propagation (bubble sort): Sort the elements of an array A in ascending order. Method: Starting again each time at the beginning of the table, we carry out several times the following treatment: We propagate, by successive permutations, the largest element of the array towards...
  • Sort an array of strings: Write a program that reads 10 words and stores them in an array of strings. Sort the 10 words lexicographically using the strcmp and strcpy functions. Display the sorted array....

Back to the list of exercises