Question
JAVA Give Big O Notation for each 1. for (int i = 0; i < N^2; i++) { sequence of statements } for (int j
JAVA
Give Big O Notation for each
1.
for (int i = 0; i < N^2; i++) {
sequence of statements
}
for (int j = 0; j < N; j++) {
sequence of statements
}
2.
for (int i = 0; i < N; i+=1) {
for (int j = 0; j < N; j+=2) {
sequence of statements
}
}
3.
for (int k = 1; k < N; k = k*5) {
sequence of statements
}
4.
for (int i = 0; i < N; i++) {
for (int j = N; j > i; j-=2) {
sequence of statements
}
}
5.
for (int i = 0; i < N; i++) {
for (int j = N; j > i; j-2) {
sequence of statements
}
}
6.
for (int i = 1; i < N; i++) {
for (int j = i+1; j < N; j++) {
sequence of statements
}
}
7.
for (int i = 1; i < N; i++) {
for (int j = N; j > i; j= j--) {
sequence of statements
}
}
8.
for (int i = 0; i < N; i++) {
for (int j = 1; j < N; j= j*3) {
sequence of statements
}
}
9.
for (int i = 0; i < N; i++) {
for (int j = 1; log(j) < N; j= j*2) {
sequence of statements
}
}
10.
for (int i = 0; i < N; i++) {
for (int j = 1; log(j) < N; j= j+1) {
sequence of statements
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started