Re: [algogeeks] Microsoft Interview Question

2012-10-17 Thread Navin Kumar
@rahul: I got my fault. I didn't thought about that test case. I am thinking about applying DFS traversal algorithm for graph here. It may work here. On Wed, Oct 17, 2012 at 9:01 AM, Rahul Kumar Patle < patlerahulku...@gmail.com> wrote: > @navin: still i am not getting your solution.. can you mak

Re: [algogeeks] Microsoft Interview Question

2012-10-16 Thread atul anand
@Rahul : yes i know and actually i posted this query on geeksforgeeks. you can find my solution in comments , search for atul007 in the provided link.It will work for all cases. now to find all path you need to do small modification on the same code. On Tue, Oct 16, 2012 at 9:31 AM, Rahul Kumar Pa

Re: [algogeeks] Microsoft Interview Question

2012-10-16 Thread Navin Kumar
@Rahul: Loop won't occur because when you are visiting any matrix element then you are marking 1 in visited matrix. So second time it will be seen as a already visited element and it will choose another element (or path if exist) or will blocked. On Tue, Oct 16, 2012 at 9:31 AM, Rahul Kumar Patle

Re: [algogeeks] Microsoft Interview Question

2012-10-16 Thread Rahul Kumar Patle
@atul: in your solution object only can move down or right direction. but in my problem object is free to move in any direction and hence there are ch ances of cycle.. how to memoize cycle. if there is cycle then your approach will give infinite solution. consider this maze 1 1 0 0 0 1 1 0

Re: [algogeeks] Microsoft Interview Question

2012-10-15 Thread atul anand
http://www.geeksforgeeks.org/archives/13376 On Tue, Oct 16, 2012 at 8:56 AM, atul anand wrote: > can be done simply by backtracking . > > On Sat, Oct 13, 2012 at 12:31 AM, Rahul Kumar Patle < > patlerahulku...@gmail.com> wrote: > >> Pls help to solve this que.. does any one have DP solution for

Re: [algogeeks] Microsoft Interview Question

2012-10-15 Thread atul anand
can be done simply by backtracking . On Sat, Oct 13, 2012 at 12:31 AM, Rahul Kumar Patle < patlerahulku...@gmail.com> wrote: > Pls help to solve this que.. does any one have DP solution for following > que. > > http://www.geeksforgeeks.org/archives/24488 > section 5/question 2 > > Write a program

[algogeeks] Microsoft Interview Question

2012-10-15 Thread Rahul Kumar Patle
Pls help to solve this que.. does any one have DP solution for following que. http://www.geeksforgeeks.org/archives/24488 section 5/question 2 Write a program to find all the possible paths from a starting point to dest point in a maze(2-D array). ex: 1 0 1 0 1 1 1 1 0 1 0 1

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 online exam pattern

2012-08-31 Thread megha agrawal
written exam consists of 2 sections: 1. Aptitude (consists of some Data interpretation and data analysis questions) 2. Technical (basic C/C++ MCQs) it doesn't contain any question on test cases. On Thu, Aug 30, 2012 at 3:49 PM, Abhi wrote: > Can anyone tell me the type of questions asked in Mi

[algogeeks] Microsoft online exam pattern

2012-08-30 Thread Abhi
Can anyone tell me the type of questions asked in Microsoft's online exam, their difficulty level and especially the questions related to test cases (pls also post some examples) ? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view thi

Re: [algogeeks] MICROSOFT QUESTION

2012-08-17 Thread Arun Kindra
http://geeksforgeeks.org/forum/topic/algorithm-15?replies=6#post-39220 -- 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+u

Re: [algogeeks] MICROSOFT QUESTION

2012-08-16 Thread Dave
@Shady: You can do it with just the input array and the output array. In the language of Atul007, put temp2 in the output array, and calculate temp1 as a scalar, i.e., one element at a time as you replace the elements of temp2 with the result. Dave On Thursday, August 16, 2012 5:40:23 AM UTC-

