2. Prove that 10n3logn + 15n2 is O(n4).
3. a) Give a detailed asymptotic analysis using big-Oh notation for the (worst case) running time of the following algorithm, Tweedle (see pages 126-127 in the 3rd edition or 124-125 in the 2nd edition for examples of an appropriate amount of detail).
Algorithm Tweedle(n)b) Give a detailed asymptotic analysis of the following algorithm, Dee.
Input: an integer
Output: an integerif (n <= 0) then
return n
k=0
for i = 0 to n do
k += i
return k
Algorithm Dee(n)4. Chapter 3, exercise C-3.13, page 137 (3rd edition).
Input: a positive, even integer
Output: an integerk = 1
j = 0
while (k <= n) do
j += Tweedle(logk) + Tweedle(2*k) + Tweedle(k*k)
k *= 2
return j
5. a) Give pseudo-code to implement the methods of a Deque abstract data type (insertFirst, insertLast, removeFirst, removeLast, first, last, size, and isEmpty) using 2 Stack data structures (which take linear space) plus a constant amount of additional space. In other words, given a Stack implementation, we could use your pseudocode to implement the methods of a class StackDeque as follows:
public class QueueDeque implements Deque {b) Give a detailed asymptotic analysis for the running time of each of your methods using big-Oh notation.
private Stack S1;
private Stack S2;
public void insertFirst(Object o) {...};
public void insertLast(Object o) {...};
public Object removeFirst() {...};
public Object removeLast() {...};
public Object first() {...};
public Object last() {...};
public int size() {...};
public boolean isEmpty() {...};
}