My algo for this prob:
Maintain an array A for characters from a-z which stores the index of
character encountered in the string. (initially all = -1)
iterate over all the characters in the string maintaining low and high
variables (initially both = 0) and max (initially = 0, stores length
of largest unique substring)
      If the character is not encountered before increment high,
update A.
      Else If the character has been previously seen in the string,
set low = A[character], update A[character]=this index.
     update max = maximum(max, low - high)
At the end max wil give u the length of largest unique substring.

Regards
Vaibhav Mittal
Computer Science
Netaji Subhas Institute Of Technology
Delhi.

On Jul 21, 8:39 pm, Abhi <abhi123khat...@gmail.com> wrote:
> Given a string, find the length of the largest unique substring in it..
>
> Sample Case
> Input: "abcadece"
> Output:5  (the string "bcade")

-- 
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.

Reply via email to