Pseudocode help
Posted
by vatsag
on Stack Overflow
See other posts from Stack Overflow
or by vatsag
Published on 2010-03-23T06:21:16Z
Indexed on
2010/03/23
6:23 UTC
Read the original article
Hit count: 627
pseudocode
|.NET
Hello All
I've been banging my head over few hours for realising this particular logic
My task is to have a masterlist ListM elements of which shall be list(again) in the form of ListA(type A) and ListB(type B) and ListC(type C)(some generic type). Also the lists A and ListB can contain elements of type C(some generic type).
Coming to the preconditions
1. ListA can contain only 50 elements
of type 'A', rest of the elements
can be of generic type C
2. ListB can contain only 50 elements
of type 'B', rest of the elements
can be of generic type C
3. Also the lists(ListA or ListB) can take
at max of 100 elements.
4. ListC can contain elements of generic type C
and can take max of 100 elements
For ex:
Now, If i have
200 elements of type A
and 200 elements of type B
and 600 elements of type C
then i should be able to get
4 Lists(50 elements in each list) of type...ListA
(because each ListA can contain at max of 50 elements of type A only, rem 50 is typeC)
4 Lists(50 elements in each list) of type...ListB
(because each ListA can contain at max of 50 elements of type B only, rem 50 is typeC)
2 Lists(50 elements in each list) of type...ListC
i shall be glad to explain it again if my explanation is quite confusing. Can anyone suggest a better way for implementing such a requirement in the form of a pseudocode ?
Thanks in advance VATSAG
© Stack Overflow or respective owner