Re: [algogeeks] MICROSOFT QUESTION

2012-08-16 Thread shady
for n elements, space used - 2n can we do better ? On Thu, Aug 16, 2012 at 3:20 PM, atul anand wrote: > input : 23 45 > temp1 : 26 24 120 > temp2 : 120 60 20 5 > > for given input ..take tow temp array. > temp1[i] = input[0] * input[1] * input[2] * input[3]..input[i]

Re: [algogeeks] MICROSOFT QUESTION

2012-08-16 Thread atul anand
input : 23 45 temp1 : 26 24 120 temp2 : 120 60 20 5 for given input ..take tow temp array. temp1[i] = input[0] * input[1] * input[2] * input[3]..input[i] temp2[i] = input[i] * input [i + 1] * input[i + 2]input[n]; now out[i] = temp1[i-1] * temp2[i+1]; On Thu, Aug

[algogeeks] MICROSOFT QUESTION

2012-08-16 Thread Hariraman R
Hi, This is a microsoft question asked in our campus previous year. Anyone having idea please share it here... Given an array of n elements A[n]. Write a program to create a new array OUT[n], which has its elements as multiplication of all the elements in the input array A[n

Re: [algogeeks] Microsoft first round interview question.

2012-08-03 Thread sahil gupta
Each node is having three pointers. Two are simple *forward and backward* pointers. Third pointer may point to again similar list or point to null. Also those list which are pointed by third pointer may again follow similar fashion. It's look like a general tree. Now question is: To make *DLL* fro

Re: [algogeeks] Microsoft first round interview question.

2012-08-02 Thread Ashish Goel
lets call the additional pointer as child. find the tail and keep attaching to tail if there is a child... struct node * makeDLL(struct node *pDLL) { if (!pDLL) return pDLL; struct node *pTail = pDLL; while (pTail->next) pTail = pTail->next; struct node *pCurr = pDLL; while (pCurr) {

Re: [algogeeks] Microsoft first round interview question.

2012-08-02 Thread Navin Kumar
@sahil: Please elaborate your question. I didn't understand your question. what is straight doubly linked list?? How many pointers each node have?? On Thu, Aug 2, 2012 at 4:26 PM, Amit Basak wrote: > Does each node in the list have three pointers? > What do you mean by straight doubly link lis

Re: [algogeeks] Microsoft first round interview question.

2012-08-02 Thread Amit Basak
Does each node in the list have three pointers? What do you mean by straight doubly link list? Thanks, Amit On Wed, Aug 1, 2012 at 7:25 PM, sahil gupta wrote: > There is doubly link list and each node is having another pointer which is > points to another doubly link list or points to null

[algogeeks] Microsoft first round interview question.

2012-08-02 Thread sahil gupta
There is doubly link list and each node is having another pointer which is points to another doubly link list or points to null. You need make it straight doubly link list. Provide the efficient code. Sahil Gupta -- You received this message because you are subscribed to the Google Groups "Algo

Re: [algogeeks] Microsoft online questions

2012-08-01 Thread Navin Kumar
@Daksh: you are right :) On Tue, Jul 31, 2012 at 11:30 PM, Daksh Talwar wrote: > @Navin : Thanks a lot . > Also , I had this doubt , that taking the middle of the array as the root > is just a convention right ? > The tree we get is just one of the n(catalan number) trees we can get > using the

Re: [algogeeks] Microsoft online questions

2012-08-01 Thread Daksh Talwar
@Navin : Thanks a lot . Also , I had this doubt , that taking the middle of the array as the root is just a convention right ? The tree we get is just one of the n(catalan number) trees we can get using the DLL/array given ..? On Tue, Jul 31, 2012 at 10:57 PM, manish untwal wrote: > hey friends,

Re: [algogeeks] Microsoft online questions

2012-07-31 Thread manish untwal
hey friends, just wanted to ask like what they ask in quants and DI On Tue, Jul 31, 2012 at 10:45 PM, Navin Kumar wrote: > @Daksh: total number of BST possible with n nodes will be : catalan number > > we can build balanced BST by each time selecting middle element as a root > node and its left p

Re: [algogeeks] Microsoft online questions

2012-07-31 Thread Navin Kumar
@Daksh: total number of BST possible with n nodes will be : catalan number we can build balanced BST by each time selecting middle element as a root node and its left pointer will point to left linked list and right pointer will point to right linked list. Do it recursively for left list and right

Re: [algogeeks] Microsoft online questions

2012-07-31 Thread Daksh Talwar
Anyone with a logic/algo/code for the " 3. convert sorted doubly linked list to bst using same nodes as in DLL. ". Would it be recursive ? On Tue, Jul 31, 2012 at 12:30 AM, Purani Sekar wrote: > Analytical questions were from logical reasoning, syllogism, piechart, etc. > Technical questions wer

Re: [algogeeks] Microsoft online questions

2012-07-31 Thread a g
Q1 ) rotate image by 90 degree Q2 ) sort a list with 0,1,2, values by pointer manipulation Q3) 2 values in bst swapped correct the bst On Tue, Jul 31, 2012 at 12:30 AM, Purani Sekar wrote: > Analytical questions were from logical reasoning, syllogism, piechart, etc. > Technical questions were li

