Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

14
  • 5
    In this situation, it will highly depend on the content of the array, due to sum<=10 predicate. You can estimate worst and best case scenarios. But for real-world execution, you need to run it and measure it. Commented Mar 20, 2020 at 12:15
  • 1
    By introducing a counter variable? Or do you mean "beforehand", by analysing the code? Commented Mar 20, 2020 at 12:25
  • 1
    Do you know about computational complexity ? Commented Mar 20, 2020 at 12:35
  • 1
    OK. Which takes us back to @Euphoric's comment. Commented Mar 20, 2020 at 12:39
  • 2
    Quick trick eh? Set N to 0 and it executes no times : ) Seriously the quickest way to calculate this is to write a program that calculates this. Commented Mar 20, 2020 at 13:50