KBC Asymptotic Analysis Proof Techniques Recursion & Data Structures Worksheet

User Generated

Abzv111

Computer Science

Question Description

I'm working on a algorithms & data structures discussion question and need an explanation to help me study.

Just 5 questions of data structures and NO Coding required. 

Unformatted Attachment Preview

Practice - 1 Question 1 (Ranking Runtimes) Rank the following functions representing running times from smallest to largest (in terms of growthratewithrespectton).Groupfunctionstogetheriftheyareinthesameequivalenceclass(i. e.f(n)andg(n)areinthesameequivalenceclassiff(n)=Θ(g(n))). 2n3 + 12n2 + 5 , 8(log n)2 , 1.5n , n4 − 12n3 , 4n3 log n , 4n3 , n! , 7n + 6 1 Question 2 (Growth of Functions) a. Let f (x) = x2 − x + 15 and g(x) = x2 log(x) − 10. Prove that f (x) is O(g(x)) by: 1. Providing witnesses C and k and 2. Proving that the inequality holds for the value you choose in 1. 2 b. Let f (x) = x5 + 10 and g(x) = x5 + x + 10 1. Prove that f is O(g) 2. Prove that f is Ω(g) 3. Given parts a and b, what other relationship can you show about f and g? 3 Question 3 (Proof by Induction) Use induction to show that n X i=1 i3 = n2 (n + 1)2 4 for all n ≥ 1 4 Question 4 (Recursive Set) Let Σ be the alphabet defined as follows: Σ = {e, l, v} We now de fine the set of strings P according to the following: BASIS STEP: If x ∈ Σ then x ∈ P RECURSIVE STEP: If w ∈ P and x ∈ Σ, then xwx ∈ P Show that the string level is in P 5 Question 5 (Merge Sort Steps) 1. How many levels of recursion(level of recursive calls only, not including return steps) are necessary for merge sort to sort a list of size 8? 2. Write the intermediary ordered list after each recursive merge step from calling merge sort on the following: {4, 8, 5, 1, 6, 7, 2, 3} 6
Purchase answer to see full attachment
Student has agreed that all tutoring, explanations, and answers provided by the tutor will be used to help in the learning process and in accordance with Studypool's honor code & terms of service.

Explanation & Answer

Please view explanation and answer below.

Question 1(Ranking Runtimes)

Rank the following functions representing running times from smallest to largest ( in terms of
growth rate with respect to n). Group functions together if they are in the same equivalence
class(i.e.) f(n) and g(n) are in the same equivalence class if f(n) = O(g(n)).
Solution
O(log(n))
O((log(n))c)
O(n)
O(n)
O(cn)

logarithmic
polylogarithmic
linear
polynomial
exponential

4n3 log n
8(log n)2
n!, 7n + 6
2n3 + 12n2 + 5, n4 - 12n3, 2n3 + 12n + 5
1.5n

Please view explanation and answer below.

Question 1(Ranking Runtimes)

Rank the following functions representing running times from smallest to largest ( in terms of
growth rate with respect to n). Group functions together if they are in the same equivalence
class(i.e.) f(n) and g(n) are in the same equivalence class if f(n) = O(g(n)).
Solution
O(log(n))
O((log(n))c)
O(n)
O(n)
O(cn)

logarithmic
polylogarithmic
linear
polynomial
exponential

4n3 log n
8(log n)2
n!, 7n + 6
2n3 + 12n2 + 5, n4 - 12n3, 2n3 + 12n + 5
1.5n

Question 2
1. Let f and g act as functions from positive numbers to positive numbers. F(n) is O
(g(n)) when there are positive constants k and c.
f(n) ≤ C g(n) whenever n > k f(n) is O(g(n)) ≡ ∃C ∃k ∀n (n > k → f(n) ≤ C g(n))
To provide witness of c and k, select values for c and k and show that n>k implies
f(n) 1, we find/ derive a c to show that
f(n) /g(n) ≤ C g(n) /g(n) = C
In this case it shows that n>1 which means f(n) ≤ C g(n).
n > 1 means 1 < n, n < n2 , n 2 < n3 , . . .
Increasing the numerator simplifies the fraction.
2. The inequality that holds true for the value chosen (1) is
f(n) g(n) ≤ C g(n) g(n) = C
Question 3
Question 4
Question 5

View attached explanation and answer. Let me know if you have any questions.

Question 1(Ranking Runtimes)

Rank the following functions representing running times from smallest to largest ( in terms of
growth rate with respect to n). Group functions together if they are in the same equivalence
class(i.e.) f(n) and g(n) are in the same equivalence class if f(n) = O(g(n)).
Solution
O(log(n))
O((log(n))c)
O(n)
O(n)
O(cn)

logarithmic
polylogarithmic
linear
polynomial
exponential

4n3 log n
8(log n)2
n!, 7n + 6
2n3 + 12n2 + 5, n4 - 12n3, 2n3 + 12n + 5
1.5n

Question 2
1. Let f and g act as functions from positive numbers to ...

GjvaxyrG (1239)
New York University

Similar Content

Related Tags