
Performance & Recursion
How can you count all the participants in an auditorium if you don't have sensors, check-in processes or access control? Option 1: Use my eyes and my mind to count them one by one: 1,2,3,4... Option 2: Count by twos, like 2,4,6,8,... Option 3: Ask the participants to follow these instructions: Stand up and think of the number 1 Pair off with someone standing, add their number to yours, and remember the sum One of you should then sit down If still standing, go back to step 2. The final person standing will know the exact number of participants. Option 3 is the most efficient and faster than the other methods. This is why algorithms are important. That's how the conference by David Malan begins. Malan is a Computer Science professor at Harvard University, and he's teaching how different ways of solving problems can lead to disaster or simply become a small everyday hurdle. Performance and Complexity Performance tells you how much slower a program becomes as the input grows. If I have 10
Continue reading on Dev.to
Opens in a new tab

