Can u clear Round3 --- Qstn-3. the language is not cleared
On Wed, Jun 5, 2013 at 1:52 PM, sourabh jain <[email protected]> wrote: > Round 1: > 1.Design a Data Structure supporting 3 queries a)push b)pop c) find > minimum > Ans : Do it using Two Stacks . in first stack use it as normal stack. > second stack use it to find minimun as the value inserted is greater than > the top ignore it else push it. if pop operation happens and the value > popped is equal to the top(s2) then pop(s2). > > time complexity push : O(1) , pop O(1) , find Minimum O(1) > > 2.Given post order of a BST find whether each node of the tree(except > leaf) has only 1 child or not. > eg 5 > \ > 7 > / > 3 > / > 2 > is correct as each node has only 1 child. > > Round 2: > 1.Given a sorted array a and a sum k print all pairs of indexes i and > j such that a[i]+a[j]=k. > > put one pointer at index 0 and 2nd at length(ar)-1. > > while (i<j){ > if(ar[i]+ar[j]==k) {printpairs; i++; j++;} > else if(ar[i])+ar[j] <k) i++; > else if(ar[i])+ar[j] >k) j--; > } > > 2.Given a matrix that is row and column wise sorted give an algo for > finding count of the total no of -ve nos. > > start from (0,n) move towards right if found +ve and increment count of > positive in row. else move down . > > Round 3: > 1.Given a matrix consisting of nos you can print the max length of > sequence possible where in a sequence each consecutive nos have a diff > of +1 or -1. > > eg 3 5 7 3 > 4 5 8 1 > 6 4 5 2 > > here sequence is 3 > 4 5 > 4 5 > *you can do it using recursion * > > 2.Give a data structure that supports following queries a)insert > b)delete c)ispresent d)print all elements > *BST's ... , if insertionorder needs to be maintained then linked list;* > > > 3.Given a infinite supply of n cylinders where each cylinder is > specified by weight of 02,weight of n2,total weight , > now u need some minimum quantity of o2 and n2 by selecting > cylinders and your aim is make it so that u have min total weight. > output the minimum total weight . > > Round 4: > 1.Given 2 sorted arrays find there median > .http://www.geeksforgeeks.org/median-of-two-sorted-arrays/ > > 2.Consider column of ms excel the start with A,B....Z,AA > Now u r given column no u need to print its name > *Ans : Same as number system problem with base 26* > > 3.Given 2 arrays.Imagine you are making bst from each array.u need to > tell whether 2 bsts will be identical or not without actually > constructing the tree. > eg 1 2 3 > 1 3 2 > will construct the same tree > > > On Mon, Jun 3, 2013 at 10:52 PM, *$* <[email protected]> wrote: > >> these are for which position? and experience? >> >> >> On Thu, May 2, 2013 at 9:27 PM, Guneesh <[email protected]> wrote: >> >>> Round 1: >>> 1.Design a Data Structure supporting 3 queries a)push b)pop c) find >>> minimum >>> 2.Given post order of a BST find whether each node of the tree(except >>> leaf) has only 1 child or not. >>> eg 5 >>> \ >>> 7 >>> / >>> 3 >>> / >>> 2 >>> is correct as each node has only 1 child. >>> >>> Round 2: >>> 1.Given a sorted array a and a sum k print all pairs of indexes i and >>> j such that a[i]+a[j]=k. >>> 2.Given a matrix that is row and column wise sorted give an algo for >>> finding count of the total no of -ve nos. >>> >>> Round 3: >>> 1.Given a matrix consisting of nos you can print the max length of >>> sequence possible where in a sequence each consecutive nos have a diff >>> of +1 or -1. >>> >>> eg 3 5 7 3 >>> 4 5 8 1 >>> 6 4 5 2 >>> >>> here sequence is 3 >>> 4 5 >>> 4 5 >>> 2.Give a data structure that supports following queries a)insert >>> b)delete c)ispresent d)print all elements >>> >>> 3.Given a infinite supply of n cylinders where each cylinder is >>> specified by weight of 02,weight of n2,total weight , >>> now u need some minimum quantity of o2 and n2 by selecting >>> cylinders and your aim is make it so that u have min total weight. >>> output the minimum total weight . >>> >>> Round 4: >>> 1.Given 2 sorted arrays find there median. >>> 2.Consider column of ms excel the start with A,B....Z,AA >>> Now u r given column no u need to print its name >>> 3.Given 2 arrays.Imagine you are making bst from each array.u need to >>> tell whether 2 bsts will be identical or not without actually >>> constructing the tree. >>> eg 1 2 3 >>> 1 3 2 >>> will construct the same tree >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Algorithm Geeks" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >>> >>> >> >> >> -- >> Thx, >> --Gopi >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> >> >> > > > > -- > Regards, > Sourabh Kumar Jain > +91-8971547841 > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > > > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
