# Question in regards to how an O(N^3) looks like using while/for loops

would the code below be considered O(N^3)?

while (...) {
while (...) {
}
while (...) {
}
}

• Are you asking what do various $O(n^3)$ algorithms look like? There are plenty of reasons to have cubic upper bound on the number of operations, which may or may not manifest themselves in the structure of while/for loops. – Dmitri Urbanowicz Mar 26 '20 at 7:16
• It also depends on what $n$ is. If each loop is executed $n$ times at worst case then your algorithm is $O(n^2)$. But you can't tell just by looking ag the structure of the program – melfnt Mar 26 '20 at 13:15