Big-0 Notation: For a given N, what is the time complexity of the following code in terms of N: x = 0 j = N while (j > 1): x += j j /= 2
Added by Aitor M.
Close
Step 1
The code starts with a variable j, which is greater than 1. Show more…
Show all steps
Your feedback will help us improve your experience
Amany Waheeb and 84 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Supreeta N.
Determine the Big O Notation Algorithmic Complexity for each of the following problems below, showing clearly step by step how you came by your answers. 4n^3 * (n+1)^2 (3n+5)^4 5n^3 + 2n^2 + 4n
Sri K.
Consider the following lines of code and compute the overall big O complexity: for i in range(n): if i % 3 == 0: for j in range(1000): sum += j else: for j in range(i + 1): sum += j
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD