How to Implement Merge Sort on a Char Array

In general, how would the code look to merge sort values of a character array with the smallest value at the front of the list and the largest value at the end of the list?

For example:

1
2
3
char input[30] = "hamburger";
Mergesort(input); //this merge sorts "hamburger"
char sortedInput[30] = "abeghmrru"; //this should be the end result of merge sorting 


I've searched online, but there is nothing about character arrays getting merge sorted compared to the number of threads you can find on integer arrays getting merge sorted.
Last edited on
Exactly the same way as for integers. In fact, char is just a shorter integer
Ah, I see now. Thanks for getting me started, I just figured out the concept of how mergesort works with a char array or any array for that matter.
As long as you have a comparison operator, you can sort any objects
Topic archived. No new replies allowed.