1) What is the purpose of using asymptotic notation such as O, Omega and Theta i
ID: 3581635 • Letter: 1
Question
1) What is the purpose of using asymptotic notation
such as O, Omega and Theta instead of using
the exact number of comparisons done by a sorting algorithm?
i.e. why do we use O(n^2) instead of saying 2n^2 + 3n + 4
*Because we are only interested in
2) Computing the Average time complexity for a real-world problem is difficult.
Explain why by referring back to the formula for computing A(n).
*Why?
3) Your friend says she can find a comparison based algorithm that searches
for an element in an ordered list in much less than W(N) = Theta(log N).
Please teach her why she is wrong.
*Answer:
4)You had to overload = to make it work with slists.
Some of you also overloaded == Answer for each.
*We had to overload=. What’s wrong with the one provided by C++?
*We had to overload==. What’s wrong with the one provided by C++?
5)Why did you have to write a copy constructor for linked lists?
Also, give two cases in which your copy constructor is automatically invoked in relation to calling regular functions.
*What’s wrong with the one provided by C++?
*Invoked when:
*Invoked when:
6)Why is it useful to use virtual functions with inheritance and pointers? Explain using the Animals array which contains pointers to Dog and Cat objects with a virtual function Speak.
*The stated combinations allows
7)800 islands are connected with many two-way bridges (i.e. lines, not arrows).
You know the cost of maintaining each bridge.
You want to minimize the total maintenance cost by eliminating some bridges while leaving all the islands connected.
1) What algorithm would you use to solve this problem? (Algorithm for finding what?)
*Algorithm for finding:
2) How many bridges will you end up with if you used this algorithm?
*Give the Formula where N = 800:
Explanation / Answer
the purpose of using asymptotic notation instead of using the exact formula is that it contains more details and is more complex han we need to know to calculate the cost of algorithm.
So we take the highest degree as the complexity.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.