Docsity

Computer Science Assignment: Algorithm Analysis and Implementation, Assignments of Algorithms and Programming

Toggle sidebar
bg1
Assignment 2
1. Prove correctness of SequentialSearch
2. Give worst, average, and best case runtime analysis of SequentialSearch
3. State and prove correct the iterative UpperBound algorithm
4. Give a complete runtime analysis for iterative UpperBound
5. Explain why “short circuit bailout” in any of the binary search algorithms is not
cost effective
6. Give a non-recursive procedure that reverses a singly linked list of size nthat has
Θ(n) runtime and +Θ(1) runspace [Exercise 10.2-7 on p. 209].
7. Give a non-recursive algorithm that performs an inorder tree traversal [Exercise
12.1-3 on p. 256].
8. Devise an algorithm that uses a Deque for control and such that using PushBack
implements depth-first search and changing to PushFront implements breadth-first
search
1

Partial preview of the text

Download Computer Science Assignment: Algorithm Analysis and Implementation and more Assignments Algorithms and Programming in PDF only on Docsity!

Assignment 2

  1. Prove correctness of SequentialSearch
  2. Give worst, average, and best case runtime analysis of SequentialSearch
  3. State and prove correct the iterative UpperBound algorithm
  4. Give a complete runtime analysis for iterative UpperBound
  5. Explain why “short circuit bailout” in any of the binary search algorithms is not cost effective
  6. Give a non-recursive procedure that reverses a singly linked list of size n that has Θ(n) runtime and +Θ(1) runspace [Exercise 10.2-7 on p. 209].
  7. Give a non-recursive algorithm that performs an inorder tree traversal [Exercise 12.1-3 on p. 256].
  8. Devise an algorithm that uses a Deque for control and such that using PushBack implements depth-first search and changing to PushFront implements breadth-first search

1