Re: [algogeeks] output of the program with explanation

2012-11-05 Thread rahul patil
...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards, Rahul Patil -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks

Re: [algogeeks] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-14 Thread rahul patil
/group/algogeeks?hl=en. -- Regards, Rahul Patil -- 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

Re: [algogeeks] amazon

2012-05-29 Thread rahul patil
, Rahul Patil -- 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, visit

Re: [algogeeks] Maximize XOR

2012-02-24 Thread rahul patil
email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards, Rahul Patil -- You received this message because you are subscribed

Re: [algogeeks] Re: String passing

2012-01-04 Thread rahul patil
, Rahul Patil -- 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, visit

Re: [algogeeks] Re: check Similar array

2012-01-03 Thread rahul patil
+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards, Rahul Patil -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks

Re: [algogeeks] Re: check Similar array

2012-01-03 Thread rahul patil
@samm: Rather than adding numbers could we add squares(or cube) of numbers which could also be done in linear time? On Wed, Jan 4, 2012 at 10:56 AM, rahul patil rahul.deshmukhpa...@gmail.comwrote: @samm: Ur solution is great. It could be used to tell that arrays are not similar, in linear time

Re: [algogeeks] Does anyone know the written pattern of Amazon??

2011-11-09 Thread rahul patil
, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards, Rahul Patil -- 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

Re: [algogeeks] Reconstruct BST from preorder traversal

2011-10-18 Thread rahul patil
://groups.google.com/group/algogeeks?hl=en. -- Regards, Rahul Patil -- 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: [algogeeks] Re: print vertical sums of a binary tree

2011-10-18 Thread rahul patil
from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards, Rahul Patil -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

Re: [algogeeks] Reconstruct BST from preorder traversal

2011-10-18 Thread rahul patil
. 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards, Rahul Patil -- You received this message

Re: [algogeeks] Re: print vertical sums of a binary tree

2011-10-18 Thread rahul patil
On Tue, Oct 18, 2011 at 6:31 PM, rahul patil rahul.deshmukhpa...@gmail.comwrote: Use recursion with the code as follows sum array of sums, with horizontal levels, level 0 is for leftmost element void add(node *root, int *sum, int level) { if(root-left

Re: [algogeeks] Amazon Question - Find Pythagorean triplet in an unsorted array

2011-10-14 Thread rahul patil
email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards, Rahul Patil -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send

Re: [algogeeks] Amazon Question - Find Pythagorean triplet in an unsorted array

2011-10-14 Thread rahul patil
... On Fri, Oct 14, 2011 at 2:35 PM, rahul patil rahul.deshmukhpa...@gmail.com wrote: You can take advantage of a basic property of triagle that sum of largest side of triangle sum of other two sides, After sorting you could easily deside the range in which possible solution could be found

Re: [algogeeks] Re: amazon,microsoft link list probs

2011-10-10 Thread rahul patil
://groups.google.com/group/algogeeks?hl=en. -- Regards, Rahul Patil -- 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

Re: [algogeeks] Efficient Way to Detect Duplicate Document

2011-05-08 Thread rahul patil
. 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, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards, Rahul Patil -- You received

Re: [algogeeks] Re: Interview question amazon

2011-01-03 Thread rahul patil
to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards, Rahul Patil -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] Re: Interview question amazon

2011-01-03 Thread rahul patil
On Tue, Jan 4, 2011 at 8:13 AM, rahul patil rahul.deshmukhpa...@gmail.comwrote: On Mon, Jan 3, 2011 at 6:08 PM, juver++ avpostni...@gmail.com wrote: Tree structure already have parent node link. Even we reconstruct the tree as linked list we are not allowed to achieve Normal tree node

Re: [algogeeks] Divide an array into two equal subsets

2011-01-03 Thread rahul patil
...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards, Rahul Patil -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send

Re: [algogeeks] Re: Interview question amazon

2011-01-02 Thread rahul patil
. -- Regards, Rahul Patil -- 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] for loop performace in terms of speed makes any difference when we run from max to min and min to max

2010-11-22 Thread rahul patil
, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards, Rahul Patil -- You

Re: [algogeeks] matrix [MS]

2010-10-27 Thread rahul patil
...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards, Rahul Patil -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email

Re: [algogeeks] Yahoo coding round question

2010-10-20 Thread rahul patil
, -3 , 2 , 105, 13 code will fail sum[j] += A[ i] product[j] *= A [ i] } for( k=0 to k= i ) if ( sum[k] == S and product[k] == P ) { Answer is the sub array A[k to i ] break } } Kishen On Tue, Oct 19, 2010 at 11:36 AM, abhishek singh iiita2007...@gmail.comwrote: @ Rahul patil

Re: [algogeeks] Yahoo coding round question

2010-10-19 Thread rahul patil
. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards, Rahul Patil -- 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] Multiplication of two numbers

2010-09-20 Thread rahul patil
is 3 digit. On Mon, Sep 20, 2010 at 10:50 AM, rahul patil rahul.deshmukhpa...@gmail.com wrote: A partial solution is , if you multiply first digits of two nos and result is greater than 10 then surely result will be a+b digits If not, according to me, u will need a complex logic to solve

Re: [algogeeks] Multiplication of two numbers

2010-09-19 Thread rahul patil
/algogeeks?hl=en. -- Regards, Rahul Patil -- 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

Re: [algogeeks] Re: Amazon Question make confused !!!!!!!

2010-09-15 Thread rahul patil
to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards, Rahul

Re: [algogeeks] Re: how we can access 2nd element of an struct

2010-09-09 Thread rahul patil
to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards, Rahul Patil -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] Re: Maximum of N numbers

2010-09-06 Thread rahul patil
this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards, Rahul Patil -- 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

Re: [algogeeks] Re: Adobe Question : Convert a number given in base B1 to a number in base B2 without using any intermediate base

2010-08-30 Thread rahul patil
, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards, Rahul Patil -- 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

Re: [algogeeks] Modified subset-sum problem

2010-08-30 Thread rahul patil
...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards, Rahul Patil -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email

[algogeeks] Re: Amazon interview Question (Array yet again!)

2010-08-29 Thread rahul patil
check out this solution.I think this works correct will explain logic if u find it correct. #include stdio.h #define SIZE 4 int result[SIZE]; int final_cost = 10; int curr_ans[SIZE]; void save_arr(int *result) { int i; for (i=0 ;iSIZE ;i++) { curr_ans[i] = result[i]; } } void

Re: [algogeeks] Re: Amazon interview Question (Array yet again!)

2010-08-29 Thread rahul patil
); print_ans(); return 0; } On Sun, Aug 29, 2010 at 2:18 PM, jagadish jagadish1...@gmail.com wrote: @Rahul Patil: I ran your code on some basic test cases and i found it to be correct! Can you please explain the logic you used to arrive at the solution? Thanks :-) On Aug 29, 12:25 pm, rahul

[algogeeks] Re: Adobe Question : Convert a number given in base B1 to a number in base B2 without using any intermediate base

2010-08-28 Thread rahul patil
Check out my solution. Hope u are looking for this, Take a no 136 (base7 = 76 decimal ) convert to base 5 (ans shld be 301) start from left side 1*7^2= 49/5^2 = 1 (rem 24)- | ^ 10 3*7 + 24 = 45 /5 = 19 (rem 0)

[algogeeks] Re: Longest SubSequence with Sum K

2010-08-28 Thread rahul patil
Is it required that sub array must be continuous. On Aug 18, 12:34 pm, Amit Jaspal amitjaspal...@gmail.com wrote: You have to return the length of the subsequence with longest length and sum K . If there are multiple solutions report anyone. On Wed, Aug 18, 2010 at 12:40 PM, srinivas reddy

[algogeeks] Re: How to find two missing numbers from an unsorted continuous natural numbers array [only use O(1) space and O(n) time]

2010-08-20 Thread rahul patil
do we know the range of nos in array? is it possible that negative nos are in array? On Aug 12, 6:50 pm, Dave dave_and_da...@juno.com wrote: @ashish. The product will overflow for even moderate n, so instead, form the sum and the sum of the squares of the numbers. If a and b are the missing

[algogeeks] Re: Median of two arrays..

2010-08-11 Thread rahul patil
is there any time complexity? the also can be like this char *res; char *ptr1 =arr1; char *ptr2 =arr2; int count =0, n= len(arr1) ,m=len(arr2); while(1){ while(*ptr1 *ptr2){ ptr2++; count ++; if( count == (n+m)/2 ){

[algogeeks] Re: Generate a number

2010-07-31 Thread rahul patil
can u give example? is it like that for 3 , a no which is made of 1st ,2nd and 3rd digit should be divisible by 3 or individual all three digits must be divisible by 3? A 2nd case seems impossible. On Jul 30, 9:12 am, Shiv ... shivsinha2...@gmail.com wrote: If space is not a restriction-

[algogeeks] Re: BST

2010-07-26 Thread rahul patil
@ Gene Your solution seems great and most appropriate one. Just need to create threads in BST first.What will be time complexity for that? On Jul 25, 11:08 pm, Gene gene.ress...@gmail.com wrote: You'd know how to do this if you had a sorted array A, right?  Start a pointer at each end. Call the

[algogeeks] Re: BST

2010-07-25 Thread rahul patil
It is simple to convert BST to sorted doubly link list Just do inorder_traverse and add node into the linklist. It is like following. linklist_node *head=NULL; mod_in_order(tree_node *root){ tree_node *temp; temp=root; if (root is a leaf node)

[algogeeks] Re: BST

2010-07-24 Thread rahul patil
1 convert the BST into a sorted doubly linklist.(increasing order) It will take O(n) time. 2 Now find two nodes in a link list whose sum is k(given no) to find sum in linklist. take two pointers ptr1= head ptr2=tail of linlist. now find sum of ptr1-data + ptr2- data while(ptr1-data ptr2-