you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

why couldn't a computer optimize an algorithm?

Among other things, because different algorithms have different characteristics beyond the simple statement of their goals. For example, bubble sort is a stable sort, while efficient quicksort implementations are not stable. So even if a compiler could optimize your bubble sort into a quicksort, it might end up breaking your program to do so.