[algogeeks] Amazon Interview Q

2011-08-17 Thread Piyush Sinha
We all knw hw to find a loop in a singly linked list (Using hare and tortoise method)..what if the linked list is a doubly linked list?can we do it smthn better than hare n tortoise method using the advantage of the doubly linked list? -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * https

Re: [algogeeks] Re: Facebook Interview question at NIT Warangal

2011-07-28 Thread Piyush Sinha
to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * https://www.facebook.com/profile.php?id=10655377926 NEVER SAY NEVER * -- You received this message because you

Re: [algogeeks] Array question

2011-07-26 Thread Piyush Sinha
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 this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha

Re: [algogeeks] Array question

2011-07-26 Thread Piyush Sinha
Sorry for the above mistakeits not O(n) On Tue, Jul 26, 2011 at 5:29 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: Use stack On Tue, Jul 26, 2011 at 5:22 PM, Shikhar shikharko...@gmail.com wrote: Given an array of integers, for each element of the array, print the first number

Re: [algogeeks] Re: Array question

2011-07-26 Thread Piyush Sinha
the loop in step 2 is over, pop all the elements from stack and print -1 as next element for them. -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * https://www.facebook.com/profile.php?id=10655377926 NEVER SAY NEVER * -- You received this message because you are subscribed to the Google

[algogeeks] AMAZON Q

2011-07-26 Thread Piyush Sinha
You have an array like ar[]= {1,3,2,4,5,4,2}. You need to create another array ar_low[] such that ar_low[i] = number of elements lower than or equal to ar[i] in ar[i+1:n-1]. So the output of above should be {0,2,1,2,2,1,0} Time complexity : O(nlogn) use of extra space allowed. -- *Piyush Sinha

Re: [algogeeks] plzz explain

2011-07-26 Thread Piyush Sinha
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 this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT

Re: [algogeeks] Adove Question.........

2011-07-22 Thread Piyush Sinha
++; } else if (indr) { for(i=j;in;i++) { swap(a[i],a[j]); subset(a,n,r,j+1,ind+1); swap(a[i],a[j]); } } }* -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * https://www.facebook.com/profile.php?id=10655377926 NEVER SAY

Re: [algogeeks] Adobe ques

2011-07-21 Thread Piyush Sinha
http://www.ideone.com/4Rq51 -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * https://www.facebook.com/profile.php?id=10655377926 NEVER SAY NEVER * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email

[algogeeks] TREES

2011-07-21 Thread Piyush Sinha
*A preorder of a complete binary tree is given in an array , prints its level order * -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * https://www.facebook.com/profile.php?id=10655377926 NEVER SAY NEVER * -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Re: Solve it

2011-07-20 Thread Piyush Sinha
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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * https://www.facebook.com/profile.php?id

Re: [algogeeks] Re: Circle Circle more Circles .........

2011-07-20 Thread Piyush Sinha
. 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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727

Re: [algogeeks] Re: Circle Circle more Circles .........

2011-07-20 Thread Piyush Sinha
will find the areas. But this area would be different than the actual area for intersection of A,B,C. On Jul 20, 3:48 pm, Piyush Sinha ecstasy.piy...@gmail.com wrote: I would like to redefine my algo with cases clarified... Create a queue that is made to contain the points... say points

Re: [algogeeks] Adobe ques

2011-07-20 Thread Piyush Sinha
this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * https://www.facebook.com/profile.php?id=10655377926 NEVER SAY NEVER * -- You

Re: [algogeeks] Microsoft Question!

2011-07-20 Thread Piyush Sinha
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 this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha

Re: [algogeeks] Memory Allocation

2011-07-19 Thread Piyush Sinha
of the character array, unlike as wat you were doing previously(previously you were trying to return a block of memory) Hope it is clear now... :) -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * https://www.facebook.com/profile.php?id=10655377926 NEVER SAY NEVER * -- You received this message

Re: [algogeeks] INFINITY

