[algogeeks] Re: BST Problem

2010-08-22 Thread R.ARAVINDH
@giri: can u post d correct answer?? -- 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...@googlegroups.com. For

[algogeeks] Re: BST Problem

2010-08-22 Thread R.ARAVINDH
@giri: thnx frnd...sorry ppl . ignore my post :( -- 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...@googlegrou

[algogeeks] Re: BST Problem

2010-08-22 Thread R.ARAVINDH
for the above post i have assumed that the two nodes whose sum is k is present in the BST... so correct me if m wrong -- 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 unsubsc

[algogeeks] Re: BST Problem

2010-08-22 Thread R.ARAVINDH
can v do like this??? findnodes(root,sum) { if(root==abs(sum-root->data)) print (the data is root->data, sum-(root->data)); else if(rootdata)) findnodes(root->right,sum-root->data) else if(root>abs(sum-root->data)) findnodes(root->left,sum-root->data) else if(root->left==NULL || root->right==NULL

[algogeeks] Re: Generate all bit strings of length n

2010-08-22 Thread R.ARAVINDH
hw abt this? start from right most bit.. if it is the right most bit and if its 0 then flip it and proceed to the prev. bit else flip the rightmost zero to 1 and invert the subsequent bits follow the above proc. till the left most bit is flipped to 1. correct me if m wrong!! -- You received

[algogeeks] Re: Algorithm to find all subsets of size K

2010-08-22 Thread R.ARAVINDH
@raj really cool On Aug 22, 1:08 pm, Raj N wrote: > Generate all binary strings of length k. For eg: S={1,2,3,4,5} generate all > binary strings of length 5. 0 represents that particular number is absent > and 1 for the presence of the number. > > > > On Fri, Aug 13, 2010 at 11:35 PM, asdf wro

[algogeeks] Re: how to implement TAIL command of unix.

2010-08-22 Thread R.ARAVINDH
read the i/p file count the no. of '\n' characters if count > k (argument of tail) then print all chars till EOF correct me if m wrong !!! On Aug 16, 9:16 am, vikas kumar wrote: > the method of farword seek is inefficient. consider case of 10 > lines and you want to display only 3-4 lines. b

[algogeeks] Re: Alternative merge

2010-08-22 Thread R.ARAVINDH
link nt working...so can anyone explain fr new users?? On Aug 16, 6:52 pm, Minotauraus wrote: > Please check link. > > On Aug 15, 8:25 pm, Gene wrote: > > > > >http://groups.google.com/group/algogeeks/browse_thread/thread/f56bac6... > > > The best solution given there is O(n) with only constant

[algogeeks] Re:

2010-08-22 Thread R.ARAVINDH
can anyone post a good article on tries??? i am a newbie...so pls help!! On Aug 22, 11:26 am, Ukil wrote: > use suffix trie. > > On Aug 16, 9:36 pm, ashita dadlani wrote: > > > > > You have a string say "foobarfoo" in which "fo" and "oo" aree repeated > > twice.You have to find all such repeated

[algogeeks] Re: Reading large numbers?

2010-08-22 Thread R.ARAVINDH
if the file is standard i/p then go for strings or linked list. On Aug 16, 10:44 am, janani thiru wrote: > How can I read a file which has 10^9 characters or more efficiently? > > -- > Janani T -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group

[algogeeks] Re: Time complexity - is anybody bothered about it anyway?

2010-08-22 Thread R.ARAVINDH
@asutosh:: all ur efforts 2 write some code wud be worthless if it cant work for some inputs...if it can , then no one does bother about time complexity. since it doesn for large i/ps v hav 2 write some efficient code (although i agree wid u dat its painful :P ) On Aug 17, 9:45 pm, Dave wro

[algogeeks] Re: BFS

2010-08-22 Thread R.ARAVINDH
@manohar and @giri:: doesn recursion itself use stacks( implicitly)?? On Aug 18, 9:26 pm, Giri wrote: > @manohar: thnks man.. this solution would be apt.. > > if there's any better algo which doesn't use an extra stack or queue, > but does the purpose in recursion, do post it.. > > On Aug 18, 8