Re: [algogeeks] Reconstruct BST from preorder traversal

2011-10-18 Thread Anand Saha
You will also need Inorder traversal data. On Tue, Oct 18, 2011 at 10:12 AM, Ankuj Gupta wrote: > How to reconstruct a BST from just the prorder traversal of that tree ? > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to thi

Re: [algogeeks] Find lowest common ancestor of Binary Tree

2011-09-29 Thread Anand Saha
http://www.geeksforgeeks.org/archives/1029 On Wed, Sep 28, 2011 at 10:57 AM, Ankuj Gupta wrote: > Find lowest common ancestor of Binary 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

Re: [algogeeks] plssssssssss replyyyyyyyyyyyyyyyyy

2011-09-18 Thread Anand Saha
Going by choice of your subject line, none. -- On Sun, Sep 18, 2011 at 10:15 PM, vivek goel wrote: > which profile is better?? > > 1. Technology Consulting > 2. Quality Control Analyst Systems > > if one is from software engg ( programming) background. > > -- > You rece

Re: [algogeeks]

2011-07-29 Thread Anand Saha
You have to use External Merge Sort. -- On Fri, Jul 29, 2011 at 2:58 PM, Puneet Gautam wrote: > If u have to sort a large amount of data,but the memory space is > insufficient for the same...How would u sort the data..? > > Reply asap everyone.. > > Thanks in advance...! > > -- > You received

Re: Re : [algogeeks] Re: size of self referential structure

2011-07-27 Thread Anand Saha
On Wed, Jul 27, 2011 at 2:18 PM, hary rathor wrote: > @sunny : what you means by machine dependent means 64 bit: you means by > compiler / operating system /computer architecture ? > because i never get size of pointer 8 byte. if your statement true then > tell me which compiler / operating syst

Re: [algogeeks] Re: Fwd: SORTING ARRAYS

2011-07-27 Thread Anand Saha
@ankit: you are right. While building is okay (item to insert is from other array, hence comparison to that allowed), deletemin() will violate the condition given. -- On Wed, Jul 27, 2011 at 2:03 PM, ankit sambyal wrote: > @anand: How are you building minheap ?? Comparison of same array elem

Re: [algogeeks] Re: Fwd: SORTING ARRAYS

2011-07-27 Thread Anand Saha
Another point of view: Since both the arrays have same elements, sorting one sorts both. Hence we can use elements of array1 to build a min-heap in array2. Then read mins from array2 into array1, getting array1 sorted. Copy array1 to array2. Does this violate the comparison rule set? -- On W

Re: [algogeeks] The Google Resume

2011-07-27 Thread Anand Saha
Here: http://goo.gl/pDG5s (Yes, that's the correct link) -- On Wed, Jul 27, 2011 at 1:18 PM, malay chakrabarti wrote: > plz send it to my maid id also . thanks in advance :) > > > On Wed, Jul 27, 2011 at 12:46 PM, Prem Krishna Chettri > wrote: > >> Anyone got this book?? pdf.. or URL link is

Re: [algogeeks] MS interview:

2011-07-27 Thread Anand Saha
Implement Preorder Traversal in the File system tree. -- On Wed, Jul 27, 2011 at 12:06 PM, geek forgeek wrote: > Function to display the directory structure in a user friendly way taking > root dir as arg > for a general OS. You may assume and state some basic APIs available in > that OS > >

Re: [algogeeks] Re: Fwd: SORTING ARRAYS

2011-07-26 Thread Anand Saha
I don't think so. Try it on {2, 5, 1, 7} and {5, 7, 1, 2} -- On Wed, Jul 27, 2011 at 10:33 AM, Sonal Maheshwari wrote: > i think the following shud work: > > i=j=0; > while(i< n && j { > if ( a[i] < b[j] ) > { > pos= find(b, a[i]); ///find the position of a[i] in > ar

Re: [algogeeks] AMAZON Q