2011-07-19 Thread Piyush Sinha
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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * https://www.facebook.com/profile.php?id

Re: [algogeeks] Re: INFINITY

2011-07-19 Thread Piyush Sinha
In Dev C it does On Tue, Jul 19, 2011 at 3:08 PM, SAMMM somnath.nit...@gmail.com wrote: It doesn't display the infinity symbol. On Jul 19, 2:24 pm, Piyush Sinha ecstasy.piy...@gmail.com wrote: *printf(%c\n,236);* On Tue, Jul 19, 2011 at 2:45 PM, SAMMM somnath.nit...@gmail.com wrote

Re: [algogeeks] Re: amazon

2011-07-19 Thread Piyush Sinha
++) { (i%n==1) mid = mid-next; } m--; if(m==0) return mid; else mid = mid-next; p = head-next; } }* -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * https://www.facebook.com/profile.php?id=10655377926

Re: [algogeeks] Re: amazon

2011-07-19 Thread Piyush Sinha
of a node... -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * https://www.facebook.com/profile.php?id=10655377926 NEVER SAY NEVER * -- 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] Solve it

2011-07-19 Thread Piyush Sinha
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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * https://www.facebook.com

Re: [algogeeks] Solve it

2011-07-19 Thread Piyush Sinha
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 this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91

Re: [algogeeks] MS

2011-07-19 Thread Piyush Sinha
?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * https://www.facebook.com/profile.php?id=10655377926 NEVER SAY NEVER * -- 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 ques

2011-07-19 Thread Piyush Sinha
://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * https://www.facebook.com/profile.php?id=10655377926 NEVER SAY NEVER * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send

Re: [algogeeks] Re: Circle Circle more Circles .........

2011-07-19 Thread Piyush Sinha
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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * https://www.facebook.com

Re: [algogeeks] MICROSOFT

2011-07-17 Thread Piyush Sinha
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 this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha

Re: [algogeeks] MICROSOFT

2011-07-17 Thread Piyush Sinha
of notepad 3.Design Big Int class in C or c++ On Sun, Jul 17, 2011 at 5:14 PM, Harshal hc4...@gmail.com wrote: @manish, can you please tell other questions asked by ms today? On Sun, Jul 17, 2011 at 4:53 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: It can be done using one extra array only

Re: [algogeeks] MICROSOFT

2011-07-17 Thread Piyush Sinha
://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * https://www.facebook.com/profile.php?id=10655377926 NEVER SAY NEVER * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

Re: [algogeeks] MS Ques

2011-07-17 Thread Piyush Sinha
this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * https://www.facebook.com/profile.php?id=10655377926 NEVER SAY NEVER * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

Re: [algogeeks] C output problem

2011-07-17 Thread Piyush Sinha
main function *printf(piyush,sinha); *It wil compile and run successfully...and u can guess the output too :) * * On Mon, Jul 18, 2011 at 2:19 AM, aditi garg aditi.garg.6...@gmail.comwrote: #includestdio.h #define FUN(arg) do\ {\ if(arg

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

2011-07-13 Thread Piyush Sinha
. 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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * https://www.facebook.com/profile.php?id=10655377926 NEVER SAY NEVER

Re: [algogeeks] c code bst mirror prob

2011-07-13 Thread Piyush Sinha
. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-7483122727* * https://www.facebook.com/profile.php?id=10655377926 NEVER SAY NEVER * -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] MS: BST

2011-07-11 Thread Piyush Sinha
/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- 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: GOOGLE Q

2011-07-11 Thread Piyush Sinha
...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed

Re: [algogeeks] MS: BST

2011-07-11 Thread Piyush Sinha
) return 0; else if(c1-data+c2-data key) return 1; else return -1; }* -- *Piyush Sinha* *IIIT, Allahabad* ** *+91-7483122727* *Never say NEVER https://www.facebook.com/profile.php?id=10655377926* -- You received this message because you are subscribed

Re: [algogeeks] MS: BST

