Re: [algogeeks] Google Question--Suggest Algo

2011-11-27 Thread Piyush Grover
Optimal split: [0,0][1,1][0,0][1,1][0,1][1,0] Expected value of optimal split: 0 + 1 + 0 + 1 + 1/2 + 1/2 = 3 why this is not the optimal split??? On Sun, Nov 27, 2011 at 6:58 PM, Ankur Garg wrote: > You have an array with *n* elements. The elements are either 0 or 1. You > want to *split the a

[algogeeks] Google Question--Suggest Algo

2011-11-27 Thread Ankur Garg
You have an array with *n* elements. The elements are either 0 or 1. You want to *split the array into kcontiguous subarrays*. The size of each subarray can vary between ceil(n/2k) and floor(3n/2k). You can assume that k << n. After you split the array into k subarrays. One element of each subarray

Re: [algogeeks] Google Question--Suggest Algo

2011-11-16 Thread Ankur Garg
Can u provide a pseudo code for the same and c if it works On Thu, Nov 17, 2011 at 2:37 AM, sravanreddy001 wrote: > Start with counting sort of the input. > Use shuffling algorithm on it. > > Store index as cumulative sums of counts. > > -- > You received this message because you are subscribed

[algogeeks] Google Question--Suggest Algo

2011-11-16 Thread sravanreddy001
Start with counting sort of the input. Use shuffling algorithm on it. Store index as cumulative sums of counts. -- 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/algogee

[algogeeks] Google Question--Suggest Algo

2011-11-16 Thread Ankur Garg
Given a string of lowercase characters, reorder them such that the same characters are at least distance d from each other. Input: { a, b, b }, distance = 2 Output: { b, a, b } How to approach this question ? -- You received this message because you are subscribed to the Google Groups "Algorit