@Nishant: Here are a couple of O(n) alternatives, given that there are
a limited number of "last characters" and no requirement to break ties
in any particular way:

1. A counting sort.

2. Form a linked list of entries corresponding to each last character,
and then merge these lists in collating sequence.

Dave

On Jun 27, 3:58 am, Nishant Mittal <[email protected]> wrote:
> WAP to sort an array of character strings on the basis of last
> character of each string
> eg:- {xxxc , yyya, zzzb} => {yyya , zzzb, xxxc}

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to