{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

homework1-sol

# homework1-sol - CS251 Homework 1 Due date Monday March 7...

This preview shows pages 1–2. Sign up to view the full content.

CS251 Homework 1 Due date: Monday March 7, 11:59pm in Blackboard, submit PDF files only. This is a firm deadline : no extensions or late submissions will be accepted, since solutions will be released immediately after the deadline. True/False Questions 1. In a dynamically-resized array implementation of a stack, any sequence of m push and pop operations takes time proportional to mn . False. For a stack with n items, any sequence of m push and pop operations takes (amortized) time proportional to m . 2. Amortized analysis is used to determine the worst case running time of an algorithm. True. Amortized analysis establishes a worst case bound for the performance of an algorithm by considering the average running time per operation over a worst-case sequence of operations. 3. In order to support the use of foreach statements, a data structure must implement the Comparable interface. False. The data structure must be iterable. 4. An nlog n algorithm is not necessarily slower than a 6 n algorithm for some input. True. For log n< 6 the n log n algorithm will be faster than the 6 n algorithm. 5. An algorithm that uses 12 n 2 + 4 n log n operations is an O( n 3 ) algorithm. True. Big O designates an upper bound, it’s not necessarily tight. 6. An array is partially sorted if the number of inversions is linearithmic.

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 5

homework1-sol - CS251 Homework 1 Due date Monday March 7...

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

View Full Document
Ask a homework question - tutors are online