2

I'm learning about this in class and I'm really struggling to come up with any examples besides nested for loop. Can anyone share other known algorithms that have n^2 time complexity?

  • 1
    https://stackoverflow.com/questions/34915869/example-of-big-o-of-2n/34916117 – Brett Gregson Jan 30 '20 at 22:54
  • 1
    Unfortunately, open-ended list type questions aren't really a good fit for Stack Overflow since they don't exactly have a "correct" answer. If you change the question to focus more on what makes an algorithm O(n^2) then it might be more appropriate, though in that case I'd imagine there's probably already a duplicate somewhere. – John Montgomery Jan 30 '20 at 22:56
  • 1
    Here's another, different example of O(n^2): https://stackoverflow.com/questions/34915869/example-of-big-o-of-2n/34916117. Here is an excellent overview, with examples and "challenges" to help your understanding: https://developerinsider.co/big-o-notation-explained-with-examples/ – FoggyDay Jan 30 '20 at 22:58
  • 1
    @BrettGregson 2^n != n^2. – pjs Jan 30 '20 at 23:43

0 Answers0