Re: [algogeeks] Microsoft online questions

2012-07-31 Thread Purani Sekar
Analytical questions were from logical reasoning, syllogism, piechart, etc. Technical questions were like - they'll give a flow chart (eg:http://en.wikipedia.org/wiki/File:FlowchartExample.png) or C program and ask to trace the output. no data structures and all. On Sun, Jul 29, 2012 at 10:16 PM,

Re: [algogeeks] Microsoft online questions

2012-07-30 Thread Tanuj Makkar
hi can u please elaborate on analytical questions.like if they were from logical reasoning,verbal(syllogism) and in technical...were questions based on output of c programs...or there were data structures nd other topics plz help...it will be a great help ... . Thanx On Sun

Re: [algogeeks] Microsoft online questions

2012-07-29 Thread Piyush Khandelwal
@ Purani : Hi ! Can u tell me, when was this test conducted. *Piyush Khandelwal** | Placement Coordinator**, Delhi Technological University ( Delhi College of Engineering )* Mobile: 91-8447229204 www.dce.edu Get a signature like this.

Re: [algogeeks] Microsoft online questions

2012-07-29 Thread Purani Sekar
Hi, They conducted 2 online rounds. First round was of 1 hour duration. It tests your speed and analytical skills. The mark split was as given below: 30 analytical questions - data interpretation type 20 technical questiions - flow chart and basic c Second round was online coding round. But comp

[algogeeks] Microsoft online questions

2012-07-29 Thread Sanchit Mittal
Hi, Can anybody help by sharing MS online test pattern and questions ? I have heard they have also included aptitude questions this time, is that right? Thanks -- Sanchit Mittal Fourth Year Undergraduate Computer Engineering Delhi College of Engineering ph- +919582414494 -- You received this m

Re: [algogeeks] Microsoft interview qs

2012-06-30 Thread atul anand
i have fixed your code but it is alwayz better to use recursive function for creating trie. i have wrote my own recursive function to create TRIE... you can understand the same bcozz iterative one make thing unnecessary complicated. here check the code link :- http://ideone.com/6HhFZ have fu

Re: [algogeeks] Microsoft interview qs

2012-06-30 Thread Ashish Goel
trie or ternary tree and build stack for the string being entered, keep distributed hashmap for head/tail queries like cricket, weather, finance etc various domains etc.. Best Regards Ashish Goel "Think positive and find fuel in failure" +919985813081 +919966006652 On Sat, Jun 30, 2012 at 12:05

Re: [algogeeks] Microsoft interview qs

2012-06-29 Thread shady
i am not sure if it is possible to change the length of an already declared array, so i think one might wanna use pointers instead. Allocate memory dynamically. On Thu, Jun 28, 2012 at 2:36 PM, deepikaanand wrote: > //Taken from careercup.com > > Design the autocomplete feature (ex:Google Suggest

