Hello team
In question number 2, what are the two nested iterations specified in the question?
According to my understanding, if we write the pseudo-code for this problem, then we may write it as:
while(Pile 1 has more cards)
{
Read top card of Pile 1 and designate it as current_card;
Note down the DOB of current_card(=x, say);
while(Pile 1 has more cards other than current_card)
{
Read top card of Pile 1 and designate it as compare_card;
Note down the DOB of compare_card(=y, say);
if(x == y)
{
pair_count += 1;
Keep compare_card under the entire Pile 1;
}
}
Keep the current_card in another pile called Pile 2;
}
Here let us suppose pair_count was initially initialized to zero and at the end of the code we have found all the possible pairwise combinations.
So here the question arises that which are the two nested loops here because I only see one nested loop.
Kindly help me with this problem as soon as possible.
Thank you
Pranjal Sarkar