You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
286 B
Rust
26 lines
286 B
Rust
6 years ago
|
fn a(n: u64) {
|
||
|
//Is this O(n)?
|
||
|
for _ in 0..n {
|
||
|
b(n)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
fn b(n: u64) {
|
||
|
//Is this O(n)?
|
||
|
for _ in 0..n {
|
||
|
c(n)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
fn c(n: u64) {
|
||
|
//This is O(n)?
|
||
|
for _ in 0..n {
|
||
|
let _ = 1 + 1;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
fn main() {
|
||
|
//What time complexity is this?
|
||
|
a(1000)
|
||
|
}
|