Timeline for Time complexity of a Nested While loop in a for loop
Current License: CC BY-SA 4.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 24, 2019 at 22:38 | answer | added | Christophe | timeline score: 2 | |
Sep 24, 2019 at 11:58 | comment | added | Doc Brown | @Freakup2: pick n=100000, or 1.000.000. How often does the inner loop run? Not "once", that's wrong. | |
Sep 24, 2019 at 11:48 | comment | added | Freakup2 | Its just a practice problem that i'm having trouble with, i want to understand it first before going for my assignment @DocBrown. I am aware there is nothing returning, so the inside of each iteration should just be O(1) . I'm more interested in the Theta() of the nested loop it self. So for the second algorithm, i plugged in some n, but the loop will pretty much only run once. So J^2 <= n, which means j <= root(n)? | |
Sep 24, 2019 at 8:04 | comment | added | Doc Brown | This site is not for solving other peoples homework. But I will give you a hint how you can solve this by yourself: start with some examples for different values of n, and lookup the basic calculation rules for logarithms. | |
Sep 24, 2019 at 7:57 | comment | added | Doc Brown | @PhilipKendall: neither the first nor the second algorithms seems to return anything. | |
Sep 24, 2019 at 6:15 | review | Close votes | |||
Oct 1, 2019 at 3:05 | |||||
Sep 24, 2019 at 6:08 | comment | added | Philip Kendall | Are you aware your second algorithm returns the same value every time? That doesn't fundamentally affect the question but it makes me wonder if you've got a typo somewhere. | |
Sep 24, 2019 at 5:55 | comment | added | gnat | Possible duplicate of What is O(...) and how do I calculate it? | |
Sep 24, 2019 at 5:45 | review | First posts | |||
Sep 26, 2019 at 15:50 | |||||
Sep 24, 2019 at 5:43 | history | asked | Freakup2 | CC BY-SA 4.0 |