Re: [algogeeks] Microsoft Interview Question

2012-10-18 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 make more clear it
 pls..

 here is my doubt..

 take input matrix and one temp visited matrix which stores the visited
 path.
 eg:
 1  1  0  0  0
 1  1  0  0  0
 0  1  1  1  0
 0  1  1  1  0
 0  0  1  1  1

 Suppose i want to find the number of paths between M[4][2] - M[0][0]
 First i explore path M[4][2]-M[4][3]-M[3][3] and so on... your program
 set 1 on visited matrix... on corresponding V[i][j] entries
 next time i explore the path  M[4][2]-M[3][2]-M[3][3]... but here we
 found that V[3][3]=1 so we can't take this in put path... but actually both
 are different paths..
 how you will ensure this. because we are maintaining only one visited
 matrix.






 On Wed, Oct 17, 2012 at 7:54 AM, Navin Kumar algorithm.i...@gmail.comwrote:

 @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 
 patlerahulku...@gmail.com wrote:

 @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 chances 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  0  0
 0  1  1  0  0
 0  1  1  0  0
 0  0  1  1  1

 you can see that object can take path
 M[0][0] - M[0][1] - M[1][1]- M[1][2]- M[][]- M[][]
 OR
 M[0][0] - M[1][0] - M[1][1]- M[1][2]- M[][]- M[][]
 But simple approach will also take path
 M[0][0] - M[0][1] - M[1][1]- M[1][0]- M[0][0]- M[0][1]  --
 CYCLE

 how you will avoid these cycles...

 On Tue, Oct 16, 2012 at 8:58 AM, atul anand atul.87fri...@gmail.comwrote:

 http://www.geeksforgeeks.org/archives/13376


 On Tue, Oct 16, 2012 at 8:56 AM, atul anand atul.87fri...@gmail.comwrote:

 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 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
  0 0 1 1

 If there is a block it’s represented by 0.
 If there is a path it’s represented by 1.



 --
 Thanks and Regards:
 Rahul Kumar Patle
 M.Tech, School of Information Technology
 Indian Institute of Technology, Kharagpur-721302, 
 Indiahttp://www.iitkgp.ac.in/
 Mobile No: +91-8798049298, +91-9424738542
 Alternate Email: rahulkumarpa...@hotmail.com
 [image: 
 Linkedin]http://www.linkedin.com/profile/view?id=106245716trk=tab_pro
 [image: Twitter] https://twitter.com/rahulkumarpatle
 https://www.facebook.com/rkpatle

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.



  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Thanks and Regards:
 Rahul Kumar Patle
 M.Tech, School of Information Technology
 Indian Institute of Technology, Kharagpur-721302, 
 Indiahttp://www.iitkgp.ac.in/
 Mobile No: +91-8798049298, +91-9424738542
 Alternate Email: rahulkumarpa...@hotmail.com
 [image: 
 Linkedin]http://www.linkedin.com/profile/view?id=106245716trk=tab_pro
 [image: Twitter] https://twitter.com/rahulkumarpatle
 https://www.facebook.com/rkpatle

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 

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  0  0
0  1  1  0  0
0  1  1  0  0
0  0  1  1  1

you can see that object can take path
M[0][0] - M[0][1] - M[1][1]- M[1][2]- M[][]- M[][]
OR
M[0][0] - M[1][0] - M[1][1]- M[1][2]- M[][]- M[][]
But simple approach will also take path
M[0][0] - M[0][1] - M[1][1]- M[1][0]- M[0][0]- M[0][1]  -- CYCLE

how you will avoid these cycles...

On Tue, Oct 16, 2012 at 8:58 AM, atul anand atul.87fri...@gmail.com wrote:

 http://www.geeksforgeeks.org/archives/13376


 On Tue, Oct 16, 2012 at 8:56 AM, atul anand atul.87fri...@gmail.comwrote:

 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 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
 0 0 1 1

 If there is a block it’s represented by 0.
 If there is a path it’s represented by 1.



 --
 Thanks and Regards:
 Rahul Kumar Patle
 M.Tech, School of Information Technology
 Indian Institute of Technology, Kharagpur-721302, 
 Indiahttp://www.iitkgp.ac.in/
 Mobile No: +91-8798049298, +91-9424738542
 Alternate Email: rahulkumarpa...@hotmail.com
 [image: 
 Linkedin]http://www.linkedin.com/profile/view?id=106245716trk=tab_pro
 [image: Twitter] https://twitter.com/rahulkumarpatle
 https://www.facebook.com/rkpatle

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.



  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Thanks and Regards:
Rahul Kumar Patle
M.Tech, School of Information Technology
Indian Institute of Technology, Kharagpur-721302,
Indiahttp://www.iitkgp.ac.in/
Mobile No: +91-8798049298, +91-9424738542
Alternate Email: rahulkumarpa...@hotmail.com
[image: Linkedin]http://www.linkedin.com/profile/view?id=106245716trk=tab_pro
[image: Twitter] https://twitter.com/rahulkumarpatle
https://www.facebook.com/rkpatle

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 
patlerahulku...@gmail.com wrote:

 @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
 chances 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  0  0
 0  1  1  0  0
 0  1  1  0  0
 0  0  1  1  1

 you can see that object can take path
 M[0][0] - M[0][1] - M[1][1]- M[1][2]- M[][]- M[][]
 OR
 M[0][0] - M[1][0] - M[1][1]- M[1][2]- M[][]- M[][]
 But simple approach will also take path
 M[0][0] - M[0][1] - M[1][1]- M[1][0]- M[0][0]- M[0][1]  -- CYCLE

 how you will avoid these cycles...

 On Tue, Oct 16, 2012 at 8:58 AM, atul anand atul.87fri...@gmail.comwrote:

 http://www.geeksforgeeks.org/archives/13376


 On Tue, Oct 16, 2012 at 8:56 AM, atul anand atul.87fri...@gmail.comwrote:

 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 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
0 0 1 1

 If there is a block it’s represented by 0.
 If there is a path it’s represented by 1.



 --
 Thanks and Regards:
 Rahul Kumar Patle
 M.Tech, School of Information Technology
 Indian Institute of Technology, Kharagpur-721302, 
 Indiahttp://www.iitkgp.ac.in/
 Mobile No: +91-8798049298, +91-9424738542
 Alternate Email: rahulkumarpa...@hotmail.com
 [image: 
 Linkedin]http://www.linkedin.com/profile/view?id=106245716trk=tab_pro
 [image: Twitter] https://twitter.com/rahulkumarpatle
 https://www.facebook.com/rkpatle

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.



  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Thanks and Regards:
 Rahul Kumar Patle
 M.Tech, School of Information Technology
 Indian Institute of Technology, Kharagpur-721302, 
 Indiahttp://www.iitkgp.ac.in/
 Mobile No: +91-8798049298, +91-9424738542
 Alternate Email: rahulkumarpa...@hotmail.com
 [image: 
 Linkedin]http://www.linkedin.com/profile/view?id=106245716trk=tab_pro
 [image: Twitter] https://twitter.com/rahulkumarpatle
 https://www.facebook.com/rkpatle

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 Patle 
patlerahulku...@gmail.com wrote:

 @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
 chances 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  0  0
 0  1  1  0  0
 0  1  1  0  0
 0  0  1  1  1

 you can see that object can take path
 M[0][0] - M[0][1] - M[1][1]- M[1][2]- M[][]- M[][]
 OR
 M[0][0] - M[1][0] - M[1][1]- M[1][2]- M[][]- M[][]
 But simple approach will also take path
 M[0][0] - M[0][1] - M[1][1]- M[1][0]- M[0][0]- M[0][1]  -- CYCLE

 how you will avoid these cycles...

 On Tue, Oct 16, 2012 at 8:58 AM, atul anand atul.87fri...@gmail.comwrote:

 http://www.geeksforgeeks.org/archives/13376


 On Tue, Oct 16, 2012 at 8:56 AM, atul anand atul.87fri...@gmail.comwrote:

 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 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
