Re: [algogeeks] amazon

2011-08-10 Thread Anika Jain
i understand longest subsequence.. but what is longest increasing subsequence .. i dont know the difference between them..plz sumbody tel .. On Tue, Aug 9, 2011 at 9:41 AM, Akash Mukherjee akash...@gmail.com wrote: @udit : thanx man...they were really helpful 2 allcan u plzz chk d

[algogeeks] Re: thought works questions

2011-08-10 Thread Sinjan Kumar
hello reynald could you plz send me the Thoughtworks questions, thanx On Aug 4, 6:17 am, Reynald Suz reynaldsus...@gmail.com wrote: Thank you so much! Thoughtworks is visiting our campus on Aug-8, I'll send you questions for sure. On Wed, Aug 3, 2011 at 11:14 PM, coder dumca

Re: [algogeeks] Re: Microsoft written!!!

2011-08-10 Thread Mohit Goel
10 4 5 2 7 6 11 1 39 8 12 13 14 15 i think we should first find the parent of the particular node ..then apply the concept as told by Brijesh on it p =parent(q); r = parent(p);

Re: [algogeeks] amazon

2011-08-10 Thread sagar pareek
like u have given array *1 2 3 4 5 7* 6 7 8 9 *1 2 3 4 5 6 *5 4 3 6 7 8 ans will be 6 On Wed, Aug 10, 2011 at 11:30 AM, Anika Jain anika.jai...@gmail.com wrote: i understand longest subsequence.. but what is longest increasing subsequence .. i dont know the difference between them..plz

[algogeeks] Re: m'th max element

2011-08-10 Thread Ankuj Gupta
We can use min heap. 1) Build a Min Heap MH of the first m elements (arr[0] to arr[m-1]) of the given array. O(m) 2) For each element, after the mth element (arr[m] to arr[n-1]), compare it with root of MH. a) If the element is greater than the root then make it root and call heapify for MH b)

[algogeeks] Re: SPOJ CENCRY

2011-08-10 Thread kartik sachan
any body tell the test cases?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more

Re: [algogeeks] amazon

2011-08-10 Thread Anika Jain
okk thanx On Wed, Aug 10, 2011 at 11:58 AM, sagar pareek sagarpar...@gmail.comwrote: like u have given array *1 2 3 4 5 7* 6 7 8 9 *1 2 3 4 5 6 *5 4 3 6 7 8 ans will be 6 On Wed, Aug 10, 2011 at 11:30 AM, Anika Jain anika.jai...@gmail.comwrote: i understand longest subsequence.. but

[algogeeks] Re: Closest ancestor of two nodes

2011-08-10 Thread Venkat
Don solution is perfect. i double checked it.. On Aug 9, 9:01 pm, Don dondod...@gmail.com wrote: tree closestSharedAncestor(tree root, tree node1, tree node2, int result) {   tree returnValue = 0;   if (root)   {     if (root == node1) result += 1;     if (root == node2) result += 2;

[algogeeks] Re: m'th max element

2011-08-10 Thread rahul
As Nitin Metioned Selection Algorithm is the best for this problem. Order of complexity is O(n) On Aug 9, 11:31 pm, Ankuj Gupta ankuj2...@gmail.com wrote: We can use min heap. 1) Build a Min Heap MH of the first m elements (arr[0] to arr[m-1]) of the given array. O(m) 2) For each element,

Re: [algogeeks] Re: SPOJ CENCRY

2011-08-10 Thread Nitin Nizhawan
3 eee cjpvbhntzgm aeiouaeiouae vfghjklwerf eouaeioicou On Wed, Aug 10, 2011 at 12:06 PM, kartik sachan kartik.sac...@gmail.comwrote: any body tell the test cases?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To

Re: [algogeeks] Re: SPOJ CENCRY

2011-08-10 Thread Nitin Nizhawan
inp: 3 eee vfghjklwerf out: cjpvbhntzgm aeiouaeiouae eouaeioicou On Wed, Aug 10, 2011 at 12:40 PM, Nitin Nizhawan nitin.nizha...@gmail.comwrote: 3 eee cjpvbhntzgm aeiouaeiouae vfghjklwerf eouaeioicou On Wed, Aug 10, 2011 at 12:06 PM, kartik

Re: [algogeeks] Re: SPOJ CENCRY

