Re: [algogeeks] clear screen in mysql

2010-09-14 Thread Chakravarthi Muppalla
+1 On Tue, Sep 14, 2010 at 4:27 PM, Rohit Saraf wrote: > well i just wanted u to know that there is a very nice place called > www.google,com where u can find many things. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to th

Re: [algogeeks] Amazon intern Question

2010-09-01 Thread Chakravarthi Muppalla
@Gene, it isn't about related words, its abt matching words! On Wed, Sep 1, 2010 at 8:26 PM, saurabh singh wrote: > I think DS will be somewhere between suffix and trie DS > > > On Wed, Sep 1, 2010 at 9:35 AM, jaladhi dave wrote: > >> trie >> >> On Wed, Sep 1, 2010 at 5:45 PM, Arun wrote: >> >>>

Re: [algogeeks] Amazon intern Question

2010-09-01 Thread Chakravarthi Muppalla
I guess, you should be using a suffix tree. On Wed, Sep 1, 2010 at 5:45 PM, Arun wrote: > You are given the amazon.com database which consists of names of > millions of products. When a user enters a search query for particular > object with the keyword say "foo" , output all the products which

Re: [algogeeks] Re: AMAZON Interview Question

2010-07-14 Thread Chakravarthi Muppalla
I guess it is a dynamic programming problem. On Wed, Jul 14, 2010 at 11:34 AM, Anand wrote: > One approach will be while creating a BST and also store position of the > element in the original array. While constructing ar_low check for two > condition 1. element should be less than the given ele

Re: [algogeeks] Java Random Method

2010-06-26 Thread Chakravarthi Muppalla
@trdant, is non-linear random number different from general random number? On Sun, Jun 27, 2010 at 9:36 AM, Anurag Sharma wrote: > int getNum(){ > int arr[]={104,105,106,108}; > return arr[(int)(Math.random()*4)]; > } > > Anurag Sharma > > > > On Sat, Jun 26, 2010 at 8:43 PM, trdant wrote: > >

Re: [algogeeks] BST

2010-06-24 Thread Chakravarthi Muppalla
I think in-order traversal would solve the problem. On Thu, Jun 24, 2010 at 4:24 PM, Anurag Sharma wrote: > I once posted it to my blog. Perhaps its the same you are asking : > > http://anuragsharma-sun.blogspot.com/2010/03/converting-bst-to-circular-doubly.html > > Anurag Sharma > > > > On Mon,

Re: [algogeeks] max of 2 numbers

2010-06-19 Thread Chakravarthi Muppalla
p>q ? p : q ; i think it is that simple, otherwise i'm missing something. On Sun, Jun 20, 2010 at 9:10 AM, anand verma wrote: > int max(int a,int b) > { > int max; > (a/b)&&(max=a)||(max=b); > return max; > > } > > -- > You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Re: coins

2010-06-19 Thread Chakravarthi Muppalla
O(S +n ) only when the denominations are in sorted order.isn't it? On Sun, Jun 20, 2010 at 8:41 AM, Anand wrote: > Complexity will be O(S+n) S = Sum required N = Number of denominations > > On Sat, Jun 19, 2010 at 12:48 PM, Chakravarthi Muppalla < > chakri...@gmail.com&g

Re: [algogeeks] Re: coins

2010-06-19 Thread Chakravarthi Muppalla
Hi anand, could you please enlighten on the running time of the code? On Sun, Jun 20, 2010 at 1:12 AM, Anand wrote: > Here is my approach for solving this problem using DP. > > http://codepad.org/Op41weg5 > > <http://codepad.org/Op41weg5> > > On Thu, Jun 17, 20

Re: [algogeeks] Re: coins

2010-06-19 Thread Chakravarthi Muppalla
@everyone: is there one planning to participate in http://byoc.in/13/tournaments.html Kindly let me know.(This may not a proper thread to post, but please excuse me this time). On Sun, Jun 20, 2010 at 1:18 AM, Chakravarthi Muppalla wrote: > Hi anand, > could you please enlighten on the r

Re: [algogeeks] Width of the tree

2010-06-19 Thread Chakravarthi Muppalla
you will have to take top-down/bottom-up approach. getMaxWidth(node tree){ int n = getHeight(tree), w=1; for(int i=1; i< n; i++){ w = getWidth(tree, i); if(w <= maxWidth) continue; else maxWidth = w; } Syso("Maximum width is"+maxWidth); } getWidth(node tree,level l){

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] Re: sum to x

2010-06-12 Thread Chakravarthi Muppalla
; if ( && map[num] == false){ > map[ S - num ] = true ; > } else { > > } > > > On Jun 12, 11:40 am, Chakravarthi Muppalla > wrote: > > I would use an array. > > > > a[] = 1 3 7 8 9 78 67 23 > > a[] = 1 3 7 8 9 23 67 78 //sort the ar

Re: [algogeeks] sum to x

2010-06-12 Thread Chakravarthi Muppalla
I would use an array. a[] = 1 3 7 8 9 78 67 23 a[] = 1 3 7 8 9 23 67 78 //sort the array reqSum = 30; for i :a.length-1; i>=0; i-- t = reqSum - a[i]; if(t is negative) continue; find(t);//in the rest of the array;(binary search) if(t found in the array) return index of t, cur

Re: [algogeeks] You have to count the occurances of all words in a document. You are given a method chat * GetNextWord, that returns the next word from the document.

2010-03-05 Thread Chakravarthi Muppalla
@Umer 'categorize the words into 26 categories depending on the initial character', as far as i know this is the principle of a trie. look up trie for the next word, if exists increment count; other wise start counter and insert into trie; i think this one would work. -- You received this message

Re: [algogeeks] Transitive Closure of a Undirected graph

2009-11-24 Thread Chakravarthi Muppalla
as long as it is an undirected graph;simple dfs would suffice! On Tue, Nov 24, 2009 at 10:13 PM, Rohit Saraf wrote: > But then .. > think.. > for every two pairs of nodes you have to check whether both are connected > to root and then you will say yes/no. > And you will have to do this for all di

Re: [algogeeks] how can i find size of an object in java

2009-11-24 Thread Chakravarthi Muppalla
measure jvm memory usage before/after creating ur object; but it is not assured to give the correct size(gc). or u can use a premain agent. On Wed, Nov 25, 2009 at 12:37 AM, Abhijeet Kumar wrote: > How can i find size of an object in java > plsss answer asap > > -- > You received this messag