m*k>N . so Mx intersection My is not necessarily empty. so i think your
solution is not optimized.
please correct me if I am wrong.

On Thu, Mar 24, 2011 at 7:10 PM, ligerdave <david.c...@gmail.com> wrote:

> let's make this clear.
>
> you have a total of N questions for K students, and each student gets
> M questions, where M1+ M2 + M3 +....+ Mn = N; Mx union My = {}empty
>
> when you say the repeats should be minimized, i read it as eliminated,
> unless you allow a few repeated questions(in a real number, saying 2
> allowed)
>
> to do this quickly without repeats,
>
> boundary  = N.length
>
> i = random() % boundary
>
> pick N[i] and replace this element with current last element in the
> array which is N[boundary-1]
>
> then boundary--
>
> one iteration completed here and you can repeat those steps.
>
> this way, you would never have two same questions generated and run
> time is O(1)
>
>
> On Mar 24, 4:49 am, snehal jain <learner....@gmail.com> wrote:
> > A question set is given to you and you have to generate (question
> > numbers are in an array) generate different set of question paper for
> > k students.
> > in other words From a total of n questions you have to give m
> > questions to each of the k students such that both the number of
> > repeated questions and the number of repetitions of each repeated
> > question are minimized
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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.

Reply via email to