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.



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



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

2011-07-20 Thread archita
How to reverse the order of bits of a number in minimum space
complexity?
if the no is 11-1011
the output should b 1101.

-- 
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-07-20 Thread Piyush Sinha
unsigned int reverse_bits (unsigned int n)
{
 if(n==1) return n;
 int j,p;
 for(j = 31;j0;j--)
 if(n(1j)) break; //to find the first set bit from left
 p =0;
 while(jp)
{
 int x1 = (n (1j))j;
 int x2 = (n(1p))p;
 if(x1!=x2)
 {
   if(x1)
   {
n = ~(1j);//unset the jth bit
n |= (1p); //set the pth bit
   }
   else
   {
n = ~(1p); //unset the pth bit
n |= (1j); //set the jth bit
   }
 }
 j--;p++;
   }
   return n;
}

On 7/21/11, archita kool.arc...@gmail.com wrote:
 How to reverse the order of bits of a number in minimum space
 complexity?
 if the no is 11-1011
 the output should b 1101.

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

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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

2010-08-09 Thread amit
Given a text file, implement a solution to find out if a pattern
similar to wild cards can be detected.
fort example find if a*b*cd*, or *win or *def* exists in the text.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from 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

2010-08-09 Thread sharad kumar
nice onefor searching first u need to build the suffix tree for each
letter with * once u do it perform a search
in other word u need to implement grep command rite??
On Mon, Aug 9, 2010 at 7:00 PM, amit amitjaspal...@gmail.com wrote:

 Given a text file, implement a solution to find out if a pattern
 similar to wild cards can be detected.
 fort example find if a*b*cd*, or *win or *def* exists in the text.

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




-- 
yezhu malai vaasa venkataramana Govinda Govinda

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