On Oct 23, 2:51 pm, Richard Herring <junk@[127.0.0.1]> wrote:
In message <CQZLk.87$yl1...@read4.inet.fi>, Juha Nieminen
<nos...@thanks.invalid> writes
Ankur Arora wrote:
Do not use STL.
Any rational reason for this?
It motivates homework question 2:
"Why didn't your first design work?
(a) dangling pointers;
(b) uninitialised pointers;
(b) double deletion;
(c) incorrect container insertion/deletion algorithm;
(d) all of the above"
:-/
--
Richard Herring
Wow!!sorry about that, I can see its very offending.'will make it a
point to follow the guidelines.Thanks.
Here's what I have come up with so far (very basic, algorithmic
steps):-
- use of pointers to manipulate the deck since we will be doing a lot
of shuffling. A link list would be a good choice with each node
representing a card and the link list chain representing a particular
ordering.
- At least two loops, outer representing the condition till the deck
is in the original order and the inner representing a complete round.
- The inner loop will have its auxiliary list i.e. a particular
ordering after the completion of a complete round.
- At the end of each inner loop iteration we will check the auxiliary
list with the original list to see whether its the same as the
original list (this would be done in the conditional statement of the
outer loop).
Need to find out the implementation details for the inner loop (guess
that would easy) and a way to check whether the auxiliary list is same
as the original list at the end of each inner loop iteration.
sorted (so a deck of 4 cards would start as 1, 2, 3, 4). Then checking
if the deck is back to the original state is easy.