[algogeeks] Microsoft interview qs

2012-06-28 Thread deepikaanand
//Taken from careercup.com Design the autocomplete feature (ex:Google Suggest) I assumed {"abcde","abcegh","abcpqr","abcxyz","xyz" ,"abcmno"} URLs and stored them in trie...Such if the user enters abc ...the o/p will be abc is a prefix in 5 number of cases d e e g h m n o p q r x y z

Re: [algogeeks] Microsoft Interview Question

2012-06-21 Thread Rishabh Agarwal
@Abhi: if you apply quick sort then again the order will will not be intact -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/ic2CXJXSGuoJ. To post to this gr

Re: [algogeeks] Microsoft Interview Question

2012-06-21 Thread Abhishek Sharma
find the element nearest to zero.make it pivot element.then apply one pass of quicksort over the array.this is O(n) On Thu, Jun 21, 2012 at 12:27 AM, Akshat Sapra wrote: > void make_group( int a[], int size) { > int j = 0; > > for ( int i = 0; i < size; i++ ) { > if ( a[i] < 0

Re: [algogeeks] Microsoft Interview Question

2012-06-20 Thread Akshat Sapra
void make_group( int a[], int size) { int j = 0; for ( int i = 0; i < size; i++ ) { if ( a[i] < 0 ) { swap(a[i],a[j]); j++; } } } -- Akshat Sapra Under Graduation(B.Tech) IIIT-Allahabad(Amethi Campus) *--

Re: [algogeeks] Microsoft question

2012-06-17 Thread Prem Nagarajan
@Ashish Building a treeis of O(nlogn) complexity. Linear solution is much appreciated. On Sun, Jun 17, 2012 at 2:00 PM, Amitesh Singh wrote: > check out this: > RANDOMIZED-SELECT in O(n): > > http://amiteshsingh.wordpress.com/2012/06/08/iterative-randomized-select/ > > -- > Amitesh > > > > > On S

Re: [algogeeks] Microsoft question

2012-06-17 Thread Amitesh Singh
check out this: RANDOMIZED-SELECT in O(n): http://amiteshsingh.wordpress.com/2012/06/08/iterative-randomized-select/ -- Amitesh On Sun, Jun 17, 2012 at 1:24 PM, Ashish Goel wrote: > is the modification of the given array allowed? > > if yes use quick select, otherwise build tree where each

Re: [algogeeks] Microsoft question

2012-06-17 Thread Amol Sharma
refer to kth order statistics in the book intro to algorithms by coreman -- Amol Sharma Final Year Student Computer Science and Engineering MNNIT Allahabad

Re: [algogeeks] Microsoft question

2012-06-17 Thread Ashish Goel
is the modification of the given array allowed? if yes use quick select, otherwise build tree where each node keeps count of its left subtree Best Regards Ashish Goel "Think positive and find fuel in failure" +919985813081 +919966006652 On Sun, Jun 17, 2012 at 8:13 AM, Prem Nagarajan wrote: > G

[algogeeks] Microsoft question

2012-06-17 Thread Prem Nagarajan
Give an array of unsorted elements, find the kth smallest element in the array. The expected time complexity is O(n) and no extra memory space should be used. Quickselect algorithm can be used to obtain the solution. Can anyone explain how quickselect works? -- You received this message because

Re: [algogeeks] Microsoft Interview Question

2012-06-15 Thread Shubham Sandeep
@guneesh your code fails to keep order b/w 3 and 4 in the above example On Fri, Jun 15, 2012 at 2:40 PM, Guneesh Paul Singh wrote: > void change(int a[],int n) > { > int i,j; > i=0; > j=1; > > while(i { > if(j j=i+1; > else if(a[j]<0&&a[i]>0) >

Re: [algogeeks] Microsoft Interview Question

2012-06-15 Thread Guneesh Paul Singh
void change(int a[],int n) { int i,j; i=0; j=1; while(i0) { swap(a,j,i); } else { if(a[j]>0) j++; else i++; } } } -- You received this message because you are subscribed to th

Re: [algogeeks] Microsoft Interview Question

2012-06-14 Thread nadeem khan
how to do it in space comp- O(1) . I mean without using additional arrays. Could it be done ? On Thu, Jun 14, 2012 at 3:46 PM, utsav sharma wrote: > @all :- by segregating 0 and 1 or by taking quicksort approach > we have to swap no.s resulting which array becomes unordered. > > my approach is s

Re: [algogeeks] Microsoft Interview Question

2012-06-14 Thread utsav sharma
@all :- by segregating 0 and 1 or by taking quicksort approach we have to swap no.s resulting which array becomes unordered. my approach is start from right and if a negative no. occurs insert it into another array temp[] this will shift all positive no.s to right and in 2nd pass start from left

Re: [algogeeks] Microsoft Interview Question

2012-06-14 Thread saurabh singh
Order may not be maintained necessarily by this solution Saurabh Singh B.Tech (Computer Science) MNNIT blog:geekinessthecoolway.blogspot.com On Thu, Jun 14, 2012 at 1:47 PM, Manikanta Babu wrote: > Check this out, it works in O(n); > > int i = 0; > int j = n-1; > > while

Re: [algogeeks] Microsoft Interview Question

2012-06-14 Thread Manikanta Babu
Check this out, it works in O(n); int i = 0; int j = n-1; while((i= 0)&&(i0 && a[j]<0) { swap(a[i],a[j]); i++; j--; } else { if(a[i]<0)

Re: [algogeeks] Microsoft Interview Question

2012-06-14 Thread Mad Coder
As nothing is written about space complexity, I am assuming that we can take extra space. Take a temporary array of length n. 1. Maintain a counter for the length of temporary array filled till now. 2. Traverse the given array. If value contained is negative insert it in new array and update cou

Re: [algogeeks] Microsoft Interview Question

2012-06-13 Thread saurabh singh
Think of the +ve numbers as 0 negative numbers as 1.Now the problem reduces to http://stackoverflow.com/questions/682171/arrange-0s-1s-in-a-array Saurabh Singh B.Tech (Computer Science) MNNIT blog:geekinessthecoolway.blogspot.com On Thu, Jun 14, 2012 at 3:00 AM, Piyush Kapoor wrote: > your so

Re: [algogeeks] Microsoft Interview Question

2012-06-13 Thread Piyush Kapoor
@Ashish @Saurabh , Recheck your solutions , order won't be maintained in your solutions. Its output will be = {-1 -6 -8 3 4 5 9 } On Thu, Jun 14, 2012 at 2:08 AM, Saurabh Yadav wrote: > @shiv relate the ashish solution with quick sort then you will understand > easily > > > On Thu, Jun 14, 2012

Re: [algogeeks] Microsoft Interview Question

2012-06-13 Thread Saurabh Yadav
@shiv relate the ashish solution with quick sort then you will understand easily On Thu, Jun 14, 2012 at 2:06 AM, Saurabh Yadav wrote: > +1 Ashish solution > > > > -- > Thanks & Regards > Saurabh Yadav > > -- Thanks & Regards Saurabh Yadav -- You received this message because you are subscr

Re: [algogeeks] Microsoft Interview Question

2012-06-13 Thread Saurabh Yadav
+1 Ashish solution -- Thanks & Regards Saurabh Yadav -- 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...@goo

Re: [algogeeks] Microsoft Interview Question

2012-06-13 Thread Ashish Goel
int i=0; int j=n-1; while (i0) j--; if (iwrote: > Given a array of integers both positive and negative and you need to shift > positive numbers to one side > and negative numbers to other side with the order intact. > ex. {-1,5,3,-8,4,-6,9} to {-1,-8,-6,5,3,4,9}. This should be done in O(n). > > -

[algogeeks] Microsoft Interview Question

2012-06-13 Thread Krishna Kishore
Given a array of integers both positive and negative and you need to shift positive numbers to one side and negative numbers to other side with the order intact. ex. {-1,5,3,-8,4,-6,9} to {-1,-8,-6,5,3,4,9}. This should be done in O(n). -- You received this message because you are subscribed t

Re: [algogeeks] Microsoft interview question

2012-05-21 Thread monish001
@mithun: Try A = 1, 6 B = 4, 3 A ^ B = 0. Alone Ex-OR cant solve this in O(n) time. On Monday, 21 May 2012 21:48:30 UTC+5:30, mithun wrote: > > By doing Ex-OR we can find if b is permutation of A > > suppose a -- 3 5 4 > b -- 4 3 5 > if A ^ B = 0 then both are permutation or else

Re: [algogeeks] Microsoft interview question

2012-05-21 Thread Mithun Kumar
By doing Ex-OR we can find if b is permutation of A suppose a -- 3 5 4 b -- 4 3 5 if A ^ B = 0 then both are permutation or else not shout loud if this has flaws :P -mithun On Sun, May 20, 2012 at 12:59 AM, HARSHIT PAHUJA wrote: > given 2 unsorted integer arrays a and b of

Re: [algogeeks] Microsoft interview question

2012-05-20 Thread GAURAV CHAWLA
we can do it bitwise... i can set the corresponding bit by 1 of any int ... lets take int ia,ib=0; and set the a[i]th bit of ia as 1 , and similar for bth array and ib ... and finally check.. if(ia==ib){permutation of each other} hope this will work.. On Sun, May 20, 2012 at 1:39 AM, malay

Re: [algogeeks] Microsoft interview question

2012-05-20 Thread DINESH KUKREJA
Agree .. u can hardcode primes no upto certain value . primes method works in case of permutation of alphabets . else u can ALSO use the below method .. find the n^2+n of each number in the array . and check for the same in the other array . -- You received this message because you are subscribe

Re: [algogeeks] Microsoft interview question

2012-05-20 Thread Dave
@Atul007: It looks like you have three equations in n unknowns. How would you _prove_ that these conditions are sufficient to determine whether the arrays are permutations? My guess is that a computer search with n = 8 or so would find a counterexample in short order. Dave On Sunday, May 20,

Re: [algogeeks] Microsoft interview question

2012-05-20 Thread atul anand
test case : - arr[]=1 1 2 2 arr[]=0 3 0 3 without 1st condition given test case will give wrong output. On Sun, May 20, 2012 at 1:35 PM, Darpan Baweja wrote: > @atul:- why we require 1st condition(check sum of the square of arr1 = > arr2) ?? > > > On Sun, May 20, 2012 at 1:10 PM, atul anand wrot

Re: [algogeeks] Microsoft interview question

2012-05-20 Thread Darpan Baweja
@atul:- why we require 1st condition(check sum of the square of arr1 = arr2) ?? On Sun, May 20, 2012 at 1:10 PM, atul anand wrote: > it can be done by doing set of operation on the data. > 1) check sum of the square of arr1 = arr2 > 2) sum of elements of arr1=arr2 > 3) xoring elements of arr1 an

Re: [algogeeks] Microsoft interview question

2012-05-20 Thread atul anand
it can be done by doing set of operation on the data. 1) check sum of the square of arr1 = arr2 2) sum of elements of arr1=arr2 3) xoring elements of arr1 and arr2 == 0 if all 3 condition are successful then..permutation found. On Sun, May 20, 2012 at 12:59 AM, HARSHIT PAHUJA wrote: > given 2 un

Re: [algogeeks] Microsoft interview question

2012-05-19 Thread malay chakrabarti
dat defeats the o(1) space constraint. :-) On May 19, 2012 8:05 PM, "HARSHIT PAHUJA" wrote: > @malay --- we can do it by precomputing the prime arrays > > > On Sun, May 20, 2012 at 1:10 AM, malay chakrabarti wrote: > >> method is ryt but to find ith prime u cannot to it in c

Re: [algogeeks] Microsoft interview question

2012-05-19 Thread HARSHIT PAHUJA
@malay --- we can do it by precomputing the prime arrays On Sun, May 20, 2012 at 1:10 AM, malay chakrabarti wrote: > method is ryt but to find ith prime u cannot to it in constant time. > On May 19, 2012 7:30 PM, "HARSHIT PAHUJA" > wrote: > >> given 2 unsorted integer arra

Re: [algogeeks] Microsoft interview question

2012-05-19 Thread malay chakrabarti
method is ryt but to find ith prime u cannot to it in constant time. On May 19, 2012 7:30 PM, "HARSHIT PAHUJA" wrote: > given 2 unsorted integer arrays a and b of equal size. Determine if b is a > permutation of a. Can this be done in O(n) time and O(1) space ? > > > > > please help me with my s

[algogeeks] Microsoft interview question

2012-05-19 Thread HARSHIT PAHUJA
given 2 unsorted integer arrays a and b of equal size. Determine if b is a permutation of a. Can this be done in O(n) time and O(1) space ? please help me with my solution suppose a -- 3 5 4 b -- 4 3 5 now we replace a[i] with a[i]..th prime number and b with b[i] .. th prime

Re: [algogeeks] Microsoft Interview Question

2012-03-12 Thread atul anand
i guess they were talking abt spanning tree , so you can use prism or kruskal algo to do the same. On Mon, Mar 12, 2012 at 3:05 PM, Umer Farooq wrote: > Hello friends, > > I recently had an onsite MS interview. One of the questions that they > asked was: > > >- Given a directed graph, write

[algogeeks] Microsoft Interview Question

2012-03-12 Thread Umer Farooq
Hello friends, I recently had an onsite MS interview. One of the questions that they asked was: - Given a directed graph, write a program that takes root of the graph and returns root of a tree which comprises of all the nodes of the graph in the same way as they appeared in the graph (

Re: [algogeeks] Microsoft IT-Operations Interview

2012-02-22 Thread rahul sharma
written test..2-3 simple algorithmss.we have like...count no. of occcurance of the words occuring more than one...merge to array...n test cases u have to write 4 somw questions which are quite logical. On Wed, Feb 22, 2012 at 10:29 AM, Mihir Kulkarni wrote: > Hello, > Please let me know i

[algogeeks] Microsoft IT-Operations Interview

2012-02-21 Thread Mihir Kulkarni
Hello, Please let me know if anyone knows anything about Microsoft IT- Operations Interview procedure or the type of questions asked.. Also which areas one should focus on. Any help will be highly appreciated. Thank you all. cheers, Mihir Kulkarni Graduate Student University of California, Irvine

Re: [algogeeks] MICROSOFT IDC: unsorted linked lists intersection

2011-12-31 Thread Ashish Goel
merge two linked list without sorting them, the resultant list should be sorted one... any other better solution? Best Regards Ashish Goel "Think positive and find fuel in failure" +919985813081 +919966006652 On Wed, Jan 12, 2011 at 3:15 PM, Ashish Goel wrote: > without sorting, it will be m

Re: [algogeeks] Microsoft Question

2011-10-31 Thread Anup Ghatage
:) On Tue, Nov 1, 2011 at 12:54 AM, WgpShashank wrote: > @Anup You Seems to Active Member , u remembered that :) > > +1 to You. > > Thanks > Shashank > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To view this discussion on the web

Re: [algogeeks] Microsoft Question

2011-10-31 Thread WgpShashank
@Anup You Seems to Active Member , u remembered that :) +1 to You. Thanks Shashank -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/qRJslcZjhboJ. To post t

