Find ? - notation in terms of n for the pseudocode below. Write only the final answer. x = 0 for i = 1 to n for j = 1 to i k = n while k > 1 x = x + 1 k = k/3
Added by James S.
Close
Step 1
Step 1: The first line of code, "X = 0", takes constant time, so it can be represented as O(1). Show more…
Show all steps
Your feedback will help us improve your experience
Babita Kumari and 83 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
(Refer to Example $11 .$ ) Rewrite each summation so that the index starts with $n=1.$ $$\sum_{k=0}^{n}(3 k-2)$$
Further Topics in Algebra
Series
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
Supreeta N.
For the sequence a defined by $a_{n}=n^{2}-3 n+3, \quad n \geq 1$. Find $\sum_{k=1}^{6} a_{k}$
Functions, Sequences, and Relations
Sequences and Strings
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD