Question 18 || Hacker Rank
Sorting Array of Strings || Hacker Rank
To sort a
given cluster of strings into lexicographically expanding request or into a
request wherein the string with the least length shows up initial, an arranging
capability with a banner demonstrating the kind of examination methodology can
be composed. The weakness with doing so is changing the capability for each new
correlation technique.
A superior
execution is composing an arranging capability that acknowledges a pointer to
the capability that looks at each sets of strings. Doing this will mean just
passing a pointer to the arranging capability with each new correlation system.
Given a variety
of strings, you really want to carry out a capability which sorts the strings
as per an examination capability, i.e., you really want to execute the
capability of the function:
void string_sort(const char **arr,const int cnt, int (*cmp_func)(const char* a, const char* b)){
}
The
contentions passed to this capability are:
You additionally need to execute the accompanying four string correlation capabilities:
Input Organization
Imperatives
Yield Arrangement
Test
Information 0
4
wkue
qoi
sbv
fekls
Test
Result 0
fekls
qoi
sbv
wkue
wkue
sbv
qoi
fekls
qoi
sbv
wkue
fekls
qoi
sbv
wkue
fekls
0 Comments