For one, I could sort it if I had nothing better to do. I would easily skim through the list until I found the smallest number, and place that in the far left side of the list.
[10, 4, 2, 3, 9, 8, 1, 5, 6, 7] would become [1, 10, 4, 2, 3, 9, 8, 5, 6, 7]
I could sort this entire list in mere seconds and not give it anymore thought, moving on with more important things in my life such as procrastination. But I were to find myself given another list, this time with numbers ranging from 1-1000000, would I even bother to sort it?
If I had dedicated more attention for the previous list, would that have helped in sorting a list, especially with a large range of numbers?
It turns out it would, and I could determine whether sorting a list of a million numbers would be worth the extra 3% on my final grade, or taking that time to studying for the upcoming exam.
Almost at the end of the first iteration of sorting a list of a million elements, Timmy decides he should probably start studying for his exam tomorrow instead. |
Sorting the list this way, I'd have to check every element, find the smallest, move it to the left, then shift everything else to the right.
Once I discovered that it takes approximately n2 steps to sort the list using my method, and each step takes me ¼ seconds to process, a list with 10 elements would take me 25 seconds to sort.
With a list of a million elements, it would take me approximately 7927 years. Good thing we have computers and good thing there are more efficient sorting methods.
Finally, time to earn that 3% in CSC148. |
Big O, big omega, big theta, all of which can be utilized to model the run-time of code, showing just how long it would take to complete for any size input.
But is it really helpful? I'm just over here with my simple list shifting numbers to one side, also mixed up in all of this recursion and trees and linked lists and more trees.
Or the greater question, is this the stepping stone? Can I no longer mindlessly crunch blocks of if-statements? Is it no longer appropriate to write if some_variable == True?
I think I'm starting to get the picture, the slightest taste of the realm of computer science and it's not fun and games like I thought it would be. There is great potential to be found within, not just for self accomplishment and not just to secure a job at some start-up company, but to propel advancement, and our capability to evolve as a civilization.
Coming across the problem P=NP, it really demonstrates how much computer science is interconnected with contemporary society. Soon we'll be able to figure out what is worth researching, how fast we can make discoveries, and by then robots will have taken most if not all of our jobs.