I remember this question under discussion recently. Please check the
existing threads...
On 6/17/10, debajyotisarma sarma.debajy...@gmail.com wrote:
Find the longest palindrome in the given string.
Minimum time-space complexity required
(i have not solved it so don't know what is min)
--
Thanks Sharad
On Wed, Jun 9, 2010 at 10:01 PM, sharad kumar sharad20073...@gmail.comwrote:
1
/\
2 3
/ \/
Check whether the first element in the array is greater than the last
element in the array. If it is true, it means the array is rotated after
sorting.
Now, take the middle element of the array and check whether it is greater
than the last element of the array. If true, it means the first half of
I dont think so
This approach is better than O(nlogn)
On Tue, Jun 8, 2010 at 9:10 AM, harit agarwal agarwalha...@gmail.comwrote:
@vadivel selvaraj
your approach is O(nlogn)
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to
@Shobhit
@Rohit
Is it done it linear time?? I dont think so...
On Sat, Jun 5, 2010 at 9:33 AM, Rohit Saraf rohit.kumar.sa...@gmail.comwrote:
Tokenize the string and print it reverse!
--
--
Rohit Saraf
Second Year Undergraduate,
Dept. of
Rohit, you are very well awake
On Sat, Jun 5, 2010 at 9:49 AM, Rohit Saraf rohit.kumar.sa...@gmail.comwrote:
Have you posted the same question twice or i am feeling sleepy?
--
--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer
Follow hare and tortoise algorithm.
For even length,
once the traversal through out the string is done, move the fast
pointer to slow pointer +1 location and start iterating for (length/2)
times with 2 indices. One indice increasing for fast pointer and the
other for slow pointer. Keep checking
Apologies.
I thought the question was about just checking for palindrome.
On 6/6/10, Antony Vincent Pandian.S. sant...@gmail.com wrote:
Follow hare and tortoise algorithm.
For even length,
once the traversal through out the string is done, move the fast
pointer to slow pointer +1 location
I think kaushik's solution of inorder traversal with hare and tortoise
technique should do the trick.
On Fri, May 21, 2010 at 3:48 PM, Koolvord Starbust kolvo...@gmail.comwrote:
Sorry, but.. why don't you..
a) compute the height of each subtree. Recusrively, takes O(n).
b) start from the
,
To add to your logic, I hope we must also be checking at the precedence of
the first operator that appears after the closing parenthesis ')' before we
can decided if the parenthesis can be removed or not .
On Thu, Jun 3, 2010 at 11:37 PM, Antony Vincent Pandian.S.
sant...@gmail.com wrote
If the base logic follows the below rule, it should work.
If any operator within parenthesis is of less precedence to the
operator before the opening parenthesis, the parenthesis can not be
removed.
For cases of equal precedence of operators before parenthesis and
within parenthesis,
Consider two linked lists l1 and l2. Create 2 hash maps,h1 and h2, one
for each list with the format, element, number of occurrence.
Traverse one element in each list at a time. For each element in list
l1, check whether it is present in h2. If yes, remove the element from
h2 if the number of
@Raj
What do you mean by identical? You are just concerned about the
presence of one element in another LL or you are concerned about the
equality of number of elements too?
On 6/2/10, Raj N rajn...@gmail.com wrote:
@sharad kumar: But don't you think this'll consume a lot of space. Merge
sort
But you cant actually say that this is the size of the object from calling
freememory before and after object creation..
On Wed, Nov 25, 2009 at 5:15 PM, Phani Kumar gsphaniku...@gmail.com wrote:
java.lang.Runtime class has a method* freeMemory
Do a binary search
On Sun, Oct 25, 2009 at 12:13 AM, naren lalavat38na...@gmail.com wrote:
You have a sorted array of n elements some of them occur more than
once. How can we find the index of an element in time t which is less
than O(n).
--
Luv,
S.Antony Vincent Pandian
15 matches
Mail list logo