Course Home | Assignments | Peer Assessment Procedures | Schedule & Lecture Notes

Saint Louis University

Computer Science 314
Algorithms

Michael Goldwasser

Fall 2014

Dept. of Math & Computer Science

Homework Assignment 01

Introduction, Asymptotics, Divide and Conquer


Overview

Topics:
Related Reading: Chapters 1, 2, 3, 8, and 10 of CLRS
Due: 10:00am, Monday, September 8, 2014

Please make sure to strictly adhere to the stated course procedures regarding the format of your submitted homework. In particular, your name should not appear on anything other than the cover page, and your solution for each problem must be in a separate packet, labeled appropriately with your assigned codename.

You must also adhere to the policies on academic integrity, paying particular attention to the limits on collaboration.


Problems to be Submitted

  1. Work entirely on your own

    Problem 2-1 (starting on page 39 of CLRS)

  2. Work entirely on your own

    Problem 8-6 (on page 208 of CLRS)

  3. Work entirely on your own

    Exercise 10.3-4 (on page 245 of CLRS). To be sufficiently rigorous, your solution should include complete pseudocode, using the style of that chapter, and an explanation regarding the correctness and efficiency of your solution. Although not stated in the book's problem, it is important that both of your operations still run in O(1) time.

    I'd also like to note that I find the book's hint about an "array implementation of a stack" to be more misleading that it is useful. I suggest ignoring that entirely.

  4. You may discuss ideas with other students (but your writeup must be independent)

    Exercise 10.2-8 (on page 241 of CLRS). To be sufficiently rigorous, your solution should include complete pseudocode, using the style of that chapter, and an explanation regarding the correctness and efficiency of your solution.

  5. You may discuss ideas with other students (but your writeup must be independent)

    Assume that we have a sequence of n numbers containing all the integers from 0 to n except one, in arbitrary order. The goal is to efficiently determine which number is missing. However, the numbers are represented in binary. For example, the input for n=5 might be modeled as:
    101
    011
    010
    000
    001
    By the way, in this example, the missing number is 4.

    In solving the problem, you will be charged for each bit of the input that is examined. Therefore, at the beginning of the process for a given n, the unknown input might be viewed as follows:
    ???
    ???
    ???
    ???
    ???
    Note that the input to the algorithm consists of an array of n numbers, each of which is comprised of ⌊lg n⌋+1 bits.

    Describe an algorithm that finds the missing number while fetching O(n) bits. Make sure to justify its correctness and analysis.


Extra Credit

  1. Problem 4-5 (starting on page 109 of CLRS)


Michael Goldwasser ©2014
CSCI 314, Fall 2014
Last modified: Sunday, 07 September 2014
Course Home | Assignments | Peer Assessment Procedures | Schedule & Lecture Notes