2011-08-10 Thread kartik sachan
thanks nitin got AC...:) silliy mistake -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For

[algogeeks] Re: m'th max element

2011-08-10 Thread nick
nice logic :) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/-rdIH5FKbk8J. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe

Re: [algogeeks] Re: Microsoft written!!!

2011-08-10 Thread Puneet Chawla
Agree with mohit goel.. On Wed, Aug 10, 2011 at 11:22 AM, Mohit Goel mohitgoel291...@gmail.comwrote: 10 4 5 2 7 6 11 1 39 8 12 13 14 15 i think we should first find the parent

[algogeeks] Tejas networks and MAQ

2011-08-10 Thread sagar pareek
Hi if anyone recently faced written or interview of those companies then pls discuss here Thanks in advance -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to

Re: [algogeeks] Re: Microsoft written!!!

2011-08-10 Thread coder dumca
apply BFS the node after the particular node(whode cousin to be find) will be the required node On Wed, Aug 10, 2011 at 2:15 PM, Puneet Chawla puneetchawla...@gmail.comwrote: Agree with mohit goel.. On Wed, Aug 10, 2011 at 11:22 AM, Mohit Goel mohitgoel291...@gmail.comwrote:

[algogeeks] Re: need the book google resume and algorithms for interviews

2011-08-10 Thread jonee
please share algorithm for interviews book as the link mentioned in algogeeks post does not work anymore. On Jul 26, 3:34 pm, coder dumca coder.du...@gmail.com wrote: @ Raghvendra  thanks dude On Mon, Jul 25, 2011 at 7:20 PM, raghavendhra rahul rahulraghavend...@gmail.com wrote: hi

[algogeeks] Re: Tejas networks and MAQ

2011-08-10 Thread sagar pareek
Please anyone On Wed, Aug 10, 2011 at 2:19 PM, sagar pareek sagarpar...@gmail.com wrote: Hi if anyone recently faced written or interview of those companies then pls discuss here Thanks in advance -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD --

Re: [algogeeks] Probability question.. help

2011-08-10 Thread programming love
is it 101/200?? On Wed, Aug 10, 2011 at 3:41 AM, Prakash D cegprak...@gmail.com wrote: is there anything like there should be atleast one man and one women should dance together? On Wed, Aug 10, 2011 at 2:26 AM, Shuaib Khan aries.shu...@gmail.comwrote: On Wed, Aug 10, 2011 at 1:45 AM,

Re: [algogeeks] Re: Microsoft written!!!