2011-07-11 Thread Piyush Sinha
for the mistake..i will submit the modification asap.. On 7/11/11, aanchal goyal goyal.aanch...@gmail.com wrote: @Piyush.. I tried your algo on BST {5,4,6,3,2,1,8,7,10,12,9,11}. Its only returning 1+7. Other pairs are 5+3, 6+2. On Mon, Jul 11, 2011 at 6:56 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote

Re: [algogeeks] MS: BST

2011-07-11 Thread Piyush Sinha
--; } } } } //final correction of the links can be done again } int checksum ( node *c1,node *c2,int key) { if(c1-data+c2-data == key) return 0; else if(c1-data+c2-data key) return 1; else return -1; }* -- *Piyush

Re: [algogeeks] Re: Yahoo Question

2011-07-10 Thread Piyush Sinha
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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com

[algogeeks] BIT MANIPULATION

2011-07-09 Thread Piyush Sinha
(11) then your function should return 5(101) -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group

Re: [algogeeks] Re: BIT MANIPULATION

2011-07-09 Thread Piyush Sinha
@Dave..canu u explain ur algo to approach this formula?? On 7/10/11, Dave dave_and_da...@juno.com wrote: @Piyush: See http://groups.google.com/group/algogeeks/msg/2b64c4f96fa3598e for a one-line algorithm. Dave On Jul 9, 4:23 am, Piyush Sinha ecstasy.piy...@gmail.com wrote: I found a good

Re: [algogeeks] find the integer

2011-07-08 Thread Piyush Sinha
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 this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha

Re: [algogeeks] Re: find the integer

2011-07-08 Thread Piyush Sinha
options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm

[algogeeks] GOOGLE Q

2011-07-08 Thread Piyush Sinha
) algorithm. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- 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] Reversing the order of words in String

2011-07-07 Thread Piyush Sinha
you elaborate your approach with Linked List? From what i am getting, even with Linked List, you would need two traversals at least. On Thu, Jul 7, 2011 at 2:07 AM, Piyush Sinha ecstasy.piy...@gmail.com wrote: Can we do it using linked list if ONE TIME TRAVERSAL is a constraint?? On 7/6

Re: [algogeeks] Amazon

2011-07-07 Thread Piyush Sinha
@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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php

Re: [algogeeks] Amazon

2011-07-07 Thread Piyush Sinha
But the problem arises in setting the order On Thu, Jul 7, 2011 at 2:06 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: I think for initial start it should be the minimum n values for n milestones On Thu, Jul 7, 2011 at 1:53 PM, Akshata Sharma akshatasharm

[algogeeks] GOOGLE Q1

2011-07-07 Thread Piyush Sinha
if Sj+1 – Sj is a constant. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email

[algogeeks] GOOGLE Q2

2011-07-07 Thread Piyush Sinha
at index i in the data structure. * Get(i) – Gets the item stored in index i (or 'empty' if nothing is there). Remark: the data structure should use O(n) space. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You

Re: [algogeeks] Merging Sorted Arrays

2011-07-07 Thread Piyush Sinha
...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google

Re: [algogeeks] GOOGLE Q3

