Problem 1: for(int i = 1; i <= n; i++) { } Problem 2: k = k * 5; for (int i = 1; i <= n; i++) { } for(int j = 1; j <= n; j++) { System.out.println(i * j); } } Problem 3: for(int i = 1; i <= 5; i++) { k = k + i;

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

big O notation time complexity any of the following

### Northeastern Illinois University
#### CS207, Object-Oriented Programming and Data Structures, Summer 2022
#### Homework 4
**Due date:** Thursday 6/30/2022 at 11:59 p.m.

---

**Instructions:**

For each problem below, find the time complexity/running time in terms of N. Type your answers in a Word file and then convert it to a PDF file in the following format:

**Example:**
- Problem x: O(N²) where x is the problem number.
- Problem y: O(N³) where y is the problem number.

---

### Problem 1:

```java
for (int i = 1; i <= n; i++) {
    k = k * 5;
}
```

### Problem 2:

```java
for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
        System.out.println(i * j);
    }
}
```

### Problem 3:

```java
for (int i = 1; i <= 5; i++) {
    k = k + i;
}
```

### Problem 4:

```java
for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= 5; j++) {
        System.out.println(i);
    }
}
```

### Problem 5:

```java
public static void show(int n) {
    int k = 1;
    while (k < n) {
        System.out.println(k);
        k = k * 2;
    }
}
```

---

Please make sure to analyze each loop and nested loop carefully to determine their time complexities. Remember to document your steps and reasoning in your Word file before converting it to PDF.
Transcribed Image Text:### Northeastern Illinois University #### CS207, Object-Oriented Programming and Data Structures, Summer 2022 #### Homework 4 **Due date:** Thursday 6/30/2022 at 11:59 p.m. --- **Instructions:** For each problem below, find the time complexity/running time in terms of N. Type your answers in a Word file and then convert it to a PDF file in the following format: **Example:** - Problem x: O(N²) where x is the problem number. - Problem y: O(N³) where y is the problem number. --- ### Problem 1: ```java for (int i = 1; i <= n; i++) { k = k * 5; } ``` ### Problem 2: ```java for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { System.out.println(i * j); } } ``` ### Problem 3: ```java for (int i = 1; i <= 5; i++) { k = k + i; } ``` ### Problem 4: ```java for (int i = 1; i <= n; i++) { for (int j = 1; j <= 5; j++) { System.out.println(i); } } ``` ### Problem 5: ```java public static void show(int n) { int k = 1; while (k < n) { System.out.println(k); k = k * 2; } } ``` --- Please make sure to analyze each loop and nested loop carefully to determine their time complexities. Remember to document your steps and reasoning in your Word file before converting it to PDF.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

big o notation time complexity for question 4 & 5

10:25
Northeastern Illinois University
CS207, Object-Oriented Programming and Data Structures, Summer 2022
Homework 4
Due date: Thursday 6/30/2022 at 11:59 p.m.
Problem x: 0(N²) where x is the problem number.
Problem y: O(N³) where y is the problem number.
For each problem below, find the time complexity/running time in terms of N:
Type your answers in a word file then convert it to a PDF file in the following
format:
Problem 1:
for(int i = 1; i <= n; i++)
{
Problem 2:
for (int i = 1; i <= n; i++)
{
}
k = k * 5;
Problem 3:
}
for(int i = 1; i <= 5; i++)
{
for(int j = 1; j <= n; j++)
{
System.out.println(i j);
}
}
Problem 4:
k = k + i;
for (int i = 1; i <= n; i++)
{
}
for(int j = 1; j <= 5; j++)
{
System.out.println(i);
}
Problem 5:
public static void show (int n)
{
int k = 1;
while (kn)
{
}
|||
ŵ
System.out.println(k);
k = k * 2;
lll 19%!
1 of 3
Transcribed Image Text:10:25 Northeastern Illinois University CS207, Object-Oriented Programming and Data Structures, Summer 2022 Homework 4 Due date: Thursday 6/30/2022 at 11:59 p.m. Problem x: 0(N²) where x is the problem number. Problem y: O(N³) where y is the problem number. For each problem below, find the time complexity/running time in terms of N: Type your answers in a word file then convert it to a PDF file in the following format: Problem 1: for(int i = 1; i <= n; i++) { Problem 2: for (int i = 1; i <= n; i++) { } k = k * 5; Problem 3: } for(int i = 1; i <= 5; i++) { for(int j = 1; j <= n; j++) { System.out.println(i j); } } Problem 4: k = k + i; for (int i = 1; i <= n; i++) { } for(int j = 1; j <= 5; j++) { System.out.println(i); } Problem 5: public static void show (int n) { int k = 1; while (kn) { } ||| ŵ System.out.println(k); k = k * 2; lll 19%! 1 of 3
Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Computational Systems
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education