2011-08-10 Thread muthu raj
@coder dumca: If u apply DFS u will get a brother and not cousin. And yes it works only for some cases. *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Wed, Aug 10, 2011 at 2:24 PM, coder dumca coder.du...@gmail.com wrote: apply BFS the node after the particular node(whode cousin to be

Re: [algogeeks] Re: Microsoft written!!!

2011-08-10 Thread muthu raj
@Mohit : in ur code u are breaking out when there parent reaches root. But not every time will we have to reach root. For example: Leftmost right cousin of 1 is 9...in dat case parent should stop at 4. which is not the root. *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Wed, Aug 10, 2011

Re: [algogeeks] Probability question.. help

2011-08-10 Thread Aditya Virmani
is it 100 men 100 women? On Wed, Aug 10, 2011 at 3:25 PM, programming love love.for.programm...@gmail.com wrote: is it 101/200?? On Wed, Aug 10, 2011 at 3:41 AM, Prakash D cegprak...@gmail.com wrote: is there anything like there should be atleast one man and one women should dance

Re: [algogeeks] pls help

2011-08-10 Thread programming love
@sagar and @brijesh: awesome explanation!!! too good! 1 doubt! the question says it has only 28 leaves. According to uour explanations, it has 81 leaves. how is it possible?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this

Re: [algogeeks] Re: Microsoft written!!!

2011-08-10 Thread Mohit Goel
@muthu raj: it will also come out ,when loop condition will not be statisfied.i.e when 'p' is not the right child of its parent...in such a case it will not reach root .. in the ex given by u it will stop at 4 . -- You received this message because you are subscribed to the Google Groups

[algogeeks]

2011-08-10 Thread Rajeshwar Patra
can someone predict the output and give an explanation main() { int i=5; printf(%d %d %d %d %d,i++,i--,++i,--i,i); } -- *Rajeshwar Patra,* *MCA final year,* *Nit Durgapur* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this

Re: [algogeeks]

2011-08-10 Thread siddharam suresh
depends on the compiler to compiler Thank you, Siddharam On Wed, Aug 10, 2011 at 3:53 PM, Rajeshwar Patra rajeshwarpa...@gmail.comwrote: can someone predict the output and give an explanation main() { int i=5; printf(%d %d %d %d %d,i++,i--,++i,--i,i); } -- *Rajeshwar Patra,*

Re: [algogeeks]

2011-08-10 Thread Anubhav Aggarwal
can anybody explain how its printing 4 5 5 4 5 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to

Re: [algogeeks] c question!

2011-08-10 Thread Arun Vishwanathan
@siddarth: should not the statement you mentioned above as nodeptr h = (nodeptr*)malloc(sizeof(nodeptr*)); be nodeptr h =(struct*)malloc(sizeof(struct)); ?? cos malloc returns pointer to memory block and nodeptr itself is a pointer and you have used nodeptr* further? On Tue, Aug 9, 2011 at

Re: [algogeeks]

2011-08-10 Thread siddharam suresh
the evaluation of parameters in printf() done from right to left. Thank you, Siddharam On Wed, Aug 10, 2011 at 4:04 PM, Anubhav Aggarwal experience...@gmail.comwrote: can anybody explain how its printing 4 5 5 4 5 -- You received this message because you are subscribed to the Google

Re: [algogeeks] simple doubt

2011-08-10 Thread Arun Vishwanathan
@jiten: that staement means pa is a pointer to 3 ints not an array of pointers.. int *pa[3] means it is an array of pointers On Fri, Aug 5, 2011 at 8:44 PM, Jiten j.playe...@gmail.com wrote: (*pa)[3] ;// pa is array of pointers to int type; so pa = arr; doesn't make any sense ,bcoz arr

Re: [algogeeks]

2011-08-10 Thread Naveen Kumar
AFAIK evalution order of parameters in c is compiler dependent. On Wed, Aug 10, 2011 at 4:09 PM, siddharam suresh siddharam@gmail.com wrote: the evaluation of parameters in printf() done from right to left. Thank you, Siddharam On Wed, Aug 10, 2011 at 4:04 PM, Anubhav Aggarwal

Re: [algogeeks] output?

2011-08-10 Thread Arun Vishwanathan
@sandeep: so the statement becomes if(ch=0) since printf returns integer 0...whats does this mean now actually?0 is ascii for NULL and so ch is assinged to null? I am slightly confused.. On Tue, Aug 9, 2011 at 7:04 PM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote: @all sorry i give wrong

Re: [algogeeks] pls help

2011-08-10 Thread Brijesh Upadhyay
It could have a maximum of 81 leaves with the same '40' no of internal nodes so for any value between 28 to 81, it would have only 40 internal nodes -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit

Re: [algogeeks] Re: Microsoft written!!!

2011-08-10 Thread Brijesh Upadhyay
thank u , i couldnot have answered this :P -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/Gppo1P-Gr9oJ. To post to this group, send email to

Re: [algogeeks] pls help

2011-08-10 Thread sagar pareek
Excatly why dont u just make a rough diagram in paper for binary and ternary trees and just see that each level has max of 2/3^i where 2/3 is for binary/ternary tree and i is level where root level is 0... then make a complete ternary tree and see why leaves with 28 in numbers have

[algogeeks] STL sort

2011-08-10 Thread aanchal goyal
I have a vector of stuct, how to sort this vector? problem is I can't overload the '' operator in struct definition, as i want to sort by 'x' one time, and then by 'y'. I tried to write the comparator function separatley but its no working. How to do it? #includeiostream #includealgorithm

Re: [algogeeks] MS question

2011-08-10 Thread keyan karthi
May be this way We dont display de title of a movie as a thumbnail So may be the first frame which has a wide distribution of colours , assuring it has some other part of de clip other than de title.. Ignore this if it sounds funny...!! On 8/9/11, *$* gopi.komand...@gmail.com wrote:

Re: [algogeeks] STL sort

2011-08-10 Thread Nitin Nizhawan
what is comp in your code? On Wed, Aug 10, 2011 at 6:19 PM, aanchal goyal goyal.aanch...@gmail.comwrote: I have a vector of stuct, how to sort this vector? problem is I can't overload the '' operator in struct definition, as i want to sort by 'x' one time, and then by 'y'. I tried to write

[algogeeks] Os/processor dependencies of object file(C compiled file)

2011-08-10 Thread mithun bs
Hi, I know that the compiled code of a C file(after assembler converts assembly code to opcode) cannot be run on a different OS or it cannot be run on a different processor architecture. So, I need to know what are the machine dependencies which are added in object file. One thing is the opcode

Re: [algogeeks] STL sort

2011-08-10 Thread aanchal goyal
sorry, comp is either comp_x or comp_y On Wed, Aug 10, 2011 at 6:24 PM, Nitin Nizhawan nitin.nizha...@gmail.comwrote: what is comp in your code? On Wed, Aug 10, 2011 at 6:19 PM, aanchal goyal goyal.aanch...@gmail.comwrote: I have a vector of stuct, how to sort this vector? problem is I

[algogeeks] aptitude

2011-08-10 Thread Shashank Jain
what is the best book for aptitude questions? Shashank Jain IIIrd year Computer Engineering Delhi College of Engineering -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To

Re: [algogeeks] aptitude

2011-08-10 Thread Pratz mary
rs aggarwal On 10 August 2011 18:32, Shashank Jain shashan...@gmail.com wrote: what is the best book for aptitude questions? Shashank Jain IIIrd year Computer Engineering Delhi College of Engineering -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] STL sort

