Re: [algogeeks] palindrome substring

2010-06-17 Thread Antony Vincent Pandian.S.
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

[algogeeks] regarding questions being repeated

2010-06-17 Thread sharad kumar
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

Re: [algogeeks]Numbers search in an array

2010-06-17 Thread sharad kumar
@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

Re: [algogeeks]Numbers search in an array

2010-06-17 Thread Anurag Sharma
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

Re: [algogeeks] sum to 0

2010-06-17 Thread sharad kumar
@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(

Re: [algogeeks] binary tree

2010-06-17 Thread Anurag Sharma
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

[algogeeks]Numbers search in an array

2010-06-17 Thread Arunkumar Sreenivasan
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

Re: [algogeeks] Width of the tree

2010-06-17 Thread sharad kumar
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

Re: [algogeeks] sum to 0

2010-06-17 Thread Senthilnathan Maadasamy
@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

[algogeeks] binary tree

2010-06-17 Thread divya
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

Re: [algogeeks] lowest common ancestor

2010-06-17 Thread Amir hossein Shahriari
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

Re: [algogeeks] towers of hanoi O(1) time

2010-06-17 Thread Jitendra Kushwaha
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) :

Re: [algogeeks] request

2010-06-17 Thread mohit ranjan
@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 > >

[algogeeks] palindrome substring

2010-06-17 Thread debajyotisarma
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

Re: [algogeeks] Re: coins

2010-06-17 Thread Chakravarthi Muppalla
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

Re: [algogeeks] doubly linked list

2010-06-17 Thread Vivek Sundararajan
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

[algogeeks] Re: lowest common ancestor

2010-06-17 Thread aejeet
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

[algogeeks] OS problems

2010-06-17 Thread amit
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

Re: [algogeeks] doubly linked list

2010-06-17 Thread Vivek Sundararajan
@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: >> >>

[algogeeks] Variant Of Dutch National Flag Problem

2010-06-17 Thread amit
"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

Re: [algogeeks] lowest common ancestor

2010-06-17 Thread Vivek Sundararajan
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

Re: [algogeeks] Towers of hanoi

2010-06-17 Thread ANUJ KUMAR
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

Re: [algogeeks] request

2010-06-17 Thread Sudarshan Reddy M
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 > > --

Re: [algogeeks] request

2010-06-17 Thread Dheeraj Jain
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 >

[algogeeks] towers of hanoi

2010-06-17 Thread ANUJ KUMAR
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.

[algogeeks] Width of the tree

2010-06-17 Thread Anand
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

Re: [algogeeks] towers of hanoi O(1) time

2010-06-17 Thread Anand
@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

[algogeeks] Call for Research Papers

2010-06-17 Thread saadi
( 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 ===

[algogeeks] request

2010-06-17 Thread chinna
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

Re: [algogeeks] Re: coins

2010-06-17 Thread Rohit Saraf
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

[algogeeks] Re: coins

2010-06-17 Thread Dave
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

[algogeeks] lowest common ancestor

2010-06-17 Thread jalaj jaiswal
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

Re: [algogeeks] file opening mode

2010-06-17 Thread sharad kumar
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.