0 0 1 1

 If there is a block it’s represented by 0.
 If there is a path it’s represented by 1.



 --
 Thanks and Regards:
 Rahul Kumar Patle
 M.Tech, School of Information Technology
 Indian Institute of Technology, Kharagpur-721302, 
 Indiahttp://www.iitkgp.ac.in/
 Mobile No: +91-8798049298, +91-9424738542
 Alternate Email: rahulkumarpa...@hotmail.com
 [image: 
 Linkedin]http://www.linkedin.com/profile/view?id=106245716trk=tab_pro
 [image: Twitter] https://twitter.com/rahulkumarpatle
 https://www.facebook.com/rkpatle

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.



  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Thanks and Regards:
 Rahul Kumar Patle
 M.Tech, School of Information Technology
 Indian Institute of Technology, Kharagpur-721302, 
 Indiahttp://www.iitkgp.ac.in/
 Mobile No: +91-8798049298, +91-9424738542
 Alternate Email: rahulkumarpa...@hotmail.com
 [image: 
 Linkedin]http://www.linkedin.com/profile/view?id=106245716trk=tab_pro
 [image: Twitter] https://twitter.com/rahulkumarpatle
 https://www.facebook.com/rkpatle

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



[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
0 0 1 1

If there is a block it’s represented by 0.
If there is a path it’s represented by 1.



-- 
Thanks and Regards:
Rahul Kumar Patle
M.Tech, School of Information Technology
Indian Institute of Technology, Kharagpur-721302,
Indiahttp://www.iitkgp.ac.in/
Mobile No: +91-8798049298, +91-9424738542
Alternate Email: rahulkumarpa...@hotmail.com
[image: Linkedin]http://www.linkedin.com/profile/view?id=106245716trk=tab_pro
[image: Twitter] https://twitter.com/rahulkumarpatle
https://www.facebook.com/rkpatle

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 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
   0 0 1 1

 If there is a block it’s represented by 0.
 If there is a path it’s represented by 1.



 --
 Thanks and Regards:
 Rahul Kumar Patle
 M.Tech, School of Information Technology
 Indian Institute of Technology, Kharagpur-721302, 
 Indiahttp://www.iitkgp.ac.in/
 Mobile No: +91-8798049298, +91-9424738542
 Alternate Email: rahulkumarpa...@hotmail.com
 [image: 
 Linkedin]http://www.linkedin.com/profile/view?id=106245716trk=tab_pro
 [image: Twitter] https://twitter.com/rahulkumarpatle
 https://www.facebook.com/rkpatle

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 atul.87fri...@gmail.com 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 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
  0 0 1 1

 If there is a block it’s represented by 0.
 If there is a path it’s represented by 1.



 --
 Thanks and Regards:
 Rahul Kumar Patle
 M.Tech, School of Information Technology
 Indian Institute of Technology, Kharagpur-721302, 
 Indiahttp://www.iitkgp.ac.in/
 Mobile No: +91-8798049298, +91-9424738542
 Alternate Email: rahulkumarpa...@hotmail.com
 [image: 
 Linkedin]http://www.linkedin.com/profile/view?id=106245716trk=tab_pro
 [image: Twitter] https://twitter.com/rahulkumarpatle
 https://www.facebook.com/rkpatle

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 shashiski...@gmail.com wrote:

 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, Rahul Kumar Patle 
 patlerahulku...@gmail.com wrote:

 @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
 second marker on current...
 suppose and the last if you don't get the second violation then 2nd
 marker will the current node of first violation...
 as in your case when we got first violation at node prev = 20 and current
 = 10.. mark first point at 20 and second pointer at 10.. at the last the
 2nd pointer does not get change...
 i have checked this with other test cases.. this case is coming only when
 previous and current are the consecutive nodes(parent and its direct child)
 and one of the node is leaf node...

 On Tue, Sep 4, 2012 at 1:22 AM, atul anand atul.87fri...@gmail.comwrote:

 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 atul.87fri...@gmail.com wrote:
  @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=allocate(60);
  root-left-right-right=allocate(65);
  root-left-right-left=allocate(55);
 
  now suppose node(20) and node(10) get swapped
 
  inorder of given tree is :-
  20 10 25 50 55 60 65 70 75
 
  now first violation is at node(20)
  but you wont get second voilation...because rest is in inc order.
 
  yes , it can be done by taking care of root of that first violation.
 
 
  On 9/3/12, Rahul Kumar Patle patlerahulku...@gmail.com wrote:
  @bharat: +1
  i have tried some test cases.. working finely.. @anyone pls verify??
 
  On Mon, Sep 3, 2012 at 11:58 AM, bharat b
  bagana.bharatku...@gmail.comwrote:
 
  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-by-side elements .. swap them ..
 
  Hope works .. If I miss any case .. correct me
  thanks,
 
 
  On Sun, Sep 2, 2012 at 7:45 PM, Rahul Kumar Patle 
  patlerahulku...@gmail.com wrote:
 
  @navin: can u explain ur algorithms in words pls..
 
  On Sun, Sep 2, 2012 at 5:53 PM, Navin Kumar
  algorithm.i...@gmail.comwrote:
 
  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;
swap((temp1-data), (temp2-data));
flag = 1;
prev = temp1;
}
else if(!temp3  prev  root-data  prev-data) {
temp3 = root;
swap((temp1-data), (temp2-data));
swap((temp1-data), (temp3-data));
found = 1;
return;
}
if(!flag)
   prev = root;
correctBST(root-right);
}
  }
 
  On Sun, Sep 2, 2012 at 4:02 PM, Rahul Kumar Patle 
  patlerahulku...@gmail.com wrote:
 
  help to solve the following..
  Question: Two of the nodes of a BST are swapped. Correct the BST
  (taken
  from GeekforGeeks http://www.geeksforgeeks.org/archives/23272
 2nd
  online test 3rd question)
 
 
 
 
  --
  Thanks and Regards:
  Rahul Kumar
  Patle
 http://www.linkedin.com/profile/view?id=106245716trk=tab_pro
  M.Tech, School of Information Technology
  Indian Institute of Technology, Kharagpur-721302,
  Indiahttp://www.iitkgp.ac.in/
  Mobile No: +91-8798049298, +91-9424738542
  Alternate Email: rahulkumarpa...@hotmail.com
 
   --
  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 this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
   --
  

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.
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.



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, Rahul Kumar Patle patlerahulku...@gmail.com
 wrote:

 @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
 second marker on current...
 suppose and the last if you don't get the second violation then 2nd marker
 will the current node of first violation...
 as in your case when we got first violation at node prev = 20 and current
 = 10.. mark first point at 20 and second pointer at 10.. at the last the
 2nd pointer does not get change...
 i have checked this with other test cases.. this case is coming only when
 previous and current are the consecutive nodes(parent and its direct child)
 and one of the node is leaf node...

 On Tue, Sep 4, 2012 at 1:22 AM, atul anand atul.87fri...@gmail.comwrote:

 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 atul.87fri...@gmail.com wrote:
  @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=allocate(60);
  root-left-right-right=allocate(65);
  root-left-right-left=allocate(55);
 
  now suppose node(20) and node(10) get swapped
 
  inorder of given tree is :-
  20 10 25 50 55 60 65 70 75
 
  now first violation is at node(20)
  but you wont get second voilation...because rest is in inc order.
 
  yes , it can be done by taking care of root of that first violation.
 
 
  On 9/3/12, Rahul Kumar Patle patlerahulku...@gmail.com wrote:
  @bharat: +1
  i have tried some test cases.. working finely.. @anyone pls verify??
 
  On Mon, Sep 3, 2012 at 11:58 AM, bharat b
  bagana.bharatku...@gmail.comwrote:
 
  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-by-side elements .. swap them ..
 
  Hope works .. If I miss any case .. correct me
  thanks,
 
 
  On Sun, Sep 2, 2012 at 7:45 PM, Rahul Kumar Patle 
  patlerahulku...@gmail.com wrote:
 
  @navin: can u explain ur algorithms in words pls..
 
  On Sun, Sep 2, 2012 at 5:53 PM, Navin Kumar
  algorithm.i...@gmail.comwrote:
 
  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;
swap((temp1-data), (temp2-data));
flag = 1;
prev = temp1;
}
else if(!temp3  prev  root-data  prev-data) {
temp3 = root;
swap((temp1-data), (temp2-data));
swap((temp1-data), (temp3-data));
found = 1;
return;
}
if(!flag)
   prev = root;
correctBST(root-right);
}
  }
 
  On Sun, Sep 2, 2012 at 4:02 PM, Rahul Kumar Patle 
  patlerahulku...@gmail.com wrote:
 
  help to solve the following..
  Question: Two of the nodes of a BST are swapped. Correct the BST
  (taken
  from GeekforGeeks http://www.geeksforgeeks.org/archives/23272
 2nd
  online test 3rd question)
 
 
 
 
  --
  Thanks and Regards:
  Rahul Kumar
  Patle
 http://www.linkedin.com/profile/view?id=106245716trk=tab_pro
  M.Tech, School of Information Technology
  Indian Institute of Technology, Kharagpur-721302,
  Indiahttp://www.iitkgp.ac.in/
  Mobile No: +91-8798049298, +91-9424738542
  Alternate Email: rahulkumarpa...@hotmail.com
 
   --
  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 this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
   --
  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] 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 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.



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 prevcurnext ordering maintained
if not then make it in proper order ,although whole tree has to be
traversed to fix it.





