# Interview question - any suggestions

Discussion in 'C Programming' started by denis_browne@hotmail.com, Mar 3, 2006.

1. ### Guest

Hi there,
I got a tough interview questions lately, and I would like to hear

An array of N chars is given
Write an efficient algorithm to find all the repeating substring with a

minimal size
of 2

f.e

ABCFABHYIFAB

sunstrings are:

"AB"
"FAB"

Any suggestions?

, Mar 3, 2006

wrote:
> Hi there,
> I got a tough interview questions lately, and I would like to hear
>
> An array of N chars is given
> Write an efficient algorithm to find all the repeating substring with a
>
> minimal size
> of 2
>
> f.e
>
> ABCFABHYIFAB
>
> sunstrings are:
>
> "AB"
> "FAB"
>
> Any suggestions?

BTW, the way you state it, this is a question for comp.programming as I
don't see any reference to C.

Vladimir S. Oka, Mar 3, 2006

3. ### Robin HaighGuest

<> wrote in message
news:...
> Hi there,
> I got a tough interview questions lately, and I would like to hear
>
> An array of N chars is given
> Write an efficient algorithm to find all the repeating substring with a
>
> minimal size
> of 2
>
> f.e
>
> ABCFABHYIFAB
>
>
> sunstrings are:
>
>
> "AB"
> "FAB"
>
>
> Any suggestions?
>

FA is repeated as well. AB is different, because there's an additional AB
besides the ones that are part of FAB. These things tend to depend a lot on
the precise problem definition: clarification needed...

--
RSH

Robin Haigh, Mar 3, 2006
4. ### Robin HaighGuest

"Robin Haigh" <> wrote in message
news:du9b7h\$auf\$...
>
> <> wrote in message
> news:...
> > Hi there,
> > I got a tough interview questions lately, and I would like to hear
> >
> > An array of N chars is given
> > Write an efficient algorithm to find all the repeating substring with a
> >
> > minimal size
> > of 2
> >
> > f.e
> >
> > ABCFABHYIFAB
> >
> >
> > sunstrings are:
> >
> >
> > "AB"
> > "FAB"
> >
> >
> > Any suggestions?
> >

>
> FA is repeated as well. AB is different, because there's an additional AB
> besides the ones that are part of FAB. These things tend to depend a lot

on
> the precise problem definition: clarification needed...

I should also have asked about self-overlapping repeats -- does AAA contain
two instances of AA?

--
RSH

>

Robin Haigh, Mar 3, 2006
5. ### Guest

Hai friend,
You can always refer to any algorithm books like Computer Algorithms by
Sara Base for any doubts regarding algorithms. I think the answer for
your question is definetly found under the topic String
Matching/Seraching.

, Mar 3, 2006

wrote:
> Hai friend,
> You can always refer to any algorithm books like Computer Algorithms by
> Sara Base for any doubts regarding algorithms. I think the answer for
> your question is definetly found under the topic String
> Matching/Seraching.

Please quote what and who you're replying to. Lurk a while in here
before posting.

Vladimir S. Oka, Mar 3, 2006
7. ### Keith ThompsonGuest

writes:
> You can always refer to any algorithm books like Computer Algorithms by
> Sara Base for any doubts regarding algorithms. I think the answer for
> your question is definetly found under the topic String
> Matching/Seraching.