Review 1 - b) Using the routine in Section 2.4.4 (p.32)?...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Review #1 - chap. 1 - 3 Q1. Is 2 n+1 = O( 2 n )? Is 2 2n = O( 2 n )? Q2. Let f(n) and g(n) be asymptotically nonnegative functions. Use the basic definition of O -notation to prove that max(f(n),g(n))=O(f(n)+g(n)). Q3. Show that for any real constants a and b with b>0, we have (n+a) b = θ (n b ). Q4. Use iteration to solve the recurrence T(n)=T(n- a)+T(a)+n, where a 1 is a constant.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Q5. Let F i be the Fibonacci numbers as defined in Section 1.2. Prove the following: a) b) Q6. Suppose T 1 (N) = O(f(N)) and T 2 (N)=O(f(N)). Is the following true? T 1 (N) – T 2 (N) = o(f(N)) 2 / ) 5 1 ( , + = Φ Φ < with F N N 2 2 1 = = N N i i F F
Background image of page 2
3 Q7. How much time is required to compute a) Using a simple routine to perform exponentiation?
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: b) Using the routine in Section 2.4.4 (p.32)? Q8. Swap two adjacent elements by adjusting only the pointers (and not the data) using: a) Single linked lists. b) Doubly linked lists. ∑ = = N i i i X A x F ) ( 4 Q9. Given two sorted lists, L1 and L2, write a procedure to compute L1 ∩ L2 using only the basic list operations. Q10. Show how to implement two stacks using only one array. Your stack routines should not declare an overflow unless every slot in the array is used. Q11. Show how to implement three stacks in one array....
View Full Document

This note was uploaded on 12/28/2010 for the course CSC CSC1110 taught by Professor Cjyuan during the Fall '06 term at CUHK.

Page1 / 4

Review 1 - b) Using the routine in Section 2.4.4 (p.32)?...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online