*Shashi Kant *
***Think positive and find fuel in failure*
http://thinkndoawesome.blogspot.com/
*System/Software Engineer*
*Hewlett-Packard India Software Operations.
*



On Wed, Sep 5, 2012 at 12:43 PM, atul anand atul.87fri...@gmail.com wrote:

 @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 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.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 shashiski...@gmail.com wrote:

 well in that case there can be simpler ways to do it
 do an inorder traversal  while checking prevcurnext ordering maintained
 if not then make it in proper order ,although whole tree has to be
 traversed to fix it.





 *Shashi Kant *
 ***Think positive and find fuel in failure*
 http://thinkndoawesome.blogspot.com/
 *System/Software Engineer*
 *Hewlett-Packard India Software Operations.
 *



 On Wed, Sep 5, 2012 at 12:43 PM, atul anand atul.87fri...@gmail.comwrote:

 @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 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.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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
second marker on current...
suppose and the last if you don't get the second violation then 2nd marker
will the current node of first violation...
as in your case when we got first violation at node prev = 20 and current =
10.. mark first point at 20 and second pointer at 10.. at the last the 2nd
pointer does not get change...
i have checked this with other test cases.. this case is coming only when
previous and current are the consecutive nodes(parent and its direct child)
and one of the node is leaf node...

On Tue, Sep 4, 2012 at 1:22 AM, atul anand atul.87fri...@gmail.com wrote:

 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 atul.87fri...@gmail.com wrote:
  @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=allocate(60);
  root-left-right-right=allocate(65);
  root-left-right-left=allocate(55);
 
  now suppose node(20) and node(10) get swapped
 
  inorder of given tree is :-
  20 10 25 50 55 60 65 70 75
 
  now first violation is at node(20)
  but you wont get second voilation...because rest is in inc order.
 
  yes , it can be done by taking care of root of that first violation.
 
 
  On 9/3/12, Rahul Kumar Patle patlerahulku...@gmail.com wrote:
  @bharat: +1
  i have tried some test cases.. working finely.. @anyone pls verify??
 
  On Mon, Sep 3, 2012 at 11:58 AM, bharat b
  bagana.bharatku...@gmail.comwrote:
 
  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-by-side elements .. swap them ..
 
  Hope works .. If I miss any case .. correct me
  thanks,
 
 
  On Sun, Sep 2, 2012 at 7:45 PM, Rahul Kumar Patle 
  patlerahulku...@gmail.com wrote:
 
  @navin: can u explain ur algorithms in words pls..
 
  On Sun, Sep 2, 2012 at 5:53 PM, Navin Kumar
  algorithm.i...@gmail.comwrote:
 
  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;
swap((temp1-data), (temp2-data));
flag = 1;
prev = temp1;
}
else if(!temp3  prev  root-data  prev-data) {
temp3 = root;
swap((temp1-data), (temp2-data));
swap((temp1-data), (temp3-data));
found = 1;
return;
}
if(!flag)
   prev = root;
correctBST(root-right);
}
  }
 
  On Sun, Sep 2, 2012 at 4:02 PM, Rahul Kumar Patle 
  patlerahulku...@gmail.com wrote:
 
  help to solve the following..
  Question: Two of the nodes of a BST are swapped. Correct the BST
  (taken
  from GeekforGeeks http://www.geeksforgeeks.org/archives/23272 2nd
  online test 3rd question)
 
 
 
 
  --
  Thanks and Regards:
  Rahul Kumar
  Patlehttp://www.linkedin.com/profile/view?id=106245716trk=tab_pro
 
  M.Tech, School of Information Technology
  Indian Institute of Technology, Kharagpur-721302,
  Indiahttp://www.iitkgp.ac.in/
  Mobile No: +91-8798049298, +91-9424738542
  Alternate Email: rahulkumarpa...@hotmail.com
 
   --
  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 this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
   --
  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 this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
 
 
  --
  Thanks and Regards:
  Rahul Kumar
  Patlehttp://www.linkedin.com/profile/view?id=106245716trk=tab_pro
  M.Tech, School of Information Technology
  Indian Institute of Technology, Kharagpur-721302,
  

Re: [algogeeks] Microsoft written test question

2012-09-03 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-by-side elements .. swap them ..

Hope works .. If I miss any case .. correct me
thanks,

On Sun, Sep 2, 2012 at 7:45 PM, Rahul Kumar Patle patlerahulku...@gmail.com
 wrote:

 @navin: can u explain ur algorithms in words pls..

 On Sun, Sep 2, 2012 at 5:53 PM, Navin Kumar algorithm.i...@gmail.comwrote:

 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;
   swap((temp1-data), (temp2-data));
   flag = 1;
   prev = temp1;
   }
   else if(!temp3  prev  root-data  prev-data) {
   temp3 = root;
   swap((temp1-data), (temp2-data));
   swap((temp1-data), (temp3-data));
   found = 1;
   return;
   }
   if(!flag)
  prev = root;
   correctBST(root-right);
   }
 }

 On Sun, Sep 2, 2012 at 4:02 PM, Rahul Kumar Patle 
 patlerahulku...@gmail.com wrote:

 help to solve the following..
 Question: Two of the nodes of a BST are swapped. Correct the BST (taken
 from GeekforGeeks http://www.geeksforgeeks.org/archives/23272 2nd
 online test 3rd question)




 --
 Thanks and Regards:
 Rahul Kumar 
 Patlehttp://www.linkedin.com/profile/view?id=106245716trk=tab_pro
 M.Tech, School of Information Technology
 Indian Institute of Technology, Kharagpur-721302, 
 Indiahttp://www.iitkgp.ac.in/
 Mobile No: +91-8798049298, +91-9424738542
 Alternate Email: rahulkumarpa...@hotmail.com

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Thanks and Regards:
 Rahul Kumar 
 Patlehttp://www.linkedin.com/profile/view?id=106245716trk=tab_pro
 M.Tech, School of Information Technology
 Indian Institute of Technology, Kharagpur-721302, 
 Indiahttp://www.iitkgp.ac.in/
 Mobile No: +91-8798049298, +91-9424738542
 Alternate Email: rahulkumarpa...@hotmail.com

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 bagana.bharatku...@gmail.comwrote:

 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-by-side elements .. swap them ..

 Hope works .. If I miss any case .. correct me
 thanks,


 On Sun, Sep 2, 2012 at 7:45 PM, Rahul Kumar Patle 
 patlerahulku...@gmail.com wrote:

 @navin: can u explain ur algorithms in words pls..

 On Sun, Sep 2, 2012 at 5:53 PM, Navin Kumar algorithm.i...@gmail.comwrote:

 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;
   swap((temp1-data), (temp2-data));
   flag = 1;
   prev = temp1;
   }
   else if(!temp3  prev  root-data  prev-data) {
   temp3 = root;
   swap((temp1-data), (temp2-data));
   swap((temp1-data), (temp3-data));
   found = 1;
   return;
   }
   if(!flag)
  prev = root;
   correctBST(root-right);
   }
 }

 On Sun, Sep 2, 2012 at 4:02 PM, Rahul Kumar Patle 
 patlerahulku...@gmail.com wrote:

 help to solve the following..
 Question: Two of the nodes of a BST are swapped. Correct the BST (taken
 from GeekforGeeks http://www.geeksforgeeks.org/archives/23272 2nd
 online test 3rd question)




 --
 Thanks and Regards:
 Rahul Kumar 
 Patlehttp://www.linkedin.com/profile/view?id=106245716trk=tab_pro
 M.Tech, School of Information Technology
 Indian Institute of Technology, Kharagpur-721302, 
 Indiahttp://www.iitkgp.ac.in/
 Mobile No: +91-8798049298, +91-9424738542
 Alternate Email: rahulkumarpa...@hotmail.com

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Thanks and Regards:
 Rahul Kumar 
 Patlehttp://www.linkedin.com/profile/view?id=106245716trk=tab_pro
 M.Tech, School of Information Technology
 Indian Institute of Technology, Kharagpur-721302, 
 Indiahttp://www.iitkgp.ac.in/
 Mobile No: +91-8798049298, +91-9424738542
 Alternate Email: rahulkumarpa...@hotmail.com

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Thanks and Regards:
Rahul Kumar Patlehttp://www.linkedin.com/profile/view?id=106245716trk=tab_pro
M.Tech, School of Information Technology
Indian Institute of Technology, Kharagpur-721302,
Indiahttp://www.iitkgp.ac.in/
Mobile No: +91-8798049298, +91-9424738542
Alternate Email: rahulkumarpa...@hotmail.com

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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=allocate(60);
root-left-right-right=allocate(65);
root-left-right-left=allocate(55);

