@Rizwan: I don't see the problem. Initialize an array of counters, one for each possible last character, to zero. If there are no restrictions on the last character, use an array of 256 counters. Then, for each string, increment the counter corresponding to the last character of the string by the length of the string (or 1 + the length of the string if you want to store the null byte). After all of the strings are processed, compute the running sum of the counters to get the position in the output array of the first entry for each last character. Then copy the strings into the output array at the position indicated by the appropriate counter, and increment that counter by the number of characters copied.
Why doesn't this work? And isn't it a counting sort? Dave On Jun 29, 7:05 pm, rizwan hudda <rizwanhu...@gmail.com> wrote: > @Dave: Think of it again counting sort won't work, If you are just > considering the last character as > the even though key is just last character, the value is the whole string.. > > > > > > On Tue, Jun 28, 2011 at 1:53 PM, juver++ <avpostni...@gmail.com> wrote: > > List[letter] - linked list of all words with the last character as letter. > > Then iterate over all letters and concatenate lists. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Algorithm Geeks" group. > > To view this discussion on the web visit > >https://groups.google.com/d/msg/algogeeks/-/vK4GhYEHHbUJ. > > > To post to this group, send email to algogeeks@googlegroups.com. > > To unsubscribe from this group, send email to > > algogeeks+unsubscr...@googlegroups.com. > > For more options, visit this group at > >http://groups.google.com/group/algogeeks?hl=en. > > -- > Thanks and regards > Rizwan A Huddahttp://sites.google.com/site/rizwanhudda2- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.