2011-08-10 Thread aanchal goyal
got it. On Wed, Aug 10, 2011 at 6:31 PM, aanchal goyal goyal.aanch...@gmail.comwrote: sorry, comp is either comp_x or comp_y On Wed, Aug 10, 2011 at 6:24 PM, Nitin Nizhawan nitin.nizha...@gmail.comwrote: what is comp in your code? On Wed, Aug 10, 2011 at 6:19 PM, aanchal goyal

Re: [algogeeks] pls help

2011-08-10 Thread vamshi vijay
@Sagar See at level 4, 81 leaf nodes are possible, since in question it has been given 28 leaf nodes, if i use just 10 nodes from level 3 (27 nodes), i can get 28 leaves, but if u observe the remaining 17 nodes in the 3rd level are also becoming leaf nodes, but in question given as 28 leaf

Re: [algogeeks] STL sort

2011-08-10 Thread Nitin Nizhawan
bool operator()(point a, point b){ return a.xb.x; } remove references it should work. following is working code. #includeiostream #includealgorithm #includevector using namespace std; typedef struct { int x; int y; }point; struct comp_x { bool operator()(point a, point b){

Re: [algogeeks] STL sort

2011-08-10 Thread Amol Sharma
instead of struct you can use *pairint,int* which will make the work easier for you -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On Wed, Aug 10, 2011 at 6:47 PM, Nitin Nizhawan nitin.nizha...@gmail.comwrote: bool operator()(point a, point b){

[algogeeks] Re: pls help

2011-08-10 Thread Amethy hobby
is it like a number base problem? where a set of alpha is (0,1,2), and the n is the lenght of number such as (p,n) 3 (0,1) of length 3 so the value is (000)(001)(010)... On 8月10日, 下午9时19分, Amethy hobby news...@gmail.com wrote: I thought the backtracking is the method to solve this problem

Re: [algogeeks] C question

2011-08-10 Thread Karthikeyan palani
@ram got it. tanx :) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options,

Re: [algogeeks] pls help

2011-08-10 Thread Pratz mary
ya ur right!!! On 10 August 2011 18:44, vamshi vijay vamshi1...@gmail.com wrote: @Sagar See at level 4, 81 leaf nodes are possible, since in question it has been given 28 leaf nodes, if i use just 10 nodes from level 3 (27 nodes), i can get 28 leaves, but if u observe the remaining 17

Re: [algogeeks] problem regarding output??

2011-08-10 Thread Arun Vishwanathan
@ankit: does that mean that after the compiler is informed that the void pointer will point to integer witht he typecast statement and then we point it to some other type , it will be an error? i mean after that typecast statement, if i do char a; k=a;is it wrng? On Tue, Aug 9, 2011 at 2:06

Re: [algogeeks] pls help

2011-08-10 Thread sagar pareek
gr8 work vamshi but total nodes will be 1+3+9+27+*2*(not 1)=42 On Wed, Aug 10, 2011 at 6:59 PM, Pratz mary pratima.m...@gmail.com wrote: ya ur right!!! On 10 August 2011 18:44, vamshi vijay vamshi1...@gmail.com wrote: @Sagar See at level 4, 81 leaf nodes are possible, since in

Re: [algogeeks] pls help

2011-08-10 Thread programming love
@sagar: Thanks again :) But my doubt is it'll have more than 28 leaf nodes when the ques clearly sayd it shud have 28 leaf nodes. @vamshi: I kind of agree with what you say. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this

Re: [algogeeks]

2011-08-10 Thread Pratz mary
the evalution starts from right to left bt gets printed from left to right On 10 August 2011 16:14, Naveen Kumar naveenkumarve...@gmail.com wrote: AFAIK evalution order of parameters in c is compiler dependent. On Wed, Aug 10, 2011 at 4:09 PM, siddharam suresh siddharam@gmail.com wrote:

Re: [algogeeks] Preprocessor Help !!

2011-08-10 Thread Abhishek Gupta
Answer 2) To prevent use of NULL with any other variable instead of 0(zero), it is set at void pointer. for ex, you cannot use in C like this, a=b+NULL; but, i think, in C++ you can do. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view

Re: [algogeeks] pls help

2011-08-10 Thread Gaurav Menghani
I am just increasing the size of the current string by one. So that a new character can be appended. On Sat, Aug 6, 2011 at 11:01 AM, Tushar Bindal tushicom...@gmail.com wrote: @gaurav didn't get this: Just to increase the size of the string by one. Then you can put any character at the the

[algogeeks] Re: pls help

2011-08-10 Thread Dave
@Nikhil: There is no way to tell how many nodes the ternary tree has. After all, a ternary tree with one leaf node can contain any number of nodes. Dave On Aug 9, 1:37 pm, NIKHIL nikhil.jain.shali...@gmail.com wrote: In a ternary Tree No of leaves 28. How many nodes it have? An AVL tree with

Re: [algogeeks]

2011-08-10 Thread siddharth srivastava
Its completely compiler dependent. Actually it depends upon how the printf has been implemented. Generally its a stack based implementation which will give you 4 5 5 5 5 as output. It was interesting to see your output, have you executed it ? Which compiler ? On 10 August 2011 19:05, Pratz

Re: [algogeeks] Re: puzzle

2011-08-10 Thread varun pahwa
make two ropes 50m and 100 meter. make a loop kind of thing with that now you have two 50 mtr ropes so get down to 100 mtr point and tie loop rope in downward now cut the loop at 100 mtr you have 100 mtr rope then move down with the help of that. i hope i am clear. On Mon, Aug 8, 2011 at 1:52 PM,

[algogeeks] ~ operator

2011-08-10 Thread Ayswarya Srinivasan
can someone explain how this works- * * *void* *main*(){ *int* a,b,d; scanf(%d%d,a,b); d=a+~b+1; printf(%d,d); getch(); } say if a=5 b=6 then output is -1 if ~ is one's complement operator then a=0101 ~b=1001 d= 0101+1001+1. which is not -1 can someone explain how it works.

[algogeeks] Re: ~ operator

2011-08-10 Thread amit karmakar
calculate 0101+1001+1 as Now if the signed numbers are represented using 2's complement system then is the representation for -1 On Aug 10, 7:23 pm, Ayswarya Srinivasan krsayswa...@gmail.com wrote: can someone explain how this works- * * *void* *main*(){     *int* a,b,d;    

[algogeeks] Re: suggest simple code for

2011-08-10 Thread Don
int depth(node *root) { return root ? max(depth(root-left), depth(root-right)) : 0; } On Aug 8, 8:03 am, jagrati verma jagrativermamn...@gmail.com wrote:  finding the depth or height of a tree. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

[algogeeks] Re: suggest simple code for

2011-08-10 Thread Don
int depth(node *root) { return root ? 1+max(depth(root-left), depth(root-right)) : 0; } On Aug 8, 8:03 am, jagrati verma jagrativermamn...@gmail.com wrote:  finding the depth or height of a tree. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

[algogeeks] Re: ~ operator

2011-08-10 Thread Dave
@Ayswarya: In twos-complement arithmetic, -x = ~x + 1, so a + ~b + 1 = a +(~b +1) = a + (-b) = a - b. Dave On Aug 10, 9:23 am, Ayswarya Srinivasan krsayswa...@gmail.com wrote: can someone explain how this works- * * *void* *main*(){     *int* a,b,d;     scanf(%d%d,a,b);     d=a+~b+1;    

[algogeeks] Re: suggest simple code for

2011-08-10 Thread Dave
@Don: Beautiful! Dave On Aug 10, 10:03 am, Don dondod...@gmail.com wrote: int depth(node *root) {   return root ? 1+max(depth(root-left), depth(root-right)) : 0; } On Aug 8, 8:03 am, jagrati verma jagrativermamn...@gmail.com wrote:  finding the depth or height of a tree. -- You

Re: [algogeeks] Re: ~ operator

2011-08-10 Thread Ayswarya Srinivasan
thank you dave and amit... On Wed, Aug 10, 2011 at 8:36 PM, Dave dave_and_da...@juno.com wrote: @Ayswarya: In twos-complement arithmetic, -x = ~x + 1, so a + ~b + 1 = a +(~b +1) = a + (-b) = a - b. Dave On Aug 10, 9:23 am, Ayswarya Srinivasan krsayswa...@gmail.com wrote: can someone

[algogeeks] Re: suggest simple code for

2011-08-10 Thread Don
I do love functions that start with return. Don On Aug 10, 10:09 am, Dave dave_and_da...@juno.com wrote: @Don: Beautiful! Dave On Aug 10, 10:03 am, Don dondod...@gmail.com wrote: int depth(node *root) {   return root ? 1+max(depth(root-left), depth(root-right)) : 0; } On Aug 8,

Re: [algogeeks] Re: Amazon question.

2011-08-10 Thread Kunal Patil
@Ankit Sambyal: Agree with ankuj...TC of your solution is O(nlogn) and not O(n^2)... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to

Re: [algogeeks] Re: m'th max element

2011-08-10 Thread Kunal Patil
@Ankuj: +1 for different approach. (Though selection algo is more efficient than this.) On Wed, Aug 10, 2011 at 1:44 PM, nick tarunguptaa...@gmail.com wrote: nice logic :) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this

[algogeeks] Write a program to find the empirical formulae from physical formulae

2011-08-10 Thread vikas
Write a program to find the empirical formulae from physical formulae ex: ch3((oh)2(nh3)2)5 has empirical formulae c1 h43 o2 n10 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com.

Re: [algogeeks] Re: Amazon question.

2011-08-10 Thread ankit sambyal
@kunal, anuj : step 2 of my algo takes O(n^2). So how can the TC be O(nlogn) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to

Re: [algogeeks] Re: Amazon question.

2011-08-10 Thread Kunal Patil
@Ankit: Ohh Sorry..I didnt actually read the question properly.. I didnt see we have to check for sum which must be another element in the array not some user provided constant value..I mis-understood it with sum upto k problem which can be solved on sorted array in O(n)... thats why gave a wrong

Re: [algogeeks] aptitude

2011-08-10 Thread Shashank Jain
what's the book name plz? Shashank Jain IIIrd year Computer Engineering Delhi College of Engineering On Wed, Aug 10, 2011 at 6:41 PM, Pratz mary pratima.m...@gmail.com wrote: rs aggarwal On 10 August 2011 18:32, Shashank Jain shashan...@gmail.com wrote: what is the best book for

[algogeeks] Re: thought works questions

2011-08-10 Thread keerthana
Hi reynald can u plz post the questions u got.. On Aug 4, 6:17 am, Reynald Suz reynaldsus...@gmail.com wrote: Thank you so much! Thoughtworks is visiting our campus on Aug-8, I'll send you questions for sure. On Wed, Aug 3, 2011 at 11:14 PM, coder dumca coder.du...@gmail.com wrote:

Re: [algogeeks] aptitude

2011-08-10 Thread rajoo king without sing
**http://www.jbigdeal.com/2010/08/r-s-agarwal-quantitative-aptitude-e.htmlQuantitative Apptitude By R S Agarwal On Wed, Aug 10, 2011 at 10:49 PM, Shashank Jain shashan...@gmail.comwrote: what's the book name plz? Shashank Jain IIIrd year Computer Engineering Delhi College of Engineering