2011-07-07 Thread Piyush Sinha
==3 or count==2,then put in one group The same procedure for good and usual accord to constraints . On Thu, Jul 7, 2011 at 11:46 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: You are given a String number containing the digits of a phone number (the number of digits, n, can be any

Re: [algogeeks] GOOGLE Q1

2011-07-07 Thread Piyush Sinha
. then keep a count for all the repeated diff elements ,the sequence of indexes with max count is the solution . On Thu, Jul 7, 2011 at 11:43 PM, Piyush Sinha ecstasy.piy...@gmail.com wrote: Given an array of integers A, give an algorithm to find the longest Arithmetic progression in it, i.e

Re: [algogeeks] Merging Sorted Arrays

2011-07-07 Thread Piyush Sinha
of first array Find the first N smallest elements using one pointer in each array now swap the list of elements from index 0 to second-pointer in second array to first array with first_poiner+1 to N in first Array I think this is O(n) On Thu, Jul 7, 2011 at 12:53 PM, Piyush Sinha ecstasy.piy

Re: [algogeeks] GOOGLE Q3

2011-07-07 Thread Piyush Sinha
that in usual group quality =2*1 =2 , On Fri, Jul 8, 2011 at 1:28 AM, Piyush Sinha ecstasy.piy...@gmail.comwrote: @Rajeev...check ur logic for 4 On 7/8/11, rajeev bharshetty rajeevr...@gmail.com wrote: So, I think first check for excellent groups then good and then usual to increase

Re: [algogeeks] GOOGLE Q3

2011-07-07 Thread Piyush Sinha
sorry a typing mistake...lst line contains only 4 On 7/8/11, Piyush Sinha ecstasy.piy...@gmail.com wrote: @Rajeev..there is the fault.for 4, there can be 2 excellent groups.. 55 55 54 therefore, quality = 2*2 = 4 which is highest... On 7/8/11, rajeev bharshetty rajeevr

Re: [algogeeks] GOOGLE Q3

2011-07-07 Thread Piyush Sinha
@Rajeev...ignore my previous two posts. the grouping can be done as 55 554 quality is 2*1+1 = 3 which is the highest On 7/8/11, Piyush Sinha ecstasy.piy...@gmail.com wrote: sorry a typing mistake...lst line contains only 4 On 7/8/11, Piyush Sinha ecstasy.piy...@gmail.com wrote: @Rajeev

Re: [algogeeks] GOOGLE Q3

2011-07-07 Thread Piyush Sinha
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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https

Re: [algogeeks] GOOGLE Q3

2011-07-07 Thread Piyush Sinha
Can u explain ur algo too?? On 7/8/11, Piyush Sinha ecstasy.piy...@gmail.com wrote: @Sunny...nice solution but ur solution works if there can 1 to 3 groups of digits..but in the question its mentioned the group should contain exactly 2 or 3 digits... but anyways nice solution...:) On 7/8

[algogeeks] NVIDIA Q

2011-07-06 Thread Piyush Sinha
What is the size of an object of a class with no members in it?? -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group

Re: [algogeeks] NVIDIA Q

2011-07-06 Thread Piyush Sinha
6, 2011 at 2:11 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: What is the size of an object of a class with no members in it?? -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message

[algogeeks]

2011-07-06 Thread Piyush Sinha
Why is it suggested not to use malloc() or calloc() in C++ for memory allocation? -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups

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

2011-07-06 Thread Piyush Sinha
://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email

Re: [algogeeks] MS Ques

2011-07-05 Thread Piyush Sinha
this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You

Re: [algogeeks] Flatten a BST to produce inorder traversal

2011-07-04 Thread Piyush Sinha
. 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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926

Re: [algogeeks] Flatten a BST to produce inorder traversal

2011-07-04 Thread Piyush Sinha
http://geeksforgeeks.org/?p=6358 On 7/4/11, Piyush Sinha ecstasy.piy...@gmail.com wrote: Use the concept used in Morris traversal (same as TBT concept)... On 7/4/11, sunny agrawal sunny816.i...@gmail.com wrote: I think Threaded Binary Tree solves your Problem see this http

Re: [algogeeks] Flatten a BST to produce inorder traversal

2011-07-04 Thread Piyush Sinha
such that once they are established, inorder traversal would be just like traversing a list. @Sunny - thanks, exactly what i was looking for On Mon, Jul 4, 2011 at 11:45 PM, Piyush Sinha ecstasy.piy...@gmail.com wrote: http://geeksforgeeks.org/?p=6358 On 7/4/11, Piyush Sinha ecstasy.piy

Re: [algogeeks] Flatten a BST to produce inorder traversal

