i need to build a function sortbycount(char* str) uses "countletters" function in order to know which word has a unique number of chars
in a word.
and returns a string in which the words are sorted by ascending order of words
regardind their "countletters" value of this word.
"ababa abcd abbbbA dbBdc abbcCc"
"abcd abbcCc dbBdc ababa abbbbA"
i got to find the shortest way to do that.
my main problem is the sorting parting part.
if the first word will be 5
and the next will be 10
and the next will return 15
i will need to push the previus words to the second place and put it into the first
and i can have a million words
how can i know in advance which word to put where
here is the countletters code
- Code: Select all
typedef struct node node;
struct node * next;
int countletters(char *str);
char str="aabx bXcb bBxaDAa";
int countletters(char *str)