now suppose node(20) and node(10) get swapped

inorder of given tree is :-
20 10 25 50 55 60 65 70 75

now first violation is at node(20)
but you wont get second voilation...because rest is in inc order.

yes , it can be done by taking care of root of that first violation.


On 9/3/12, Rahul Kumar Patle patlerahulku...@gmail.com wrote:
 @bharat: +1
 i have tried some test cases.. working finely.. @anyone pls verify??

 On Mon, Sep 3, 2012 at 11:58 AM, bharat b
 bagana.bharatku...@gmail.comwrote:

 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-by-side elements .. swap them ..

 Hope works .. If I miss any case .. correct me
 thanks,


 On Sun, Sep 2, 2012 at 7:45 PM, Rahul Kumar Patle 
 patlerahulku...@gmail.com wrote:

 @navin: can u explain ur algorithms in words pls..

 On Sun, Sep 2, 2012 at 5:53 PM, Navin Kumar
 algorithm.i...@gmail.comwrote:

 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;
   swap((temp1-data), (temp2-data));
   flag = 1;
   prev = temp1;
   }
   else if(!temp3  prev  root-data  prev-data) {
   temp3 = root;
   swap((temp1-data), (temp2-data));
   swap((temp1-data), (temp3-data));
   found = 1;
   return;
   }
   if(!flag)
  prev = root;
   correctBST(root-right);
   }
 }

 On Sun, Sep 2, 2012 at 4:02 PM, Rahul Kumar Patle 
 patlerahulku...@gmail.com wrote:

 help to solve the following..
 Question: Two of the nodes of a BST are swapped. Correct the BST
 (taken
 from GeekforGeeks http://www.geeksforgeeks.org/archives/23272 2nd
 online test 3rd question)




 --
 Thanks and Regards:
 Rahul Kumar
 Patlehttp://www.linkedin.com/profile/view?id=106245716trk=tab_pro
 M.Tech, School of Information Technology
 Indian Institute of Technology, Kharagpur-721302,
 Indiahttp://www.iitkgp.ac.in/
 Mobile No: +91-8798049298, +91-9424738542
 Alternate Email: rahulkumarpa...@hotmail.com

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Thanks and Regards:
 Rahul Kumar
 Patlehttp://www.linkedin.com/profile/view?id=106245716trk=tab_pro
 M.Tech, School of Information Technology
 Indian Institute of Technology, Kharagpur-721302,
 Indiahttp://www.iitkgp.ac.in/
 Mobile No: +91-8798049298, +91-9424738542
 Alternate Email: rahulkumarpa...@hotmail.com

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Thanks and Regards:
 Rahul Kumar
 Patlehttp://www.linkedin.com/profile/view?id=106245716trk=tab_pro
 M.Tech, School of Information Technology
 Indian Institute of Technology, Kharagpur-721302,
 Indiahttp://www.iitkgp.ac.in/
 Mobile No: +91-8798049298, +91-9424738542
 Alternate Email: rahulkumarpa...@hotmail.com

 --
 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 

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 atul.87fri...@gmail.com wrote:
 @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=allocate(60);
 root-left-right-right=allocate(65);
 root-left-right-left=allocate(55);

 now suppose node(20) and node(10) get swapped

 inorder of given tree is :-
 20 10 25 50 55 60 65 70 75

 now first violation is at node(20)
 but you wont get second voilation...because rest is in inc order.

 yes , it can be done by taking care of root of that first violation.


 On 9/3/12, Rahul Kumar Patle patlerahulku...@gmail.com wrote:
 @bharat: +1
 i have tried some test cases.. working finely.. @anyone pls verify??

 On Mon, Sep 3, 2012 at 11:58 AM, bharat b
 bagana.bharatku...@gmail.comwrote:

 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-by-side elements .. swap them ..

 Hope works .. If I miss any case .. correct me
 thanks,


 On Sun, Sep 2, 2012 at 7:45 PM, Rahul Kumar Patle 
 patlerahulku...@gmail.com wrote:

 @navin: can u explain ur algorithms in words pls..

 On Sun, Sep 2, 2012 at 5:53 PM, Navin Kumar
 algorithm.i...@gmail.comwrote:

 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;
   swap((temp1-data), (temp2-data));
   flag = 1;
   prev = temp1;
   }
   else if(!temp3  prev  root-data  prev-data) {
   temp3 = root;
   swap((temp1-data), (temp2-data));
   swap((temp1-data), (temp3-data));
   found = 1;
   return;
   }
   if(!flag)
  prev = root;
   correctBST(root-right);
   }
 }

 On Sun, Sep 2, 2012 at 4:02 PM, Rahul Kumar Patle 
 patlerahulku...@gmail.com wrote:

 help to solve the following..
 Question: Two of the nodes of a BST are swapped. Correct the BST
 (taken
 from GeekforGeeks http://www.geeksforgeeks.org/archives/23272 2nd
 online test 3rd question)




 --
 Thanks and Regards:
 Rahul Kumar
 Patlehttp://www.linkedin.com/profile/view?id=106245716trk=tab_pro
 M.Tech, School of Information Technology
 Indian Institute of Technology, Kharagpur-721302,
 Indiahttp://www.iitkgp.ac.in/
 Mobile No: +91-8798049298, +91-9424738542
 Alternate Email: rahulkumarpa...@hotmail.com

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Thanks and Regards:
 Rahul Kumar
 Patlehttp://www.linkedin.com/profile/view?id=106245716trk=tab_pro
 M.Tech, School of Information Technology
 Indian Institute of Technology, Kharagpur-721302,
 Indiahttp://www.iitkgp.ac.in/
 Mobile No: +91-8798049298, +91-9424738542
 Alternate Email: rahulkumarpa...@hotmail.com

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Thanks and Regards:
 Rahul Kumar
 Patlehttp://www.linkedin.com/profile/view?id=106245716trk=tab_pro
 M.Tech, School of Information Technology
 Indian Institute of Technology, Kharagpur-721302,
 

[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 http://www.geeksforgeeks.org/archives/23272 2nd online
test 3rd question)



-- 
Thanks and Regards:
Rahul Kumar Patlehttp://www.linkedin.com/profile/view?id=106245716trk=tab_pro
M.Tech, School of Information Technology
Indian Institute of Technology, Kharagpur-721302,
Indiahttp://www.iitkgp.ac.in/
Mobile No: +91-8798049298, +91-9424738542
Alternate Email: rahulkumarpa...@hotmail.com

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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;
  swap((temp1-data), (temp2-data));
  flag = 1;
  prev = temp1;
  }
  else if(!temp3  prev  root-data  prev-data) {
  temp3 = root;
  swap((temp1-data), (temp2-data));
  swap((temp1-data), (temp3-data));
  found = 1;
  return;
  }
  if(!flag)
 prev = root;
  correctBST(root-right);
  }
}