Re: [algogeeks] Microsoft

2011-10-01 Thread shady
ok, thanks :) On Sun, Oct 2, 2011 at 10:35 AM, rahul sharma wrote: > i dont think sofor fresher its best throug campusotherwise at > least1-2 year experience needed...for ms u can go > https://careers.microsoft.com/search.aspx...there are lot of openings.. > > > On Sun, Oct 2, 2011 at 10:

Re: [algogeeks] Microsoft

2011-10-01 Thread rahul sharma
i dont think sofor fresher its best throug campusotherwise at least1-2 year experience needed...for ms u can go https://careers.microsoft.com/search.aspx...there are lot of openings.. On Sun, Oct 2, 2011 at 10:28 AM, shady wrote: > does it actually work ? > i think such kind of mails to

Re: [algogeeks] Microsoft

2011-10-01 Thread shady
does it actually work ? i think such kind of mails to recruiters directly go to spam. On Sun, Oct 2, 2011 at 8:07 AM, rahul sharma wrote: > every company hire off campus ...just type company name followed by > carrers..n apply...simple. > > > On Sun, Oct 2, 2011 at 12:47 AM, Manish Verma wrote: >

Re: [algogeeks] Microsoft

2011-10-01 Thread rahul sharma
every company hire off campus ...just type company name followed by carrers..n apply...simple. On Sun, Oct 2, 2011 at 12:47 AM, Manish Verma wrote: > Does microsoft hire off-campus???..if yes, then what is their > process???..n what type of questions they ask???...what about > google?

