Question

In: Computer Science

Algorithm problem 4 [3.1-4] Is (2^(n+1))∈O(2^n)? Is (2^(2n))∈O(2^n)?

Algorithm problem

4 [3.1-4] Is (2^(n+1))∈O(2^n)? Is (2^(2n))∈O(2^n)?

Solutions

Expert Solution

1)
2^(n+1) = O(2^n)
This is true.
let's prove it.

f(n) = O(g(n)) means there are positive constants c and n0, such that 0 ≤ f(n) ≤ cg(n) for all n ≥ n0
2^(n+1) = O(2^n)
=>  2^(n+1) <= c(2^n)
=>  2*2^n <= c(2^n)
Let's assume c = 2
=>  2*2^n <= c(2^n)
=>  2*2^n <= 2(2^n)
=>  2*2^n <= 2*2^n
it's true for all n >= 1

so, 2^(n+1) = O(2^n) given c = 2 and n0 = 1

2)
2^2n = O(2^n)
This is not correct.
let's prove 2^(2n) is not O(2^n).

f(n) = O(g(n)) means there are positive constants c and n0, such that 0 ≤ f(n) ≤ cg(n) for all n ≥ n0
assume 2^2n = O(2^n)
=>  2^2n <= c(2^n)
=>  2^n <= c
2^2n can be O(2^n) only if c >= 2^n

for f(n) = O(g(n)) then c must be a constant. here c >= 2^n which is not a constant
so, f(n) is not O(g(n))

hence 2^(2n) is not O(2^n)


Answer:
---------
Is (2^(n+1))∈O(2^n) Yes 
Is (2^(2n))∈O(2^n) No



Related Solutions

Prove the following by induction: 2 + 4 + 6 + …+ 2n = n(n+1) for...
Prove the following by induction: 2 + 4 + 6 + …+ 2n = n(n+1) for all integers n Show all work
1.)Prove that f(n) = O(g(n)), given: F(n) = 2n + 10; g(n) = n 2.)Show that...
1.)Prove that f(n) = O(g(n)), given: F(n) = 2n + 10; g(n) = n 2.)Show that 5n2 – 15n + 100 is Θ(n2 ) 3.)Is 5n2 O(n)?
(1)Prove 6^(2n)-4^(2n) must be a mutiple of 20 (2)Prove 6^(2n)+4^(2n)-2 must be a multiple of 50
(1)Prove 6^(2n)-4^(2n) must be a mutiple of 20 (2)Prove 6^(2n)+4^(2n)-2 must be a multiple of 50
Show by induction that for all n natural numbers 0+1+4+9+16+...+ n^2 = n(n+1)(2n+1)/6.
Show by induction that for all n natural numbers 0+1+4+9+16+...+ n^2 = n(n+1)(2n+1)/6.
Prove these scenarios by mathematical induction: (1) Prove n2 < 2n for all integers n>4 (2)...
Prove these scenarios by mathematical induction: (1) Prove n2 < 2n for all integers n>4 (2) Prove that a finite set with n elements has 2n subsets (3) Prove that every amount of postage of 12 cents or more can be formed using just 4-cent and 5-cent stamps
Prove the upper and lower bound of T(n) = T(n/3) + T(2n/3) + O(n)
Prove the upper and lower bound of T(n) = T(n/3) + T(2n/3) + O(n)
1a. Proof by induction: For every positive integer n, 1•3•5...(2n-1)=(2n)!/(2n•n!). Please explain what the exclamation mark...
1a. Proof by induction: For every positive integer n, 1•3•5...(2n-1)=(2n)!/(2n•n!). Please explain what the exclamation mark means. Thank you for your help! 1b. Proof by induction: For each integer n>=8, there are nonnegative integers a and b such that n=3a+5b
Present an O(n) algorithm that sorts n positive integer numbers a1, a2, . . . ,...
Present an O(n) algorithm that sorts n positive integer numbers a1, a2, . . . , an which are known to be bounded by n 2 (so ai ≤ n 2 , for every i = 1, . . . , n. Use the idea of Radix Sort (discussed in class and presented in Section 8.3 in the textbook). Illustrate your algorithm by showing on paper similar to Fig. 8.3, page 198 in the textbook (make sure you indicate clearly...
Show that the number of labelled simple graphs with n vertices is 2n(n-1)/2. (By induction way!)
Show that the number of labelled simple graphs with n vertices is 2n(n-1)/2. (By induction way!)
1. Given three arrays of N names each, describe an O(nlogn) algorithm to determine if there...
1. Given three arrays of N names each, describe an O(nlogn) algorithm to determine if there is any name common to all three arrays, and if so, return the first such name.? 2. Given an input array with all equal values, compare the following sorting algorithm using big-O notation. Running Time Space Complexity Merge Sort Quick Sort Heap Sort
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT