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
Purchase answer to see full attachment
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 ...