Re: [algogeeks] Google Interview Question

2011-05-27 Thread srajan dongre
@ankit sambyal.i think d rite answer will be 9978 in dat case.



On Fri, May 27, 2011 at 11:50 PM, ankit sambyal ankitsamb...@gmail.comwrote:

 @shubam: won't work
try following test case:  8,89,9

 Ankit Sambyal



 On Fri, May 27, 2011 at 11:11 AM, shubham shubh2...@gmail.com wrote:

 check whether these steps work:

 step 1:
 sort the given numbers in the decreasing order based on their
 first digit.
 step 2:
 if two numbers come out to be equal in the above case  both of
 their next digit exist then sort on the basis of their next digit, otherwise
 the number
 whose next digit doesnot exist should be placed before the other
 number.
 step 3:
concatenate these numbers.

 e.g.

 (0,1,10,100) sorting it gives: 1,10,100,0 = 1101000
 (97,8,9) sorting gives: 9,97,8 = 9978

 correct me if i'm wrong.

 Shubham

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




-- 
--

Srajan Dongre
||nd year  CSI (dual degree)
Indian Institute of Technology , Roorkee
Uttrakhand , India
pin code--247667

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

2011-05-27 Thread srajan dongre
wat about insertion sort (with some limited conditions obviously )  ??

On Sat, May 28, 2011 at 12:56 AM, Piyush Sinha ecstasy.piy...@gmail.comwrote:

 will it be given that the number of elements is always even??

 On 5/28/11, ross jagadish1...@gmail.com wrote:
  Hi all,
 
  Sort all elements in odd indices of an array in ascending order and
  even indices in descending order.
  Finally, rearrange so that all even indexed elements come first.
 
  eg:
 
  input – 7 2 6 4 8 3 1
 
  even indexed : 7 6 8 1 = sort 8 7 6 1
  odd indexed: 2 4 3 = sort 2 3 4
 
  output – 8 7 6 1 2 3 4
 
  What could be the best algo to solve it?
  Is it possible to arrive at the output using only O(1) extra space?
 
  --
  You received this message because you are subscribed to the Google Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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-8792136657*
 *+91-7483122727*
 *https://www.facebook.com/profile.php?id=10655377926 *

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




-- 
--

Srajan Dongre
||nd year  CSI (dual degree)
Indian Institute of Technology , Roorkee
Uttrakhand , India
pin code--247667

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