Re: [algogeeks] Microsoft written test question

2012-09-06 Thread shashi kant
that what i mentioned finding original BST or a correcting the BST property ... my method will only maintains the BST property... -- 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] Microsoft written test question

2012-09-06 Thread Rahul Kumar Patle
@shashi: once we have two pointer where anomalies exist, we can exchange their data value to obtain original BST... On Wed, Sep 5, 2012 at 12:38 PM, shashi kant wrote: > Is it required only to retain the BST property ?? or to retain the > original BST (tree) > > > > > *Shashi Kant * > ***"Think

Re: [algogeeks] Microsoft written test question

2012-09-05 Thread atul anand
@Shashi : please check previous discussion on this thread. On Wed, Sep 5, 2012 at 2:09 PM, shashi kant wrote: > well in that case there can be simpler ways to do it > do an inorder traversal while checking prev if not then make it in proper order ,although whole tree has to be > traversed to fi

Re: [algogeeks] Microsoft written test question

2012-09-05 Thread shashi kant
well in that case there can be simpler ways to do it do an inorder traversal while checking prevhttp://thinkndoawesome.blogspot.com/ *System/Software Engineer* *Hewlett-Packard India Software Operations. * On Wed, Sep 5, 2012 at 12:43 PM, atul anand wrote: > @Shashi : i dont see any differenc

Re: [algogeeks] Microsoft written test question

2012-09-05 Thread atul anand
@Shashi : i dont see any differencebcoz only 2 nodes are swapped ..after correcting it...it shud maintain BST property wich automatically retain original tree -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send ema

Re: [algogeeks] Microsoft written test question

2012-09-05 Thread shashi kant
Is it required only to retain the BST property ?? or to retain the original BST (tree) *Shashi Kant * ***"Think positive and find fuel in failure"* http://thinkndoawesome.blogspot.com/ *System/Software Engineer* *Hewlett-Packard India Software Operations. * On Tue, Sep 4, 2012 at 1:56 PM, R

Re: [algogeeks] Microsoft written test question

2012-09-04 Thread Rahul Kumar Patle
@atul: correctly caught... here you have to notice that if u get only one violation not second violation ill the last... then sure the violation is created because of swapping of previous and current of first violation... so when you got first violation and put first marker on previous time put sec

Re: [algogeeks] Microsoft written test question

2012-09-03 Thread atul anand
i guess i missed this part of bharat post :- /* If we don't get the violation for the second time .. means both are side-by-side elements .. swap them .. */ i was saying the same.so it will work. On 9/4/12, atul anand wrote: > @rahul : Here are the boundary cases need to be taken care of :-

Re: [algogeeks] Microsoft written test question

2012-09-03 Thread atul anand
@rahul : Here are the boundary cases need to be taken care of :- suppose given BST is the following :- root=allocate(70); root->right=allocate(75); root->left=allocate(50); root->left->left=allocate(20); root->left->left->right=allocate(25); root->left->left->left=allocate(10); root->left->right=a

Re: [algogeeks] Microsoft written test question

2012-09-03 Thread Rahul Kumar Patle
@bharat: +1 i have tried some test cases.. working finely.. @anyone pls verify?? On Mon, Sep 3, 2012 at 11:58 AM, bharat b wrote: > while doing in-order traversal, we have to check if(prev > current) --> > then mark prev element for swapping in the first time violation.. > if it happens for the s

Re: [algogeeks] Microsoft written test question

2012-09-02 Thread bharat b
while doing in-order traversal, we have to check if(prev > current) --> then mark prev element for swapping in the first time violation.. if it happens for the second time..then mark current element for swapping. swap both .. If we don't get the violation for the second time .. means both are side

Re: [algogeeks] Microsoft written test question

2012-09-02 Thread Rahul Kumar Patle
@navin: can u explain ur algorithms in words pls.. On Sun, Sep 2, 2012 at 5:53 PM, Navin Kumar wrote: > void correctBST(struct node *root) > { > int flag =0; > static struct node *temp1, *temp2, *temp3, *prev; > static int found; > > if(found) return; > > if(root) { > correctBST(r

Re: [algogeeks] Microsoft written test question

2012-09-02 Thread Navin Kumar
void correctBST(struct node *root) { int flag =0; static struct node *temp1, *temp2, *temp3, *prev; static int found; if(found) return; if(root) { correctBST(root->left); if(!temp1 && prev && root->data < prev->data) { temp1 = prev; temp2 = root;

[algogeeks] Microsoft written test question

2012-09-02 Thread Rahul Kumar Patle
help to solve the following.. Question: Two of the nodes of a BST are swapped. Correct the BST (taken from GeekforGeeks 2nd online test 3rd question) -- Thanks and Regards: Rahul Kumar Patle

Re: [algogeeks] MICROSOFT WRITTEN IN VASAVI

2011-09-14 Thread anshu mishra
void allCase(string r) { int n = s.sise(); string s; for (i = 0; i < (1 << n); i++) { s = r; for ( j = 0; j < n; j++) { if ( i & ( 1 << j) ) { s[j] = s[j] + ('a' - 'A'); } }

[algogeeks] MICROSOFT WRITTEN IN VASAVI

2011-09-14 Thread teja bala
dis was asked in MS written U r given a string u need to print all cases of letters without changing the order eg:- ABC,Abc,ABc,aBC,abC etc... -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algo

[algogeeks] Microsoft Written Subjective Test

2011-09-13 Thread ronit douglas
Hey guys! I wanted to know what questions microsoft has asked in subjective test of the apti? Normally they have 3 different Qs for 3 profiles namely, s/w developer, tester & program manager. Hence, it is typical to find 3 Qs like Write a prog for this... Find the o/p of this... & Design the syste

Re: [algogeeks] MICROSOFT WRITTEN QUESTION-2010

2011-09-13 Thread Vicki Wen
@ bharat: merging 2 sorted arrays is O(n) On Tue, Sep 13, 2011 at 12:42 AM, bharatkumar bagana < bagana.bharatku...@gmail.com> wrote: > @jai gupta : merge sort for 2 sorted arrays --O(nlogn) right? > > > On Tue, Sep 13, 2011 at 1:03 PM, jai gupta wrote: > >> @bharat: When each step of nishant

Re: [algogeeks] MICROSOFT WRITTEN QUESTION-2010

2011-09-13 Thread bharatkumar bagana
@jai gupta : merge sort for 2 sorted arrays --O(nlogn) right? On Tue, Sep 13, 2011 at 1:03 PM, jai gupta wrote: > @bharat: When each step of nishant's algo is O(n) how can it sum up to > O(nlogn)??? > > On Tue, Sep 13, 2011 at 9:18 AM, bharatkumar bagana < > bagana.bharatku...@gmail.com> wrote:

Re: [algogeeks] MICROSOFT WRITTEN QUESTION-2010

2011-09-13 Thread jai gupta
@bharat: When each step of nishant's algo is O(n) how can it sum up to O(nlogn)??? On Tue, Sep 13, 2011 at 9:18 AM, bharatkumar bagana < bagana.bharatku...@gmail.com> wrote: > @nishant : your algo takes O(nlogn) time with higher constant behind > this. can't we write better than this ? > @sa

Re: [algogeeks] MICROSOFT WRITTEN QUESTION-2010

2011-09-12 Thread bharatkumar bagana
@nishant : your algo takes O(nlogn) time with higher constant behind this. can't we write better than this ? @sairam : will u pls provide implementation logic of u'r idea .. On Mon, Sep 12, 2011 at 12:43 PM, Sairam Ravu wrote: > By merging smaller trees into larger trees we can obtain a muc

Re: [algogeeks] MICROSOFT WRITTEN QUESTION-2010

2011-09-12 Thread Sairam Ravu
By merging smaller trees into larger trees we can obtain a much more efficient solution. -- With love and regards, Sairam Ravu I M. Tech(CS) Sri Sathya Sai Institute of Higher Learning "To live life, you must think it, measure it, experiment with it, dance it, paint it, draw it, and calculate

[algogeeks] MICROSOFT WRITTEN

2011-09-11 Thread teja bala
If you're familiar with the ? operator x ? y : z you have to implement that in a function: int cond(int x, int y, int z); using only ~, !, ^, &, +, |, <<, >> no if statements, or loops or anything else, just those operators, and the function should correctly return y or z based on the value of x.

Re: [algogeeks] MICROSOFT WRITTEN QUESTION-2010

2011-09-11 Thread nishaanth
convert the binary search tree into a sorted linked list. After flattening construct the tree out of it. And please don't use capital letters unnecessarily. It reflects bad on you. On Sun, Sep 11, 2011 at 7:29 AM, teja bala wrote: > MERGE 2 BINARY SEARCH TREES? > > > HOW TO DO IT?(POST AN EFFICI

[algogeeks] MICROSOFT WRITTEN QUESTION-2010

2011-09-11 Thread teja bala
MERGE 2 BINARY SEARCH TREES? HOW TO DO IT?(POST AN EFFICIENT ALGORITHM) -- 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 algogeek

Re: [algogeeks] MICROSOFT WRITTEN QUESTION

2011-09-10 Thread Gaurav Menghani
No. I think you should revisit complexity. That's not how it works. Factoring a million digit number outputs two numbers. It should take O(1), right? :D On Sat, Sep 10, 2011 at 11:56 AM, Neha Singh wrote: > we hv to just fill an array of size n, so complexity should be O(n) in worst > case > > -

Re: [algogeeks] MICROSOFT WRITTEN QUESTION

2011-09-10 Thread Neha Singh
we hv to just fill an array of size n, so complexity should be O(n) in worst case -- 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] MICROSOFT WRITTEN QUESTION

2011-09-10 Thread Gaurav Menghani
On Sat, Sep 10, 2011 at 11:28 AM, teja bala wrote: > @Gaurav > > wat if here is n=1 > den >  W(0)=? > >  i dint get that See, when you get to W(0) state, that means, you have created a valid combination. That means, you have gone through one 'path' through the various possibilities. That is why W

Re: [algogeeks] MICROSOFT WRITTEN QUESTION

2011-09-10 Thread teja bala
@Gaurav wat if here is n=1 den W(0)=? i dint get that -- 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...@g

Re: [algogeeks] MICROSOFT WRITTEN QUESTION

2011-09-10 Thread Gaurav Menghani
On Sat, Sep 10, 2011 at 11:22 AM, Neha Singh wrote: > O(n/a) For every n, it would add values for W(n-v1), W(n-v2),..., W(n-vm), if there are m denominations of coins. So the complexity would be O(nm). Also, this can be implemented in two ways. Top-down (which is what I mentioned), and Bottom-up.

Re: [algogeeks] MICROSOFT WRITTEN QUESTION

2011-09-10 Thread Neha Singh
O(n/a) where n is the required sum which is to be created by grouping the coins and a is the coin of smallest denomination so, O(n) in the worst case -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge

Re: [algogeeks] MICROSOFT WRITTEN QUESTION

2011-09-10 Thread Gaurav Menghani
You can use a trivial dynamic programming for this. Let W(n) be the number of ways to create n rupees, then W(n) = W(n-1) + W(n-5) + W(n-10) + W(n-25) + W(n-50) if(n<0) then W(n) = 0 if(n==0) then W(n) = 1 What do you think would be the complexity of this solution? On Sat, Sep 10, 2011 at 10:57

[algogeeks] MICROSOFT WRITTEN QUESTION

2011-09-10 Thread teja bala
There are set of coins of {50,25,10,5,1} paise in a box.Write a program to find the number of ways a 1 rupee can be created by grouping the paise. post ur code. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this g

[algogeeks] Microsoft written!!!

2011-08-09 Thread muthu raj
Write a C code to find Leftmost right cousin at the same level. For ex: 10 /\ 2 3 /\ /\ 8 56 9 Leftmost right cousin of 5 is 6. Leftmost right cousin of 3 is NULL *Muthuraj R IV th Year , ISE PESIT , Bangalore* -- You received this message because you are subscribed to the Goog

Re: [algogeeks] Microsoft Written test questions required

2011-02-12 Thread HARISH S.C
They also asked us to find the output of 2 C pgm involving pointers for 5 marks. On Wed, Feb 2, 2011 at 3:04 PM, Ricky wrote: > Hi Guys, > > I want to know about questions asked in written test for Microsoft. > I come to know that it will be for 1.5 hours and it will consists of > questions from

[algogeeks] Microsoft Written test questions required

2011-02-02 Thread Ricky
Hi Guys, I want to know about questions asked in written test for Microsoft. I come to know that it will be for 1.5 hours and it will consists of questions from c,C++ and data structure. I am writing the test this weekend only. So please send me questions ASAP. -- You received this message becau

Re: [algogeeks] Microsoft Written Test Questions

2011-01-27 Thread Ankit Babbar
http://www.cracktheinterview.org/category/company-wise/microsoft/ but these are all subjective type...need MCQ's..!! On Thu, Jan 27, 2011 at 9:39 AM, Umer Farooq wrote: > Hi there, can you share some of the Microsoft phone interview questions.? > > On Thu, Jan 27, 2011 at 6:47 AM, Ankit Babbar

Re: [algogeeks] Microsoft Written Test Questions

2011-01-27 Thread Umer Farooq
Hi there, can you share some of the Microsoft phone interview questions.? On Thu, Jan 27, 2011 at 6:47 AM, Ankit Babbar wrote: > Hey all...Can anyone provide me with the recent (/most common) written test > questions(or links ) of Microsoft IDC and Microsoft IT SDE positions...?? > > Thanks in ad

[algogeeks] Microsoft Written Test Questions

2011-01-26 Thread Ankit Babbar
Hey all...Can anyone provide me with the recent (/most common) written test questions(or links ) of Microsoft IDC and Microsoft IT SDE positions...?? Thanks in advance.. Regards, Ankit. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To pos