Re: [algogeeks] Entryinto elite companies

2010-07-21 Thread Manjunath Manohar
@sharad...well said :) -- 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 more options,

Re: [algogeeks] pointer and array

2010-07-24 Thread Manjunath Manohar
when arrays are passed as arguments to a function,the starting address of the array is passed like a pointer, thus sizeof(arr)=2..thus 2/2=1..this is the precise reason for always specifying the column length in the definition of function when functions have arrays as one of the arguments.. Hope

Re: [algogeeks] pointer and array

2010-07-24 Thread Manjunath Manohar
@Apporve... yeah u r right :)sizeof ptr is always 2 in 16 bit compilers, i.e, the sizeof an address is 2.and the sizeof(int)=2..i.e sizeof(*arr)=2..hope u got it now.. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send

Re: [algogeeks] Re: unset leftmost bit

2010-07-25 Thread Manjunath Manohar
will this work... int x= 127; //in binary it is interpreted with MSB set to 0.. and all other bits to 1 temp=xinput; temp will have the MSB unset.. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] Re: unset leftmost bit

2010-07-25 Thread Manjunath Manohar
@amir hossein... Can u pls elaborate on the binary search...i donot have that much of a knowledge about hexadecimal representation of numbers..kindly pls help me.. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send

Re: [algogeeks] Find The Kth min in a binary search tree

2010-07-25 Thread Manjunath Manohar
void kthsmallest(Tree *node,int k) { static int count=0; if(node!=NULL count!=k) { kthsmallest(node-left); printf(\nKth Smallest - - %d\n,node-data); kthsmallest(node-right); } } -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Re: Merging of Binary trees

2010-07-26 Thread Manjunath Manohar
no just a BT, the tree can be in any form..it need not be balanced also.. -- 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

Re: [algogeeks] Re: Merging of Binary trees

2010-07-26 Thread Manjunath Manohar
@jalaj: could u pls elaborate on that a bit more..will it have the complexity of O(n logn logn), and also can u provide the pseudocode pls.. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] Re: Merging of Binary trees

2010-07-26 Thread Manjunath Manohar
@jalaj..thanks for ur help..really appreciate it.. :) -- 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

Re: [algogeeks] Re: Merging of Binary trees

2010-07-26 Thread Manjunath Manohar
@ashish..nice code..i think the complexity is O(n logn ) right.. am i right?? -- 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

Re: [algogeeks] algorithm

2010-07-26 Thread Manjunath Manohar
@Anand...for better efficiency..we can find the pivot as a random integer..for better worst case complexity.. -- 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

Re: [algogeeks] Re: Oracle-Java Developer interview question

2010-07-29 Thread Manjunath Manohar
do the level order traversal of the binary tree and keep the count of the stack...thats 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

Re: [algogeeks] Re: number of BST's

2010-07-31 Thread Manjunath Manohar
the number of unique binary trees which can be formed with n nodes is (2^n)-n -- 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

Re: [algogeeks]

2010-07-31 Thread Manjunath Manohar
find the middle of the list and make it as the root..thus i this maner u will get a balanced 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

Re: [algogeeks] Re: number of BST's

2010-08-01 Thread Manjunath Manohar
int count(int node) { int sum=0;i,left,right; for(i=0;inode;i++) { left=count(node-1); right=count(node-i); sum+=left*right; } return(sum); } -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

Re: [algogeeks] Find the duplicate

2010-08-05 Thread Manjunath Manohar
consider the test case of... 1 2 3 1... 1 repeated n/2 times and 2,3 are distinct n/2 elements for this the algo will not work -- 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.

Re: [algogeeks] Re: BST Problem

2010-08-06 Thread Manjunath Manohar
the solution elegant..but is there any on the fly method by just exploiting the BST propertyby using left and right pointers -- 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.

Re: [algogeeks] Find the duplicate

2010-08-06 Thread Manjunath Manohar
no the array is unsorted.. On Thu, Aug 5, 2010 at 9:29 PM, dinesh bansal bansal...@gmail.com wrote: If I understand the question correctly... there is an array of size n which has n/2 distinct elements and one element is repeated n/2 times. For e.g.: n = 4: 1 2 3 3 n = 61 2 3 4

Re: [algogeeks] Re: Median of two arrays..

2010-08-06 Thread Manjunath Manohar
will this work in two sorted arrays of equal length.. -- 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

Re: [algogeeks] Find the duplicate

2010-08-06 Thread Manjunath Manohar
hi anand.. can u write up a pseudocode of ur algorithm using XOR logic -- 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

Re: [algogeeks] Find the duplicate

2010-08-06 Thread Manjunath Manohar
i kinda understood ...u are doing xor on the array twice..but it dint seem to work for the array..{2,1,3,2} please elaborate ur code... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] Find the duplicate

2010-08-06 Thread Manjunath Manohar
The thread is waiting for u anand :)..reply soon -- 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

Re: [algogeeks] amezan interview.........

2010-08-06 Thread Manjunath Manohar
where is it amit... could u pls post the link pls.. -- 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

Re: [algogeeks] BST Problem

2010-08-07 Thread Manjunath Manohar
@priyanka i agree with u... but wat i thot was if v had a tree with parent pointers...we can have one pointer at the left most and another at the rightmost subtree respectivelyand move along the pointers.. I need ur discussion on thisi think the implementation wud be

Re: [algogeeks] Re: Modified Binary Search

2010-08-08 Thread Manjunath Manohar
hey wait a sec,.. we wont be given the k value.. -- 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

Re: [algogeeks] Re: Addition Of numbers in SLL

2010-08-14 Thread Manjunath Manohar
Reversing and then again reversing the answer will not be an efficient algorithm... on the fly computation of sum must be done...any ideas On 8/14/10, Rahul Singhal nitk.ra...@gmail.com wrote: I men to say ki just traverse from last instead of reversing it and storing result in a stack in

Re: [algogeeks] Re: Addition Of numbers in SLL

2010-08-15 Thread Manjunath Manohar
@Dave..Can u provide a small snippet for ur explanation pls.. -- 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

Re: [algogeeks] Re: BFS

2010-08-17 Thread Manjunath Manohar
Tree *node for(i=1;i=height;i++) { levelorder(node,i); } void levelorder(Tree *node,int level) { if(level==1) printf(node-value); else levelorder(node-left,level-1) levelorder(node-right,level-1); } -- You received this message because you are subscribed to the Google

Re: [algogeeks] Cube root of a number

2010-08-22 Thread Manjunath Manohar
@apporve ..can u pls elaborate on that ..also on the square root of a number.. -- 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

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

2010-08-22 Thread Manjunath Manohar
can anyone say how to calculate the complexity of a recurrence relation -- 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

Re: [algogeeks] Re: To sort an array of 0,1,2

2010-08-23 Thread Manjunath Manohar
is it possible to do without any extra space... -- 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

Re: [algogeeks] Re: To sort an array of 0,1,2

2010-08-23 Thread Manjunath Manohar
@sathiah..i can get u ..but dont seem to understand the part where in we must keep track of the 1's...can u pls post the code.. -- 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

Re: [algogeeks] Re: Will miracle ever print ?

2010-08-29 Thread Manjunath Manohar
it will never print..and @ above..the != will never be evaluated ..because of the short circuiting -- 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

Re: [algogeeks] evaluate expression

2010-08-29 Thread Manjunath Manohar
the running time of the algo would be exponential.you need to permute the array with different combinations of the operators.. i can help you with the code for permuting an array.. i hope u get my point.. -- You received this message because you are subscribed to the Google Groups Algorithm

Re: [algogeeks] Help with Increment Operators in C!

2010-08-29 Thread Manjunath Manohar
it is compiler dependant da..the evaluation of this kind of expressions -- 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

Re: [algogeeks] Modified subset-sum problem

2010-08-30 Thread Manjunath Manohar
@rahul...well i thought..we must employ backtracking..can u pls suggest a recurrence relation for ur DP -- 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

Re: [algogeeks] Re: find duplicate and missing element

2010-09-02 Thread Manjunath Manohar
this question can be sovled very easily 1.jus sum the given array...x 2.sum the squares of the given array..y 3.now use the AP.n(n+1)/2..for n=100 4.similarly compute n(n+1)(2n+1)/6 for n =100.. Now solve these eqns ...u get the missing and the dupicate.. -- You received this message

Re: [algogeeks] Re: Amazon intern Question

2010-09-02 Thread Manjunath Manohar
trie will be the best choice for this.. -- 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] Enigma - Online Puzzle championship

2011-01-02 Thread Manjunath Manohar
Hi Enigma - Online puzzle championship organised by Kurukshetra, international tech fest of anna university under the patronage of UNESCO. So what u guys waiting for, exciting prizes are awaiting you. www.enigma.kurukshetra.org.in Regards, Enigma Team +91 9940014458 -- You received this