week 4 activity 1 question 2

221 views
Skip to first unread message

sareena sanil

unread,
Nov 12, 2020, 12:12:30 AM11/12/20
to Discussion forum for Computational Thinking
Two nested iterations are sufficient to find pairs of students with same date of birth. 
ans is true
but  how and why
in the they did many nested iteration to find one pair 

Computational Thinking Support 2

unread,
Nov 12, 2020, 2:41:29 AM11/12/20
to Discussion forum for Computational Thinking, sareena sanil
Hi,
The pseudocode will be look like this:

While(Pile 1 has more cards){
        Card X
        while(Pile 1 has more cards){
                Card Y
                       if(X.DOB == Y.DOB){
                           count = count +1
                      }
        }
}

Regards,
Deepak
IITM Online Degree Team

Computational Thinking Support 2

unread,
Nov 12, 2020, 2:45:49 AM11/12/20
to Discussion forum for Computational Thinking, Computational Thinking Support 2, sareena sanil
Continuation of previous post.

So the two nested iterations (while 1 and while 2) are enough to find the pairs of students with same DOB.

Hope your doubt is cleared if not please write us again.

Regards,
Deepak
IITM Online Degree Team

Reply all
Reply to author
Forward
0 new messages