We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- C
- Functions
- Sorting Array of Strings
- Discussions
Sorting Array of Strings
Sorting Array of Strings
Sort by
recency
|
221 Discussions
|
Please Login in order to post a comment
I've compared my output with the expected output with over 8 of the failed tests to find my output is identical. I am using my own implementation of quicksort and not the inbuilt qsort.
Anyone having the same issue?
Just for reference, I am checking this by copying the output of my program in clion and saving it into a file, then doing the same with the given expected result on hackerrank and comparing the two files with diff.
I spent a ton of time debugging the wrong function because the comparator functions weren't called in the order in the problem statement.
int lexicographic_sort(const char* a, const char* b) { int i=0, j=0, k=0, l=0; i = strlen(a); j = strlen(b); int len;
return 0; }
int lexicographic_sort_reverse(const char* a, const char* b) { int i=0, j=0, k=0, l=0; i = strlen(a); j = strlen(b); int len; if(j
return 1;
}
int sort_by_number_of_distinct_characters(const char* a, const char* b) { int i=0, j=0, k=0, l=0; i = strlen(a); j = strlen(b); for(int y='a'; y<='z'; y++){ for(int x=0; x } }
}
int sort_by_length(const char* a, const char* b) { int i=0, j=0; i = strlen(a); j = strlen(b); if (i>j){ return 1;} if (i
}
void swap_arr(char** x, char** y){ char *temp = *x; *x = *y; *y = temp; }
void string_sort(char** arr,const int len,int (cmp_func)(const char a, const char* b)){ char *buff;
}
without using any c stdlibrary