2011-07-04 Thread Piyush Sinha
U only mentioned in ur question that we have to use next pointer to connect the nodes...while TBT used the left and right pointers On 7/5/11, Piyush Sinha ecstasy.piy...@gmail.com wrote: I know its not about the traversali just suggested that one can use the trick used by Morris traversal

Re: [algogeeks] output plzzzz

2011-07-02 Thread Piyush Sinha
. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] query

2011-06-29 Thread Piyush Sinha
email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message

Re: [algogeeks] query

2011-06-29 Thread Piyush Sinha
ya noticed just now when sunny agrawal pointed it out... On Wed, Jun 29, 2011 at 5:38 PM, oppilas . jatka.oppimi...@gmail.comwrote: Piyush the original code has double apostrophe( ' ) instead of inverted comma's. http://ideone.com/zPpGA On Wed, Jun 29, 2011 at 5:30 PM, Piyush Sinha

Re: [algogeeks] linked list

2011-06-29 Thread Piyush Sinha
@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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id

Re: [algogeeks] Binary Tree

2011-06-29 Thread Piyush Sinha
options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm

Re: [algogeeks] Amazon - max substring

2011-06-29 Thread Piyush Sinha
at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

Re: [algogeeks] Amazon - max substring

2011-06-29 Thread Piyush Sinha
I dnt think any company is gonna ask u to code suffix tree..:P :P On 6/29/11, Swathi chukka.swa...@gmail.com wrote: It does but i am asked to code.. if you know the code for suffix tree then please provide.. On Wed, Jun 29, 2011 at 10:30 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: i

Re: [algogeeks] Amazon - max substring

2011-06-29 Thread Piyush Sinha
why people reply in plain words.. I personally had this experience and i was asked to code but i couldn't On Wed, Jun 29, 2011 at 10:53 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: I dnt think any company is gonna ask u to code suffix tree..:P :P On 6/29/11, Swathi chukka.swa

Re: [algogeeks] 2 D array(dynamic allocation)

2011-06-29 Thread Piyush Sinha
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 this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush

Re: [algogeeks] 2 D array(dynamic allocation)

2011-06-29 Thread Piyush Sinha
...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed

Re: [algogeeks] Printing unique rows.

2011-06-28 Thread Piyush Sinha
this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group

Re: [algogeeks] given a bst and a value x.find pair of nodes in the tree that sum upto x

2011-06-27 Thread Piyush Sinha
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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https

Re: [algogeeks] Re: given a bst and a value x.find pair of nodes in the tree that sum upto x

2011-06-27 Thread Piyush Sinha
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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https

Re: [algogeeks] novel written test

2011-06-27 Thread Piyush Sinha
://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email

Re: [algogeeks] novel written test

2011-06-27 Thread Piyush Sinha
, Jun 28, 2011 at 2:14 AM, Piyush Sinha ecstasy.piy...@gmail.comwrote: 1,6,6 On Tue, Jun 28, 2011 at 2:07 AM, amit the cool amitthecoo...@gmail.comwrote: Conversation between two mathematicians: first : I have three children. The product of their ages is 36 . If you sum their ages

Re: [algogeeks] Queue to support insert , delete, find max in o(1)

2011-06-24 Thread Piyush Sinha
+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you

Re: [algogeeks] Re: Queue to support insert , delete, find max in o(1)

2011-06-24 Thread Piyush Sinha
as minm.. Now consider deleting 1. how will that affect the rest of the list? On Jun 24, 3:07 pm, Piyush Sinha ecstasy.piy...@gmail.com wrote: Can we use circular linked list with each new inserted node keeping track of the minimum before it?? On Fri, Jun 24, 2011 at 3:20 PM

Re: [algogeeks] Re: Sort - Consecutive Array in O(n)

2011-06-24 Thread Piyush Sinha
. 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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91

Re: [algogeeks] Question on Combination

2011-06-23 Thread Piyush Sinha
);* * }* * }* *} * *main()* *{* * int n;* * printf(enter value of n :);* * scanf(%d,n);* * printcombination(n,0,0);* *}* On Thu, Jun 23, 2011 at 11:17 AM, Piyush Sinha ecstasy.piy...@gmail.comwrote: pass one more argument to the function *int index

Re: [algogeeks] Please explain the output

2011-06-23 Thread Piyush Sinha
at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

Re: [algogeeks] c query

2011-06-23 Thread Piyush Sinha
...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google

Re: [algogeeks] c query

2011-06-23 Thread Piyush Sinha
for further details. http://en.wikipedia.org/wiki/Comma_operator On 6/23/11, Piyush Sinha ecstasy.piy...@gmail.com wrote: the comma operator evaluates its first operand and discards the result, and then evaluates the second operand and returns this value. instead of 3, whatever u write

Re: [algogeeks] c doubt again

2011-06-23 Thread Piyush Sinha
=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- 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] c query

2011-06-23 Thread Piyush Sinha
specifiers for printing?? On Thu, Jun 23, 2011 at 7:15 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: for further details. http://en.wikipedia.org/wiki/Comma_operator On 6/23/11, Piyush Sinha ecstasy.piy...@gmail.com wrote: the comma operator evaluates its first operand and discards

Re: [algogeeks] c doubt again

2011-06-23 Thread Piyush Sinha
, Anika Jain anika.jai...@gmail.com wrote: thanx .. can u explain me how this is used in finding sum of 2 vars without using + ?? On Thu, Jun 23, 2011 at 7:20 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: An asterisk indicates that the data is to be retrieved from the use but ignored, i.e

Re: [algogeeks] c doubt again

2011-06-23 Thread Piyush Sinha
...@gmail.com wrote: i mean how it working actually? On Thu, Jun 23, 2011 at 8:06 PM, Anika Jain anika.jai...@gmail.comwrote: hey ya its working :) but whats the logic behind it?? On Thu, Jun 23, 2011 at 7:52 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: sorry by mistake i added

Re: [algogeeks] c query

2011-06-23 Thread Piyush Sinha
, 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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https

Re: [algogeeks] c doubt again

2011-06-23 Thread Piyush Sinha
, rajeev bharshetty rajeevr...@gmail.comwrote: @ Piyush Could u provide the link to some source , because i am still unclear about the above concept . Regards Rajeev N B On Thu, Jun 23, 2011 at 8:32 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: there is no as such logic behind

Re: [algogeeks] Time Complexity of Merge Sort(Linked list)

2011-06-23 Thread Piyush Sinha
://groups.google.com/group/algogeeks?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send

Re: [algogeeks] Time Complexity of Merge Sort(Linked list)

2011-06-23 Thread Piyush Sinha
and the lengths is divided by two: * 4 * n/8 in the 3rd recursion depth * 8 * n/16 in the 4th recursion depth, and so on... 5. The recursion depth is log(n) and in each step we perform n/2 steps. This equals O(log(n)*n/2) On 6/24/11, Piyush Sinha ecstasy.piy...@gmail.com

Re: [algogeeks] Time Complexity of Merge Sort(Linked list)

2011-06-23 Thread Piyush Sinha
Also u can refer http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html On 6/24/11, Piyush Sinha ecstasy.piy...@gmail.com wrote: I googled a better explaination for this and found this... hope this will be useful... Sorting a LinkedList is different from sorting an Array as you

Re: [algogeeks] Google Question

2011-06-22 Thread Piyush Sinha
?hl=en. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- 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] Explain this.....

2011-06-22 Thread Piyush Sinha
. 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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657

Re: [algogeeks] Explain this.....

2011-06-22 Thread Piyush Sinha
output of *d = 99 and *c = 100 the second argument is pointing to location of i=3 only and then decrements to point to location of i=2..therefore output of *a =100 and *b =100.. hope you understood the sequence of outputs...:) :) On 6/22/11, Piyush Sinha ecstasy.piy...@gmail.com wrote: r u sure

  1   2   >