[algogeeks] Microsoft

2011-10-01 Thread Manish Verma
Does microsoft hire off-campus???..if yes, then what is their process???..n what type of questions they ask???...what about google??? actually i've gone through microsoft's collg hiring process.it was closebut hard luck,anyway..so gonna try after 6 months. -- You rece

Re: [algogeeks] MICROSOFT IDC

2011-09-23 Thread Ashish Goel
can you also give the solutions.. the questions seem to be interesting Best Regards Ashish Goel "Think positive and find fuel in failure" +919985813081 +919966006652 On Thu, Sep 22, 2011 at 8:56 AM, saurabh wrote: > I sincerely thank this group as i got selected in MSIDC only because > of thi

Re: [algogeeks] MICROSOFT IDC

2011-09-22 Thread teja bala
congrats dude On Thu, Sep 22, 2011 at 12:46 PM, Suraj Fale wrote: > Congrats !!!1 > > > > > -- > Regards > Suraj Fale > +91-9766103115 > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogee

Re: [algogeeks] MICROSOFT IDC

2011-09-22 Thread Suraj Fale
Congrats !!!1 -- Regards Suraj Fale +91-9766103115 -- 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...@goog

Re: [algogeeks] MICROSOFT IDC

2011-09-21 Thread vishwa
congrts!! On Thu, Sep 22, 2011 at 10:09 AM, Sanjay Rajpal wrote: > Hey saurabh, many many congratulations to u. > > Would u plz tell about the level of difficulty of questions asked in > Interview round and also the kind of people they want ? > Sanju > :) > > > > On Wed, Sep 21, 2011 at 8:26

Re: [algogeeks] MICROSOFT IDC

2011-09-21 Thread Sanjay Rajpal
Hey saurabh, many many congratulations to u. Would u plz tell about the level of difficulty of questions asked in Interview round and also the kind of people they want ? Sanju :) On Wed, Sep 21, 2011 at 8:26 PM, saurabh wrote: > I sincerely thank this group as i got selected in MSIDC only bec

[algogeeks] MICROSOFT IDC

2011-09-21 Thread saurabh
I sincerely thank this group as i got selected in MSIDC only because of this group . It was a wonderful experience for me at the interviews because the some of questions were closely related to the questions discussed here . And i also got to know about book "Crackin the Coding Interviews" which i

Re: [algogeeks] Microsoft Question

2011-09-18 Thread Anup Ghatage
For the mentioned scenario, it seems to be the only feasible solution. On Sun, Sep 18, 2011 at 3:57 AM, bharatkumar bagana < bagana.bharatku...@gmail.com> wrote: > @anup : the time complexity will be very high ... O(n*M*M)...n=#characters > to be checked...M=size of the matrix ... > > > On Sat, S

  1   2   3   4   5   >