On Sun, Sep 2, 2012 at 4:02 PM, Rahul Kumar Patle patlerahulku...@gmail.com
 wrote:

 help to solve the following..
 Question: Two of the nodes of a BST are swapped. Correct the BST (taken
 from GeekforGeeks http://www.geeksforgeeks.org/archives/23272 2nd
 online test 3rd question)



 --
 Thanks and Regards:
 Rahul Kumar 
 Patlehttp://www.linkedin.com/profile/view?id=106245716trk=tab_pro
 M.Tech, School of Information Technology
 Indian Institute of Technology, Kharagpur-721302, 
 Indiahttp://www.iitkgp.ac.in/
 Mobile No: +91-8798049298, +91-9424738542
 Alternate Email: rahulkumarpa...@hotmail.com

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 algorithm.i...@gmail.comwrote:

 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;
   swap((temp1-data), (temp2-data));
   flag = 1;
   prev = temp1;
   }
   else if(!temp3  prev  root-data  prev-data) {
   temp3 = root;
   swap((temp1-data), (temp2-data));
   swap((temp1-data), (temp3-data));
   found = 1;
   return;
   }
   if(!flag)
  prev = root;
   correctBST(root-right);
   }
 }

 On Sun, Sep 2, 2012 at 4:02 PM, Rahul Kumar Patle 
 patlerahulku...@gmail.com wrote:

 help to solve the following..
 Question: Two of the nodes of a BST are swapped. Correct the BST (taken
 from GeekforGeeks http://www.geeksforgeeks.org/archives/23272 2nd
 online test 3rd question)




 --
 Thanks and Regards:
 Rahul Kumar 
 Patlehttp://www.linkedin.com/profile/view?id=106245716trk=tab_pro
 M.Tech, School of Information Technology
 Indian Institute of Technology, Kharagpur-721302, 
 Indiahttp://www.iitkgp.ac.in/
 Mobile No: +91-8798049298, +91-9424738542
 Alternate Email: rahulkumarpa...@hotmail.com

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Thanks and Regards:
Rahul Kumar Patlehttp://www.linkedin.com/profile/view?id=106245716trk=tab_pro
M.Tech, School of Information Technology
Indian Institute of Technology, Kharagpur-721302,
Indiahttp://www.iitkgp.ac.in/
Mobile No: +91-8798049298, +91-9424738542
Alternate Email: rahulkumarpa...@hotmail.com

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 abhi120@gmail.com wrote:

 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 this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/TOZP5gPhnnMJ.
 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.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



[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 this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/TOZP5gPhnnMJ.
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.



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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[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] except that element (i.e.) OUT[2] = A[0] *
A[1] * A[3] * ? * A[n-1].
 Constraint is one should not use division operator.

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 16, 2012 at 2:26 PM, Hariraman R rpharira...@gmail.com wrote:


 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] except that element (i.e.) OUT[2] = A[0] * A[1] * A[3] * ? * 
 A[n-1].
  Constraint is one should not use division operator.

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 atul.87fri...@gmail.com 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]
 temp2[i] = input[i] * input [i + 1] * input[i + 2]input[n];

 now out[i] = temp1[i-1] * temp2[i+1];


 On Thu, Aug 16, 2012 at 2:26 PM, Hariraman R rpharira...@gmail.comwrote:


 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] except that element (i.e.) OUT[2] = A[0] * A[1] * A[3] * ? 
 * A[n-1].
  Constraint is one should not use division operator.

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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-5, shady wrote:

 for n elements, space used - 2n
 can we do better ?

 On Thu, Aug 16, 2012 at 3:20 PM, atul anand atul.8...@gmail.comjavascript:
  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]
 temp2[i] = input[i] * input [i + 1] * input[i + 2]input[n];

 now out[i] = temp1[i-1] * temp2[i+1];


 On Thu, Aug 16, 2012 at 2:26 PM, Hariraman R rphar...@gmail.comjavascript:
  wrote:


 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] except that element (i.e.) OUT[2] = A[0] * A[1] * A[3] * ? 
 * A[n-1]. 
  Constraint is one should not use division operator.

  -- 
 You received this message because you are subscribed to the Google 
 Groups Algorithm Geeks group.
 To post to this group, send email to algo...@googlegroups.comjavascript:
 .
 To unsubscribe from this group, send email to 
 algogeeks+...@googlegroups.com javascript:.
 For more options, visit this group at 
 http://groups.google.com/group/algogeeks?hl=en.


  -- 
 You received this message because you are subscribed to the Google Groups 
 Algorithm Geeks group.
 To post to this group, send email to algo...@googlegroups.comjavascript:
 .
 To unsubscribe from this group, send email to 
 algogeeks+...@googlegroups.com javascript:.
 For more options, visit this group at 
 http://groups.google.com/group/algogeeks?hl=en.




-- 
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/-/u9VqcQM6sz0J.
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.



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* from this structure which means append each list pointed by
third pointer to original one such that it like simple *DLL*.


On Thu, Aug 2, 2012 at 5:45 PM, Navin Kumar algorithm.i...@gmail.comwrote:

 @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 abas...@gmail.com wrote:

 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 sahilgupta...@gmail.comwrote:

 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 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.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



[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 
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.



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 sahilgupta...@gmail.com 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.
 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
 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.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 abas...@gmail.com wrote:

 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 sahilgupta...@gmail.comwrote:

 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
 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.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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) {
if (pCurr-child) {
  pTail-next = pCurr-child;
  pCurr-child-prev = pTail;
  while (pTail-next) pTail = pTail-next;
}
pCurr= pCurr-next;
  }
  return pDLL;
}



Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652


On Thu, Aug 2, 2012 at 5:45 PM, Navin Kumar algorithm.i...@gmail.comwrote:

 @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 abas...@gmail.com wrote:

 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 sahilgupta...@gmail.comwrote:

 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 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.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 manishuntw...@gmail.comwrote:

 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 algorithm.i...@gmail.comwrote:

 @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
 list.

 struct node *buildBST(struct node *list)
 {
if(!list) return NULL;

struct node *middle = getMiddle(list);
middle-previous-next = NULL;
middle-previous = buildBST(list);
middle-next = buildBST(middle-next);
return middle;

 }

 On Tue, Jul 31, 2012 at 8:35 PM, Daksh Talwar dakshtal...@gmail.comwrote:

 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 nagapur...@gmail.comwrote:

 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, Tanuj Makkar
 tanujmakkar.de...@gmail.com wrote:
  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, Jul 29, 2012 at 9:58 PM, Purani Sekar nagapur...@gmail.com
 wrote:
 
  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 compiler will not be
  provided. It will be like typing a code in notepad.
 
 
  On Sun, Jul 29, 2012 at 4:56 PM, Sanchit Mittal
  since1991sanc...@gmail.com wrote:
   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 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 this group at
   http://groups.google.com/group/algogeeks?hl=en.
 
  --
  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 this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
  --
  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 this group at
  http://groups.google.com/group/algogeeks?hl=en.

 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 - - - - - - - - - - - -
 With Regards
 Daksh Talwar

 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 

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 dakshtal...@gmail.comwrote:

 @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 
 manishuntw...@gmail.comwrote:

 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 
 algorithm.i...@gmail.comwrote:

 @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 list.

 struct node *buildBST(struct node *list)
 {
if(!list) return NULL;

struct node *middle = getMiddle(list);
middle-previous-next = NULL;
middle-previous = buildBST(list);
middle-next = buildBST(middle-next);
return middle;

 }

 On Tue, Jul 31, 2012 at 8:35 PM, Daksh Talwar dakshtal...@gmail.comwrote:

 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 nagapur...@gmail.comwrote:

 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, Tanuj Makkar
 tanujmakkar.de...@gmail.com wrote:
  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, Jul 29, 2012 at 9:58 PM, Purani Sekar nagapur...@gmail.com
 wrote:
 
  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 compiler will not be
  provided. It will be like typing a code in notepad.
 
 
  On Sun, Jul 29, 2012 at 4:56 PM, Sanchit Mittal
  since1991sanc...@gmail.com wrote:
   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 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 this group at
   http://groups.google.com/group/algogeeks?hl=en.
 
  --
  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 this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
  --
  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 this group at
  http://groups.google.com/group/algogeeks?hl=en.

 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 - - - - - - - - - - - -
 With Regards
 Daksh Talwar

 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 

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, Tanuj Makkar
tanujmakkar.de...@gmail.com wrote:
 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, Jul 29, 2012 at 9:58 PM, Purani Sekar nagapur...@gmail.com wrote:

 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 compiler will not be
 provided. It will be like typing a code in notepad.


 On Sun, Jul 29, 2012 at 4:56 PM, Sanchit Mittal
 since1991sanc...@gmail.com wrote:
  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 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 this group at
  http://groups.google.com/group/algogeeks?hl=en.

 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 nagapur...@gmail.com wrote:

 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, Tanuj Makkar
 tanujmakkar.de...@gmail.com wrote:
  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, Jul 29, 2012 at 9:58 PM, Purani Sekar nagapur...@gmail.com
 wrote:
 
  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 compiler will not be
  provided. It will be like typing a code in notepad.
 
 
  On Sun, Jul 29, 2012 at 4:56 PM, Sanchit Mittal
  since1991sanc...@gmail.com wrote:
   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 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 this group at
   http://groups.google.com/group/algogeeks?hl=en.
 
  --
  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 this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
  --
  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 this group at
  http://groups.google.com/group/algogeeks?hl=en.

 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 nagapur...@gmail.com wrote:

 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, Tanuj Makkar
 tanujmakkar.de...@gmail.com wrote:
  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, Jul 29, 2012 at 9:58 PM, Purani Sekar nagapur...@gmail.com
 wrote:
 
  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 compiler will not be
  provided. It will be like typing a code in notepad.
 
 
  On Sun, Jul 29, 2012 at 4:56 PM, Sanchit Mittal
  since1991sanc...@gmail.com wrote:
   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 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 this group at
   http://groups.google.com/group/algogeeks?hl=en.
 
  --
  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 this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
  --
  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 this group at
  http://groups.google.com/group/algogeeks?hl=en.

 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
