Big-O complexities of hints

I was wondering if the Big-O of the solutions for the “JavaScript Algorithms and Data Structures Certification” course could be included in the hints.
The solutions are helpful and different but sometimes they could be confusing as to which one is the best.
I think it would be better if the complexities are included in the posts so that we’d learn how to come up with efficient solutions and get good at figuring out the Big-O of our solution along the way.

I’m not sure that the big O would help on many of the problems, but it would be an interesting addition for some of them. The primes problems do have some discussion of performance, if I recall correctly.

I’d be careful worrying too much about big O though. ‘Is it fast enough’ depends upon context. Instead of chasing big O, it is often better to figure out what is the most time consuming parts of your code and speed those parts up. You sometimes pick an algorithm with a slower big O because it’s easier to read and maintain and is not a bottleneck in your code.

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.