2011-07-26 Thread Anand Saha
Construct a BST using ar[], where each node contains the ar index information as well (in addition to the value). Now iterating through ar. For each element, traverse the BST by value, counting only those nodes where the value AND index# are greater then self. Once done traversal, update ar_low. -

Re: [algogeeks] Re: Image based Problem (Google)

2011-07-14 Thread Anand Saha
Hash will suggest if the image was modified or not. The question I think is about finding the exact pixels which changed compared to original one. -- On Thu, Jul 14, 2011 at 3:50 PM, sagar pareek wrote: > oh common take HASH of the image whuch need less space compare to > original one...

Re: [algogeeks] Re: Reversing the order of words in String

2011-07-13 Thread Anand Saha
On Wed, Jul 13, 2011 at 7:32 AM, Gene wrote: > You can recognize a word W, recur to print the rest of the words in > reverse, then print W: > > #include > #include > > void print_words_in_reverse(char *s) > { > char *e; > while (isspace(*s)) s++; > if (*s == '\0') return; > e = s + 1; > wh

Re: [algogeeks] Re: Search node in a binary tree

2011-07-13 Thread Anand Saha
On Wed, Jul 13, 2011 at 1:40 PM, sameer.mut...@gmail.com < sameer.mut...@gmail.com> wrote: > > Guys i always have this doubt.Please tell me whether stack frames allocated > for each recursive call will be cleared if we return in the middle of a > recursive call? > In normal condition, the return

Re: [algogeeks] Re: Adding w/o +

2011-07-13 Thread Anand Saha
On Wed, Jul 13, 2011 at 2:22 PM, Amit Gupta wrote: > You can try this also > > do > { > sum = a ^ b; > carry = a & b; > *carry <<= 0x1u;* > a = sum; > b = carry; > }while (carry!=0); > > I think one step is missing here, no? (I have added in bold) -- -- You received this message because y

Re: [algogeeks] # References !!!!

2011-07-12 Thread Anand Saha
g)&b)-((unsigned long)&a-(unsigned > long)&b)) = (unsigned long)&b; > > > >/*/ > > > > > >cout<<"\n-"< > c=999; > >cout<<"\n-"< > > > > >

Re: [algogeeks] C OUTPUT HELP

2011-07-12 Thread Anand Saha
On Tue, Jul 12, 2011 at 2:36 PM, nicks wrote: > > and in problem 3 what i understood after reading with what you wrote is > that size of tag will remain sizeof(int) irrespective of the number of > constants in it.correct me if i am wrong !! > > Right. -- -- You received this message because

Re: [algogeeks] C OUTPUT HELP

2011-07-12 Thread Anand Saha
On Tue, Jul 12, 2011 at 1:29 AM, nicks wrote: > > *PROBLEM 3>.* > * > * > #include > main() > { > enum {low='a',high='b'}tag; > char try=low; > printf("Size=%d",sizeof(tag)); > switch (try) > { > case 'a':printf("aaa");break; > case 'b':printf("bbb"); > case 'c':printf("ccc"); > } > //system("

Re: [algogeeks] Re: C OUTPUT HELP

2011-07-12 Thread Anand Saha
But this works, where I have both the variable name and function name used: #includeint charu(int x);int charu(int x) { return x; } main(){* int a = charu(45); int charu = a;* int scanf=78; //int printf=45; int getchar=6; prin

Re: [algogeeks]

2011-07-12 Thread Anand Saha
Also - new and delete are typesafe, hence better. (malloc returns void*) - new gives you the feature of "placement new", which allows you create an object in a pre-determined location, which is helpful I think in device drivers programming... -- On Tue, Jul 12, 2011 at 10:39 AM, sagar pareek w

Re: [algogeeks] # References !!!!

2011-07-12 Thread Anand Saha
Yep, and http://www.parashift.com/c++-faq-lite/references.html#faq-8.5 -- On Tue, Jul 12, 2011 at 12:50 PM, sunny agrawal wrote: > Once a reference is initialized to an object, it cannot be changed to refer > to another object. > Ref. Bruce Eckel - ch11 > > So its Not possible > -- > Sunny Agg