[algogeeks] c output

2011-08-10 Thread rohit
main() { int m,n; m=3+max(2,3); n=2*max(3,2); printf(“%d,%d”,m,n); } ans:-m=2,n=3 why output is this??? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this

Re: [algogeeks] c output

2011-08-10 Thread aditi garg
this ques has been answered be4 on this grp...and u missed the macro definition as welljst a few days bak...search the group On Wed, Aug 10, 2011 at 11:00 PM, rohit rajuljain...@gmail.com wrote: main() { int m,n; m=3+max(2,3); n=2*max(3,2); printf(“%d,%d”,m,n); } ans:-m=2,n=3 why

[algogeeks] Re: EMC question paper pattern

2011-08-10 Thread htross
is your interview over??? On Aug 9, 11:31 pm, nandy nandhini.scor...@gmail.com wrote: Hi all,does anyone know EMC software's(bangalore) written pattern?is it purely technical..if so can anyone tell me the areas to concentrate on? -- You received this message because you are subscribed to the

Re: [algogeeks] aptitude

2011-08-10 Thread sukran dhawan
is it sufficient or do we need to refer to any other books? On Wed, Aug 10, 2011 at 10:59 PM, rajoo king without sing rajoo...@gmail.com wrote: **http://www.jbigdeal.com/2010/08/r-s-agarwal-quantitative-aptitude-e.htmlQuantitative Apptitude By R S Agarwal On Wed, Aug 10, 2011 at 10:49 PM,

Re: [algogeeks] Re: puzzle

2011-08-10 Thread $hr! k@nth
Tie the rope at the top of the tower Climb down with the help of the rope up to 100 mt peg possItion Tie the rope to that peg, Climb up to the top of the tower with that rope. Now release the rope at the top and hold it. It ll take you down.:P On Wed, Aug 10, 2011 at 7:49 PM, varun pahwa

[algogeeks] Problems on Linked List

2011-08-10 Thread Piyush Kapoor
Q1)Two linked Lists are given,i.e,their head pointers are given,and the problem is to check if the second one is reverse of the first one.Give the most efficient algo for it. Q2)A linked list is given,and one of its nodes is given.The problem is to delete the given node from the linked list.(The

Re: [algogeeks] Problems on Linked List

2011-08-10 Thread Naveen Kumar
for first reverse one of the link list by changing the pointer and than traverse one from backward and compare it the the other. for second. keep copying data from the next node to the node to be delete and remove the tail. This will not work if node to be deleted is the last node. On Wed, Aug

Re: [algogeeks] Problems on Linked List

2011-08-10 Thread Piyush Kapoor
@naveen for the first one,how will u traverse the list backwards.. I didnt understand your second solution,since the head is not given so how can u go from a node to the node to be deleted.. I forgot that in the first one,we are not allowed to use extra memory. Also do please mention the time

[algogeeks] goldman sachs paper

2011-08-10 Thread deepikaanand
can anyone please post the questions asked in goldman sachs this year -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to

Re: [algogeeks] Problems on Linked List

2011-08-10 Thread sukran dhawan
reverse the list inplace and compare the two list element by element On Thu, Aug 11, 2011 at 12:01 AM, Piyush Kapoor pkjee2...@gmail.com wrote: @naveen for the first one,how will u traverse the list backwards.. I didnt understand your second solution,since the head is not given so how can u

Re: [algogeeks] goldman sachs paper

2011-08-10 Thread Prashant Gupta
+1 to deepika. On Thu, Aug 11, 2011 at 12:10 AM, deepikaanand swinyanand...@gmail.comwrote: can anyone please post the questions asked in goldman sachs this year -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send

[algogeeks] Plz tell wat questions are asked by MICROSOFT IDC and IT both...Plz Reply fast.....anyone...!!

2011-08-10 Thread vishwan baghla
-- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/dV-k5A2L7PkJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this

Re: [algogeeks] Problems on Linked List

2011-08-10 Thread ankit sambyal
Ques 1: Let l1 and l2 be the 2 lists. Step 1 : Reverse l1 O(n) Step 2 : Compare l1 and l2 by comparing each node and traversing ahead.--O(n) Step 3: Reverse l1 -O(n) Ques 2: Let cur be the node of the linked list which is to be

Re: [algogeeks] Problems on Linked List

2011-08-10 Thread Naveen Kumar
and for second no need to delete that very node pointer, take the data of the node next to the node you want to delete and copy that to the node you want to delete, do it for all next nodes. delete the last node. On Thu, Aug 11, 2011 at 12:12 AM, sukran dhawan sukrandha...@gmail.com wrote:

Re: [algogeeks] aptitude

2011-08-10 Thread sukran dhawan
please help me ! On Wed, Aug 10, 2011 at 11:20 PM, sukran dhawan sukrandha...@gmail.comwrote: is it sufficient or do we need to refer to any other books? On Wed, Aug 10, 2011 at 10:59 PM, rajoo king without sing rajoo...@gmail.com wrote:

[algogeeks] Re: Microsoft Written Test Questions

2011-08-10 Thread vishwan baghla
hey...is your written test over...plz share the questions dude...!! plz.. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/PWtdOw902rIJ. To post to this

Re: [algogeeks] Problems on Linked List

2011-08-10 Thread siddharam suresh
1)similar to list palindrome problem(soln already there in net) 2)it has discussed 2 day before on same group. please search once Thank you, Siddharam On Thu, Aug 11, 2011 at 12:01 AM, Piyush Kapoor pkjee2...@gmail.com wrote: @naveen for the first one,how will u traverse the list backwards..

