I remember this question under discussion recently. Please check the
existing threads...
On 6/17/10, debajyotisarma 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)
>
> --
> You received this mess
hi all,
It has been under my notice that questions has been repeated again and again
in the forum.I would request the members to kindly search for the answers in
forum rather than reposting the same question...Cos if we search the forum
we can knw till what the discussion had been carried out .and
@arun:find out the difference x-arr[i] for all i=0..n hash it ...next
search for a number with difference .u can get it in O(n)
On Fri, Jun 18, 2010 at 8:05 AM, Arunkumar Sreenivasan <
thegame.a...@gmail.com> wrote:
> Hi,
>You are given a set of numbers and another number 'x'. You have t
Its a repeated question. I would suggest you checking the archives of this
groups for its solution.
Anurag Sharma
On Fri, Jun 18, 2010 at 8:05 AM, Arunkumar Sreenivasan <
thegame.a...@gmail.com> wrote:
> Hi,
>You are given a set of numbers and another number 'x'. You have to find
> if there
@senthilnathan
prepare a hash table for the third array
now pick any element 4m array 1 add it to 1 element of array 2 now try to
find -(m+n) in hash table
since every element of arr1 will be sum to every arr of array2 and lookup in
hash table to be O(1)
so overall complexity will be O(n2) time+O(
Here is the link which fits your need.
http://www.coders2020.com/construct-a-tree-given-its-inorder-and-preorder-traversal-strings-similarly-construct-a-tree-given-its-inorder-and-post-order
Anurag Sharma
On Thu, Jun 17, 2010 at 4:34 PM, divya wrote:
> write a code to construct tree from inord
Hi,
You are given a set of numbers and another number 'x'. You have to find
if there exists any two numbers, whose sum is equal to 'x'. I have done this
is o(n)log n. Need a more optimized solution.
regards,
Arun kumar S
--
You received this message because you are subscribed to the Google Gr
do u meand diameter of tree?? if it is so then start from the left most node
in tree and traverse upto root and traverse to the rightmost node in
tree..this u can do by having extra field in tree which is parent
pointer
On Fri, Jun 18, 2010 at 4:25 AM, Anand wrote:
> Any guys suggest any alg
@sharad
Can you explain the O(n*n) + O(n) space algorithm that you
mentioned?
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send emai
write a code to construct tree from inorder nd preorder traversal..
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsu
if you can access parent in your tree find the path from the nodes to the
root
then process the two lists from their end and find the last equivalent node
in lists and thats the lowest common ancestor
the running time is O(height of tree) which is the max length of the two
lists
On Thu, Jun 17, 20
when we get a different bit from the previous one, four condition arises
defining position of the bit :
consider this bit form : 1001 (from left, 1 is at odd position, then 0
at even, then next 0 at odd, and so on)
now four conditions are(except for 1st bit because it has no previous bit) :
@Chinna
http://www.topcoder.com/tc?module=Static&d1=tutorials&d2=alg_index
Mohit
On Thu, Jun 17, 2010 at 9:03 PM, chinna wrote:
> plz can u provide material -reg:design and analysis of algorithms.
> basics of algorithms and psudocode notation,time and space
> complexity's ..etc
> thank u
>
>
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)
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegrou
I think that we need to go by dynamic programming.
Ex: 1,3,7,4,9 T=23
Sort: 1,3,4,7,9
subtract max value from T(23-9=14 )
find Best Solution for (14) --> sub (14-9 = 5), Search for 5.(5-4 = 1) So
Answer would be: 9,9,4,1
Search can be binary search as the array is already sorted.
At every step best
Hi Anand, your dedicated and neatly formated reply is much appreciated! :)
On 16 June 2010 23:59, divya jain wrote:
> yes u need to start frm beg..
>
>
>
> On 16 June 2010 17:15, Vivek Sundararajan wrote:
>
>> so, this means that i can traverse the list only from the beginning of the
>> link l
take root as the start node and do a DFS traversal on this tree. This
can be done in linear time. DFS traversal will give [entry time, exit
time] for each node. Now do an inorder traversal of the tree to find
the first node such that the entry & exit time of both the input nodes
(whose ancestor we
1. a mad user tries to allocate 1 gb memory using calloc.
but the program fails after allocationg about 800mg(appx. i dont
remember). Tell me what could have gone wrong?
2.
We know disabling interrupts works only if it is single processor(i.e
local disabling of interrupts).
Consider this case whe
@Anand: Thank you :)
On 17 June 2010 16:14, Vivek Sundararajan wrote:
> Hi Anand, your dedicated and neatly formated reply is much appreciated! :)
>
>
> On 16 June 2010 23:59, divya jain wrote:
>
>> yes u need to start frm beg..
>>
>>
>>
>> On 16 June 2010 17:15, Vivek Sundararajan wrote:
>>
>>
"Give an O(n) algorithm to sort the
items by color (all reds before all blues before all yellows) such
that the numbers
for identical colors stay sorted."
A[]={3B,1R,4Y,2R,5B,7Y}
Ans={1R,2R,3B,7B,4Y,7Y}
--
You received this message because you are subscribed to the Google Groups
"Algorithm Gee
http://www.topcoder.com/tc?module=Static&d1=tutorials&d2=lowestCommonAncestor
The above link gives a detailed explanation about LCA and RMQ
On 17 June 2010 15:30, jalaj jaiswal wrote:
> write an algo which gives the lowest common ancestor of two nodes in a
> general tree(not binary specifically
i am not getting what to do when we get a different bit from the
previous one someone please explain
On Mon, Jun 14, 2010 at 9:14 AM, Anurag Sharma wrote:
> Use iterative version :http://en.wikipedia.org/wiki/Tower_of_Hanoi
>
> Anurag Sharma
>
> On Mon, Jun 14, 2010 at 12:36 AM, ANUJ KUMAR
> wr
http://www.amazon.com/Introduction-Algorithms-Second-Thomas-Cormen/dp/0262032937
On Thu, Jun 17, 2010 at 9:03 PM, chinna wrote:
> plz can u provide material -reg:design and analysis of algorithms.
> basics of algorithms and psudocode notation,time and space
> complexity's ..etc
> thank u
>
> --
A collection of links:
http://geeksforgeeks.org/?page_id=6028&cat=Data+Structures+%26+Algorithms
On Thu, Jun 17, 2010 at 8:33 AM, chinna wrote:
> plz can u provide material -reg:design and analysis of algorithms.
> basics of algorithms and psudocode notation,time and space
> complexity's ..etc
>
please post the solution to
http://www.spoj.pl/problems/HAN01/
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr.
Any guys suggest any algo on how to find the width of the tree.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr
@Jitendra: Could not understand in which peg the plates should be. Can you
please let us know
On Tue, Jun 15, 2010 at 9:12 AM, Jitendra Kushwaha wrote:
> Dear Anuj,
>
> Its easy to do.
> lets take an example
> say we have 4 disks. We will require 2^4-1 = 15 steps to solve it.
> Now suppose we ar
( WE APOLOGIZE IF YOU RECEIVE MULTIPLE COPIES OF THIS MESSAGE )
=
Journal of Emerging Trends in Computing and Information Sciences
Call for Research Papers
http://cisjournal.org/
ISSN: 2079-8407
===
plz can u provide material -reg:design and analysis of algorithms.
basics of algorithms and psudocode notation,time and space
complexity's ..etc
thank u
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algo
Yes right, i forgot the "1"
--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and Engineering
IIT Bombay
http://www.cse.iitb.ac.in/~rohitfeb14
On Thu, Jun 17, 2010 at 6:05 PM, Dave wrote:
> No. The greedy algorithm also works on
No. The greedy algorithm also works on the U.S. coinage system, where
the coins are 1, 5, 10, 25. Again, the rule is that there must be a 1
unit coin, and each coin has at least twice the value of the
preceeding one.
Dave
On Jun 16, 11:34 pm, Rohit Saraf wrote:
> @Dave: The greedy will only work
write an algo which gives the lowest common ancestor of two nodes in a
general tree(not binary specifically)
--
With Regards,
Jalaj Jaiswal
+919026283397
B.TECH IT
IIIT ALLAHABAD
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to th
plzzz dont post ur homework questions here
look them on google
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr.
33 matches
Mail list logo