The week 0 lecture of CS50 edx. I was not able to understand how did we come to 546 student.
Following would be the steps assuming 8 students are in the room 1. Each of them would have the number 1 in their mind and 8 of them would be standing 2. You add the number in your pair's mind (in this case is 1 in each of their mind and the resultant would be 2) and one of you in your pair sits down. 3. After the pairing, 4 people would be standing with 2 in their mind
This is where the looping starts and you go back to the previous step
- As a result of the next step, 2 people would be standing with 4 in their own mind
- When they finally pair up, they add their numbers in their mind which would be 4+4=8.