- - - - - - - - - - - -
With Regards
Daksh Talwar

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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
list.

struct node *buildBST(struct node *list)
{
   if(!list) return NULL;

   struct node *middle = getMiddle(list);
   middle-previous-next = NULL;
   middle-previous = buildBST(list);
   middle-next = buildBST(middle-next);
   return middle;
}

On Tue, Jul 31, 2012 at 8:35 PM, Daksh Talwar dakshtal...@gmail.com wrote:

 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 nagapur...@gmail.comwrote:

 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, Tanuj Makkar
 tanujmakkar.de...@gmail.com wrote:
  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, Jul 29, 2012 at 9:58 PM, Purani Sekar nagapur...@gmail.com
 wrote:
 
  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 compiler will not be
  provided. It will be like typing a code in notepad.
 
 
  On Sun, Jul 29, 2012 at 4:56 PM, Sanchit Mittal
  since1991sanc...@gmail.com wrote:
   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 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 this group at
   http://groups.google.com/group/algogeeks?hl=en.
 
  --
  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 this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
  --
  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 this group at
  http://groups.google.com/group/algogeeks?hl=en.

 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 - - - - - - - - - - - -
 With Regards
 Daksh Talwar

 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 algorithm.i...@gmail.comwrote:

 @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
 list.

 struct node *buildBST(struct node *list)
 {
if(!list) return NULL;

struct node *middle = getMiddle(list);
middle-previous-next = NULL;
middle-previous = buildBST(list);
middle-next = buildBST(middle-next);
return middle;

 }

 On Tue, Jul 31, 2012 at 8:35 PM, Daksh Talwar dakshtal...@gmail.comwrote:

 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 nagapur...@gmail.comwrote:

 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, Tanuj Makkar
 tanujmakkar.de...@gmail.com wrote:
  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, Jul 29, 2012 at 9:58 PM, Purani Sekar nagapur...@gmail.com
 wrote:
 
  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 compiler will not be
  provided. It will be like typing a code in notepad.
 
 
  On Sun, Jul 29, 2012 at 4:56 PM, Sanchit Mittal
  since1991sanc...@gmail.com wrote:
   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 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 this group at
   http://groups.google.com/group/algogeeks?hl=en.
 
  --
  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 this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
  --
  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 this group at
  http://groups.google.com/group/algogeeks?hl=en.

 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 - - - - - - - - - - - -
 With Regards
 Daksh Talwar

 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
With regards,
Manish kumar untwal
Indian Institute of Information Technology
Allahabad (2009-2013 batch)

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to 

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, Jul 29, 2012 at 9:58 PM, Purani Sekar nagapur...@gmail.com wrote:

 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 compiler will not be
 provided. It will be like typing a code in notepad.


 On Sun, Jul 29, 2012 at 4:56 PM, Sanchit Mittal
 since1991sanc...@gmail.com wrote:
  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 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 this group at
  http://groups.google.com/group/algogeeks?hl=en.

 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



[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 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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 compiler will not be
provided. It will be like typing a code in notepad.


On Sun, Jul 29, 2012 at 4:56 PM, Sanchit Mittal
since1991sanc...@gmail.com wrote:
 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 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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.
http://r1.wisestamp.com/r/landing?promo=17dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_17
CLICK
HERE.http://r1.wisestamp.com/r/landing?promo=17dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_17



On 29 July 2012 21:58, Purani Sekar nagapur...@gmail.com wrote:

 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 compiler will not be
 provided. It will be like typing a code in notepad.


 On Sun, Jul 29, 2012 at 4:56 PM, Sanchit Mittal
 since1991sanc...@gmail.com wrote:
  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 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 this group at
  http://groups.google.com/group/algogeeks?hl=en.

 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
*Piyush Khandelwal***
Placement Coordinator
( Computer Science  Engg.)
Contact No: 91-8447229204 / 91-9808479765

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Microsoft interview qs

2012-06-30 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 swinyanand...@gmail.comwrote:

 //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


 Now say if I add more strings of the form abcdpqr,abcdprst..How can
 I modify this code such that now thw o/p is

  d e
  e g h
  m n o
  p q r
  x y z
  d p q r
  d p r s t

 code in c :-
 http://ideone.com/rBvQb

 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 PM, shady sinv...@gmail.com wrote:

 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 swinyanand...@gmail.comwrote:

 //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


 Now say if I add more strings of the form abcdpqr,abcdprst..How can
 I modify this code such that now thw o/p is

  d e
  e g h
  m n o
  p q r
  x y z
  d p q r
  d p r s t

 code in c :-
 http://ideone.com/rBvQb

 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 fun :) :)

On 6/28/12, deepikaanand swinyanand...@gmail.com wrote:
 //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


 Now say if I add more strings of the form abcdpqr,abcdprst..How can
 I modify this code such that now thw o/p is

   d e
   e g h
   m n o
   p q r
   x y z
  d p q r
  d p r s t

 code in c :-
 http://ideone.com/rBvQb

 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



[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


Now say if I add more strings of the form abcdpqr,abcdprst..How can
I modify this code such that now thw o/p is

  d e
  e g h
  m n o
  p q r
  x y z
 d p q r
 d p r s t

code in c :-
http://ideone.com/rBvQb

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 sapraaks...@gmail.comwrote:

 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)
 *--*
 sapraaks...@gmail.com
 akshatsapr...@gmail.com
 rit20009008@ rit20009...@gmail.comiiita.ac.in

 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 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.



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)
*--*
sapraaks...@gmail.com
akshatsapr...@gmail.com
rit20009008@ rit20009...@gmail.comiiita.ac.in

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



[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 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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 prem.cmna...@gmail.comwrote:

 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 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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

http://gplus.to/amolsharma99
http://twitter.com/amolsharma99http://in.linkedin.com/pub/amol-sharma/21/79b/507http://www.simplyamol.blogspot.com/http://facebook.com/amolsharma99






On Sun, Jun 17, 2012 at 1:24 PM, Ashish Goel ashg...@gmail.com wrote:

 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 prem.cmna...@gmail.comwrote:

 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 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 ashg...@gmail.com wrote:

 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 prem.cmna...@gmail.comwrote:

 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 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 singh.amit...@gmail.comwrote:

 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 ashg...@gmail.com wrote:

 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 
 prem.cmna...@gmail.comwrote:

 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 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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(injn)
{
if(ji)
j=i+1;
else if(a[j]0a[i]0)
{
swap(a,j,i);
}
else
{
if(a[j]0)
j++;
else
i++;
}
}

}

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 gunees...@gmail.comwrote:

 void change(int a[],int n)
 {
 int i,j;
 i=0;
 j=1;

 while(injn)
 {
 if(ji)
 j=i+1;
 else if(a[j]0a[i]0)
 {
 swap(a,j,i);
 }
 else
 {
 if(a[j]0)
 j++;
 else
 i++;
 }
 }

 }

 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 counter. After complete traversal all negative values
will be in the temporary array.

3. Traverse again the given array. Repeat step 2 but this time for positive
numbers.

Finally temporary array contains the required answer. If required copy it
into original array.

As this approach takes max. 3 traversals so its complexity is O(n).

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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((in  j= 0)(ij))
{
if(a[i]0  a[j]0)
{
swap(a[i],a[j]);
i++; j--;
}
else
{
if(a[i]0)
i++;
if(a[j]0)
j--;
}

}

Thanks,
Mani

