Sort a String Alphabetically in C – Case-Sensitive and Case-Insensitive

To sort a string alphabetically in C, apply bubble sort to the character array: compare adjacent characters and swap them when the left character is greater than the right. After all passes, the characters are in ascending ASCII order — digits first, then uppercase A–Z, then lowercase a–z. For a sort that treats ‘A’ and …

C Program to sort the string, using shell sort technique.

Shell sort is a generalization of insertion sort that sorts elements far apart before sorting adjacent ones. Invented by Donald Shell in 1959, it repeatedly applies insertion sort on sublists of decreasing “gap” sizes until the gap reaches 1 — at which point one final insertion sort on the nearly-sorted array runs in near-linear time. …