lse
>> {push element to stack}
>>
>> if wrong correct me
>>
>>
>>
>>
>> --- On *Sat, 21/8/10, nipun batra * wrote:
>>
>>
>> From: nipun batra
>> Subject: Re: [algogeeks] Longest Palindromic Substring
>> To: algogeeks@googleg
ck
> }
> else
> {push element to stack}
>
> if wrong correct me
>
>
>
>
> --- On *Sat, 21/8/10, nipun batra * wrote:
>
>
> From: nipun batra
> Subject: Re: [algogeeks] Longest Palindromic Substring
> To: algogeeks@googlegroups.com
> Date: Saturday,
: nipun batra
Subject: Re: [algogeeks] Longest Palindromic Substring
To: algogeeks@googlegroups.com
Date: Saturday, 21 August, 2010, 4:18 PM
An O(n^3) solution.Wanna know if it's possible to optimize without using trees.
#include#includeusing namespace std;char*
substring(char*s,int start,int f
@Nipun: The soln is correct. It is O(n^3) and no extra memory is required.
One soln I can think of is:
Find longest common substring in the given string and its reverse. It will
be a palindrome.
This will be O(n^2) but uses extra space.
On Sat, Aug 21, 2010 at 4:18 PM, nipun batra wrote:
> An O(
An O(n^3) solution.Wanna know if it's possible to optimize without using
trees.
#include
#include
using namespace std;
char* substring(char*s,int start,int finish)
{
int ctr=0;
char str[1000];
while(start<=finish)
{
str[ctr]=s[start];
I definitely meant a suffix Tree and not a trie. Apologize for that. :)
On Fri, Aug 20, 2010 at 8:47 PM, Nikhil Jindal wrote:
> @chonku
> As i understand, a trie is used when we have a lot of strings (such as a
> dictionary).
> Here we just have a single string. The resultant trie will be:
>
> a
@chonku
As i understand, a trie is used when we have a lot of strings (such as a
dictionary).
Here we just have a single string. The resultant trie will be:
a
\
b
\
c
\
l
\
e
\
v
\
e
\
l
Can we use a trie here.
Make first pass from left to right and construct the trie.
Make second pass from right to left and look for the trie branch with
maximum nodes that match the characters.
On Thu, Aug 19, 2010 at 7:46 PM, Nikhil Jindal wrote:
> Hi All,
>
> Givan a string, you have to find th
Hi All,
Givan a string, you have to find the longest palindromic substring.
For ex: Longest Palindromic substring for abclevelabc is level.
What is the most optimised solution possible?
Please access the attached hyperlink for an important electronic communications
disclaimer: http://dce.edu/we