On Thu, Jun 14, 2012 at 1:05 PM, Mad Coder imamadco...@gmail.com wrote:


 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 counter. After complete traversal all negative values
 will be in the temporary array.

 3. Traverse again the given array. Repeat step 2 but this time for
 positive numbers.

 Finally temporary array contains the required answer. If required copy it
 into original array.

 As this approach takes max. 3 traversals so its complexity is O(n).

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Thanks  Regards,
Mani
http://www.sanidapa.com - The music Search engine

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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
manikantabab...@gmail.comwrote:

 Check this out, it works in O(n);

 int i = 0;
 int j = n-1;

 while((in  j= 0)(ij))
 {
 if(a[i]0  a[j]0)
 {
 swap(a[i],a[j]);
 i++; j--;
 }
 else
 {
 if(a[i]0)
 i++;
 if(a[j]0)
 j--;
 }

 }

 Thanks,
 Mani

 On Thu, Jun 14, 2012 at 1:05 PM, Mad Coder imamadco...@gmail.com wrote:


 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 counter. After complete traversal all negative values
 will be in the temporary array.

 3. Traverse again the given array. Repeat step 2 but this time for
 positive numbers.

 Finally temporary array contains the required answer. If required copy it
 into original array.

 As this approach takes max. 3 traversals so its complexity is O(n).

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Thanks  Regards,
 Mani
 http://www.sanidapa.com - The music Search engine

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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
of original array and insert all the elements of temp.
time comp-O(n), space comp-O(n)
correct me if i am wrong
On Thu, Jun 14, 2012 at 1:53 PM, saurabh singh saurab...@gmail.com wrote:

 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 manikantabab...@gmail.com
  wrote:

 Check this out, it works in O(n);

 int i = 0;
 int j = n-1;

 while((in  j= 0)(ij))
 {
 if(a[i]0  a[j]0)
 {
 swap(a[i],a[j]);
 i++; j--;
 }
 else
 {
 if(a[i]0)
 i++;
 if(a[j]0)
 j--;
 }

 }

 Thanks,
 Mani

 On Thu, Jun 14, 2012 at 1:05 PM, Mad Coder imamadco...@gmail.com wrote:


 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 counter. After complete traversal all negative values
 will be in the temporary array.

 3. Traverse again the given array. Repeat step 2 but this time for
 positive numbers.

 Finally temporary array contains the required answer. If required copy
 it into original array.

 As this approach takes max. 3 traversals so its complexity is O(n).

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Thanks  Regards,
 Mani
 http://www.sanidapa.com - The music Search engine

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Utsav Sharma,
NIT Allahabad

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 utsav.sharm...@gmail.comwrote:

 @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
 of original array and insert all the elements of temp.
 time comp-O(n), space comp-O(n)
 correct me if i am wrong

 On Thu, Jun 14, 2012 at 1:53 PM, saurabh singh saurab...@gmail.comwrote:

 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 
 manikantabab...@gmail.com wrote:

 Check this out, it works in O(n);

 int i = 0;
 int j = n-1;

 while((in  j= 0)(ij))
 {
 if(a[i]0  a[j]0)
 {
 swap(a[i],a[j]);
 i++; j--;
 }
 else
 {
 if(a[i]0)
 i++;
 if(a[j]0)
 j--;
 }

 }

 Thanks,
 Mani

 On Thu, Jun 14, 2012 at 1:05 PM, Mad Coder imamadco...@gmail.comwrote:


 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 counter. After complete traversal all negative
 values will be in the temporary array.

 3. Traverse again the given array. Repeat step 2 but this time for
 positive numbers.

 Finally temporary array contains the required answer. If required copy
 it into original array.

 As this approach takes max. 3 traversals so its complexity is O(n).

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Thanks  Regards,
 Mani
 http://www.sanidapa.com - The music Search engine

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Utsav Sharma,
 NIT Allahabad

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



