6

I found out the importance of time complexity. It might not seem like a big difference between O(1) and O(2). But there's a big difference hardcoding 500 lines and 1000 lines of data.

I made a navigation app for school using dijkstra's algo. However it had no data available so I had to hardcode it. Long story short, there was a ton of hardcoding. Always try to improve the time complexity of the code you write.

Comments
  • 2
    Did you think about generating the hardcoded code from the data?
  • 2
    There is literally no difference between O(1) and O(2) or even O(1000) since they all are equal to O(1) (constants in O Form are reduced to 1).

    There is however a difference between O(1) and O(n).

    I can't explain it very well in English but Google O complexity and you will find the answer (if it interests you)
Add Comment