We can apply count sort here also and take the range of numbers as 256 . Example take an array c[256] , where c[i] gives the number of times i_th ASCII value is repeated . Then after you have obtained c[256] . Check for maximum 5 nos. in this array (which can be done in O(n) time and space).
-- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@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.