[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 to the Google Groups 
Algorithm Geeks group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/PebCCcpUXpIJ.
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.



Re: [algogeeks] Microsoft Interview Question

2012-06-13 Thread Ashish Goel
int i=0;
int j=n-1;
while (ij) {
while (ij)  (a[i]=0) i++;
while (ij)  (a[j0) j--;
if (ij) swap(a[i],a[j]);
else break;
i++; j--;
}

Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652


On Wed, Jun 13, 2012 at 9:49 PM, Krishna Kishore
kknarenkris...@gmail.comwrote:

 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 to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/PebCCcpUXpIJ.
 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.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 saurabh...@gmail.com wrote:

 +1 Ashish solution



 --
 Thanks  Regards
 Saurabh Yadav




-- 
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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 saurabh...@gmail.com wrote:

 @shiv relate the ashish solution with quick sort then you will understand
 easily


 On Thu, Jun 14, 2012 at 2:06 AM, Saurabh Yadav saurabh...@gmail.comwrote:

 +1 Ashish solution



 --
 Thanks  Regards
 Saurabh Yadav




 --
 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...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
*Regards,*
*Piyush Kapoor,*
*2nd year,CSE
IT-BHU*

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 pkjee2...@gmail.com wrote:

  your solutions , order won't be maintained in your solutions.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 hpahuja.mn...@gmail.comwrote:

 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 number

   now array  a becomes  5 11 7
  array  b becomes  7 5 11

 now we take product of elements of array a and do the same with array  b
 elements
 if product is equal  then b is a permutation of a

 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 not

 shout loud if this has flaws :P

 -mithun



 On Sun, May 20, 2012 at 12:59 AM, HARSHIT PAHUJA 
 hpahuja.mn...@gmail.comwrote:

 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 number

   now array  a becomes  5 11 7
  array  b becomes  7 5 11   

 now we take product of elements of array a and do the same with array  b 
 elements  
 if product is equal  then b is a permutation of a

 -- 
 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 this group at 
 http://groups.google.com/group/algogeeks?hl=en.




-- 
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/-/M16KXaNqGnEJ.
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.



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 hpahuja.mn...@gmail.comwrote:

 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 number

   now array  a becomes  5 11 7
  array  b becomes  7 5 11

 now we take product of elements of array a and do the same with array  b
 elements
 if product is equal  then b is a permutation of a

 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 atul.87fri...@gmail.com 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 and arr2 == 0

 if all 3 condition are successful then..permutation found.

 On Sun, May 20, 2012 at 12:59 AM, HARSHIT PAHUJA 
 hpahuja.mn...@gmail.comwrote:

 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 number

   now array  a becomes  5 11 7
  array  b becomes  7 5 11

 now we take product of elements of array a and do the same with array  b
 elements
 if product is equal  then b is a permutation of a

 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
*DARPAN BAWEJA*
*3rd year, I.T*
*MNNIT Allahabad*

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



[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
number

  now array  a becomes  5 11 7
 array  b becomes  7 5 11

now we take product of elements of array a and do the same with array  b
elements
if product is equal  then b is a permutation of a

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 hpahuja.mn...@gmail.com 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 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 number

   now array  a becomes  5 11 7
  array  b becomes  7 5 11

 now we take product of elements of array a and do the same with array  b
 elements
 if product is equal  then b is a permutation of a

 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 m1234...@gmail.comwrote:

 method is ryt but to find ith prime u cannot to it in constant time.
  On May 19, 2012 7:30 PM, HARSHIT PAHUJA hpahuja.mn...@gmail.com
 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 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 number

   now array  a becomes  5 11 7
  array  b becomes  7 5 11

 now we take product of elements of array a and do the same with array  b
 elements
 if product is equal  then b is a permutation of a

 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
HARSHIT PAHUJA
M.N.N.I.T.
ALLAHABAD

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 hpahuja.mn...@gmail.com wrote:

 @malay ---  we can do it by precomputing the prime arrays
 

 On Sun, May 20, 2012 at 1:10 AM, malay chakrabarti m1234...@gmail.comwrote:

 method is ryt but to find ith prime u cannot to it in constant time.
  On May 19, 2012 7:30 PM, HARSHIT PAHUJA hpahuja.mn...@gmail.com
 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 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 number

   now array  a becomes  5 11 7
  array  b becomes  7 5 11

 now we take product of elements of array a and do the same with array  b
 elements
 if product is equal  then b is a permutation of a

 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 HARSHIT PAHUJA
 M.N.N.I.T.
 ALLAHABAD


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



[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 (the graph contains no cycles).


-- 
Umer

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 mihirk...@gmail.comwrote:

 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
 http://goo.gl/CvRcG

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



[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
http://goo.gl/CvRcG

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 ashg...@gmail.com wrote:

 without sorting, it will be mess...O(n^2)
 with recursion, it will be lot of stack space however since this is asked
 i would do it this way

 The only problem i see with this code is what if the lists are 1,2,1,2 AND
 2,1,1,1
 This code will give 2 common message twice and 1 common message 4 times



 struct node* sortAndMerge(struct node *a, struct node *b)
 {
   if !a return b;
   if !b return a;
   struct node *result = NULL;

   if (a-data =b-data)
 { result =a; result-next = sortAndMerge(a-next, b);}
   else  { result =b; result-next = sortAndMerge(b-next, a);}
   return result;
 }

 void merge(struct node **pL)
 {

 if (!(*pL) || !(*pL-next)) return NULL;
 struct node *a=NULL;
 struct node *b=NULL;
 split(*pL, a, b);
 merge(a); merge(b);
 sortAndMerge(a,b);
 }

 void intersect(struct node *a, struct node *b)
 {
   if (!a) || (!b) return;

   merge(a);
   merge(b);
   struct node * result = sortAndMerge(a,b);
   struct node *current =result;
   while (current)
   {
   if (current-data ==current-next-data) printf(%d  ,
 current-data);
   current = current-next;
}
 }


 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652


 On Wed, Jan 12, 2011 at 2:35 PM, Saurabh Koar saurabhkoar...@gmail.comwrote:

 I mean is it possible to solve the problem using recursion and without
 sorting? (in O(1) space and O(n^2) complexity? ). As he didnt say
 anything,I am just clearing my doubts.

 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 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.



Re: [algogeeks] Microsoft Question

2011-10-31 Thread Anup Ghatage
:)

On Tue, Nov 1, 2011 at 12:54 AM, WgpShashank shashank7andr...@gmail.comwrote:

 @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 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.




-- 
Anup Ghatage

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



[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 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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 jalsa.n.sa...@gmail.comwrote:

 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 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 rahul23111...@gmail.comwrote:

 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 jalsa.n.sa...@gmail.comwrote:

 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 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 sinv...@gmail.com wrote:

 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 rahul23111...@gmail.comwrote:

 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 jalsa.n.sa...@gmail.comwrote:

 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 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Microsoft

2011-10-01 Thread shady
ok, thanks :)

On Sun, Oct 2, 2011 at 10:35 AM, rahul sharma rahul23111...@gmail.comwrote:

 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 sinv...@gmail.com wrote:

 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 rahul23111...@gmail.comwrote:

 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 
 jalsa.n.sa...@gmail.comwrote:

 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 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 sah.saurab...@gmail.com wrote:

 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 is more than sufficient for any company interviews .

 Finally i thank all those group members who shared their experiences
 and others who replied to their queries .
 GOOD LUCK to all



 Saurabh Sah
 Final Year, B.Tech
 MNIT JAIPUR

 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] MICROSOFT IDC

2011-09-22 Thread teja bala
congrats dude

On Thu, Sep 22, 2011 at 12:46 PM, Suraj Fale surajfa...@gmail.com 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 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.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



[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 is more than sufficient for any company interviews .

Finally i thank all those group members who shared their experiences
and others who replied to their queries .
GOOD LUCK to all



Saurabh Sah
Final Year, B.Tech
MNIT JAIPUR

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 sah.saurab...@gmail.com wrote:

 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 is more than sufficient for any company interviews .

 Finally i thank all those group members who shared their experiences
 and others who replied to their queries .
 GOOD LUCK to all



 Saurabh Sah
 Final Year, B.Tech
 MNIT JAIPUR

 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] MICROSOFT IDC

2011-09-21 Thread vishwa
congrts!!

On Thu, Sep 22, 2011 at 10:09 AM, Sanjay Rajpal srn...@gmail.com 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 PM, saurabh sah.saurab...@gmail.com wrote:

 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 is more than sufficient for any company interviews .

 Finally i thank all those group members who shared their experiences
 and others who replied to their queries .
 GOOD LUCK to all



 Saurabh Sah
 Final Year, B.Tech
 MNIT JAIPUR

 --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



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, Sep 17, 2011 at 8:30 AM, Anup Ghatage ghat...@gmail.com wrote:

 As WgpShashank once pointed out.

 Search the whole matrix for the first character instances, for each
 instance, send the array, string and that char's position to a function that
 will recursively check its direct neighbors for the next character.
 Exhaustively check like that for each starting characters appearance till
 you find the string, if any.

 On Fri, Sep 16, 2011 at 11:55 PM, Ankur Garg ankurga...@gmail.comwrote:

 In a matrix of. characters, find an string. String can be in any way (all
 8 neighbours to be considered)
 like find Microsoft in below matrix.

  A
 C
 P
 *R
 *C*
 *X
 *S
 **O
 *P
 *C*
 V
 *O*
 V
 N
 *I*
 W
  G
 *F
 **M
 *N
 Q
  A
 *T*
 I
 T

  *Any Ideas How to Solve/Approach this problem ?*


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Anup Ghatage

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --

 **Please do not print this e-mail until urgent requirement. Go Green!!
 Save Papers = Save Trees
 *BharatKumar Bagana*
 **http://www.google.com/profiles/bagana.bharatkumarhttp://www.google.com/profiles/bagana.bharatkumar
 *
 Mobile +91 8056127652*
 bagana.bharatku...@gmail.com


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Anup Ghatage

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Microsoft Question

2011-09-17 Thread bharatkumar bagana
@anup : the time complexity will be very high ... O(n*M*M)...n=#characters
to be checked...M=size of the matrix ...

On Sat, Sep 17, 2011 at 8:30 AM, Anup Ghatage ghat...@gmail.com wrote:

 As WgpShashank once pointed out.

 Search the whole matrix for the first character instances, for each
 instance, send the array, string and that char's position to a function that
 will recursively check its direct neighbors for the next character.
 Exhaustively check like that for each starting characters appearance till
 you find the string, if any.

 On Fri, Sep 16, 2011 at 11:55 PM, Ankur Garg ankurga...@gmail.com wrote:

 In a matrix of. characters, find an string. String can be in any way (all
 8 neighbours to be considered)
 like find Microsoft in below matrix.

  A
 C
 P
 *R
 *C*
 *X
 *S
 **O
 *P
 *C*
 V
 *O*
 V
 N
 *I*
 W
 G
 *F
 **M
 *N
 Q
 A
 *T*
 I
 T

 *Any Ideas How to Solve/Approach this problem ?*


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Anup Ghatage

  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 

**Please do not print this e-mail until urgent requirement. Go Green!!
Save Papers = Save Trees
*BharatKumar Bagana*
**http://www.google.com/profiles/bagana.bharatkumarhttp://www.google.com/profiles/bagana.bharatkumar
*
Mobile +91 8056127652*
bagana.bharatku...@gmail.com

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Microsoft Question

2011-09-16 Thread Ankur Garg
 In a matrix of characters, find an string. String can be in any way (all 8
neighbours to be considered)
like find Microsoft in below matrix.

A
C
P
*R
*C*
*X
*S
**O
*P
*C*
V
*O*
V
N
*I*
W
G
*F
**M
*N
Q
A
*T*
I
T

*Any Ideas How to Solve/Approach this problem ?*

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Microsoft Question

2011-09-16 Thread Anup Ghatage
As WgpShashank once pointed out.

Search the whole matrix for the first character instances, for each
instance, send the array, string and that char's position to a function that
will recursively check its direct neighbors for the next character.
Exhaustively check like that for each starting characters appearance till
you find the string, if any.

On Fri, Sep 16, 2011 at 11:55 PM, Ankur Garg ankurga...@gmail.com wrote:

 In a matrix of characters, find an string. String can be in any way (all 8
 neighbours to be considered)
 like find Microsoft in below matrix.

  A
 C
 P
 *R
 *C*
 *X
 *S
 **O
 *P
 *C*
 V
 *O*
 V
 N
 *I*
 W
 G
 *F
 **M
 *N
 Q
 A
 *T*
 I
 T

 *Any Ideas How to Solve/Approach this problem ?*


  --
 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 this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Anup Ghatage

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Microsoft coming to PEC on 19th, any specific pattern for written test

2011-09-15 Thread ankurmittal
Hello Guys,

We have got news that Microsoft would be conducting just the written
test on our campus ( PEC, Chandigarh) on September 19.. I have gone
through all the discussion on this forum and haven't seen a thread
where only such type of test has been discussed.

According to the company only 1 hour written test would be taken and
nothing else and it seems that the guys from Microsoft wont be coming
some external agency would be conducting the test. So if someone could
shed some light on it, what the pattern would be and..

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Microsoft coming to PEC on 19th, any specific pattern for written test

2011-09-15 Thread vivek goel
hey ankur.

wat's eligibility criteria..
and eligible branches...
*mca* is eligible ??.

-- 
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 this group at 
http://groups.google.com/group/algogeeks?hl=en.



  1   2   3   4   >