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

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: 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 nlogn 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, its not necessarily tight. 6. An array is partially sorted if the number of inversions is linearithmic. False. The number of inversions must be O( n ) and not O( n log n )....
View Full Document

This note was uploaded on 09/29/2011 for the course CS 251 taught by Professor Staff during the Spring '08 term at Purdue University-West Lafayette.

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 Right Arrow Icon
Ask a homework question - tutors are online