[algogeeks] Re: Microsoft Written Test Questions

2011-08-10 Thread Brijesh Upadhyay
Yeah...please share questions..it will be of a lot help! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/cs4XYfgJrooJ. To post to this group, send email to

[algogeeks]

2011-08-10 Thread sukran dhawan
how to find the mirror image of a 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to

[algogeeks] Re:

2011-08-10 Thread Avenged
It's an UNDEFINED BEHAVIOR . -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/sydSwA_UuWQJ. To post to this group, send email to algogeeks@googlegroups.com.

Re: [algogeeks]

2011-08-10 Thread Naveen Kumar
at each node swap left right pointers On Thu, Aug 11, 2011 at 12:25 AM, sukran dhawan sukrandha...@gmail.com wrote: how to find the mirror image of a binary tree ? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

Re: [algogeeks] Problems on Linked List

2011-08-10 Thread Piyush Kapoor
thanks all On Thu, Aug 11, 2011 at 12:21 AM, siddharam suresh siddharam@gmail.comwrote: 1)similar to list palindrome problem(soln already there in net) 2)it has discussed 2 day before on same group. please search once Thank you, Siddharam On Thu, Aug 11, 2011 at 12:01 AM, Piyush

Re: [algogeeks] Write a program to find the empirical formulae from physical formulae

2011-08-10 Thread Prakash D
i think the given formula's solution should be c1 h33 o20 n10 check the question.. On Wed, Aug 10, 2011 at 9:49 PM, vikas mehta...@gmail.com wrote: Write a program to find the empirical formulae from physical formulae ex: ch3((oh)2(nh3)2)5 has empirical formulae c1 h43 o2 n10 -- You

Re: [algogeeks] goldman sachs paper

2011-08-10 Thread Prakash D
+1.. it'll be helpful On Thu, Aug 11, 2011 at 12:12 AM, Prashant Gupta prashantatn...@gmail.comwrote: +1 to deepika. On Thu, Aug 11, 2011 at 12:10 AM, deepikaanand swinyanand...@gmail.comwrote: can anyone please post the questions asked in goldman sachs this year -- You received this

Re: [algogeeks]

2011-08-10 Thread Raju Yadav
void mirror(struct node* node) { if (node==NULL) { return; } else { struct node* temp; mirror(node-left); mirror(node-right); temp = node-left; node-left = node-right; node-right = temp; } } -- You received this message because you are subscribed to the

Re: [algogeeks] Problems on Linked List

2011-08-10 Thread aditya kumar
1)for the fst one you dont have to reverse the linked list just traverse the linked list recursively and read it from back . correct me if m wrong ! On Thu, Aug 11, 2011 at 12:41 AM, Piyush Kapoor pkjee2...@gmail.com wrote: thanks all On Thu, Aug 11, 2011 at 12:21 AM, siddharam suresh

  1   2   >