Oh notation, in terms of the variable N. In other words, write the code's growth rate as N grows. Write a simple expression that gives only a power of N using a caret a character for exponentiation, such as O(N^2) to represent O(N?) or o(1og M) to represent O(log2 N). Do not write an exact calculation of the runtime such as O(2N + 4N + 14). Arraylist list = new Arraylist(); HashSet hashset = new HashSet(); for (int i = 4; i <= N + 7; i++) { hashset.add(i); for (int num : hashset) { list.add (num); while (!list.isEmpty()) { list.remove(0); println("done!"); O(c) where c is a constant O O(N^2) O(N) O O(logN + N)

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Java programming Big O question

Oh notation, in terms of the variable N. In other words, write the code's growth rate as N grows.
Write a simple expression that gives only a power of N using a caret a character for exponentiation,
such as o(N^2) to represent O(N2) or o(1og N) to represent O(log2 N). Do not write an exact
calculation of the runtime such as O(2N3 + 4N + 14).
Arraylist<Integer> list = new ArrayList<Integer>();
HashSet<Integer> hashset = new HashSet<Integer>();
for (int i = 4; i <= N + 7; i++) {
hashset.add(i);
}
for (int num : hashset) {
list. add(num);
}
while (!list.isEmpty()) {
list.remove (0);
}
println("done!");
O(c) where c is a constant
O O(N^2)
O(N)
O O(logN + N)
Transcribed Image Text:Oh notation, in terms of the variable N. In other words, write the code's growth rate as N grows. Write a simple expression that gives only a power of N using a caret a character for exponentiation, such as o(N^2) to represent O(N2) or o(1og N) to represent O(log2 N). Do not write an exact calculation of the runtime such as O(2N3 + 4N + 14). Arraylist<Integer> list = new ArrayList<Integer>(); HashSet<Integer> hashset = new HashSet<Integer>(); for (int i = 4; i <= N + 7; i++) { hashset.add(i); } for (int num : hashset) { list. add(num); } while (!list.isEmpty()) { list.remove (0); } println("done!"); O(c) where c is a constant O O(N^2) O(N) O O(logN + N)
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY