GeeksforGeeks » C/C++ Programming Questions

Finding all possible substring of a given string,sorted in lexicographical order

(2 posts)
  • Started 8 months ago by Prateek Kumar Verma
  • Latest reply from kartik

Tags:

  1. Prateek Kumar Verma
    guest
    Posted 8 months ago #

    You have given a string. WAP to find all substrings sorted in lexicographical order in efficient way

  2. kartik
    Moderator
    Posted 8 months ago #

    1) Scan the string and store all different different characters in an array. Let the array be ch[].
    2) Sort the array ch[].
    3) For every character c from left to right in sorted ch[].
    .......a) Search for the character c in input string and print all substrings starting from c.


Reply

You must log in to post.

RSS feed for this topic