HW2 Handout - CSc 445: Homework Assignment 2 Assigned:...

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

View Full Document Right Arrow Icon
CSc 445: Homework Assignment 2 Assigned: Monday Feb 4 2008, Due: 10:30 AM, Monday February 18 2008 Clear, neat and concise solutions are required in order to receive full credit. Revise your work carefully before submission, and consider how your work is presented. If you cannot solve a particular problem, state this clearly in your write-up, and write down only what you know to be correct. For involved proofs, ±rst outline the argument and then delve into the details. 1. (10 pts) Let A be an array of n distinct integers. Suppose A has the following property: there exists an index 1 k n such that A [1] , . . ., A [ k ] is an increasing sequence and A [ k +1] , . . ., A [ n ] is a decreasing sequence. Design and analyze an eFcient algorithm for ±nding k . 2. (10 pts) Suppose we are given an array A , each element of which represents a di²erent vote in the next election, where each vote is given as an integer representing the ID of the chosen candidate. Assume that the ID of a candidate can be a much larger number than n , the total number of votes and we would like to use no more than O (1) additional storage. Without making any assumptions about who’s running or even how many candidates there are, design and analyze an
Background image of page 1

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

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

Page1 / 2

HW2 Handout - CSc 445: Homework Assignment 2 Assigned:...

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