Course Home | Homework | Lab Hours | Programming | Schedule & Lecture Notes | Submit

Saint Louis University

Computer Science 150
Introduction to Computer Science

Michael Goldwasser

Fall 2005

Dept. of Math & Computer Science

Homework Assignment 05

Recursion

Contents:


Overview

Topic: Recursion
Related Reading: Zelle 13.2
Due: 1:10pm, Monday 5 December 2005

Please make sure you adhere to the policies on academic integrity.


Problems to be Submitted (20 points)

For both of these problems, you could always type in the specified code fragments and let Python answer the questions for you, however you are strongly advised to first attempt these problems by hand! (as these are the type of problems which might be seen on an exam)

  1. (5 points)

    Write a recursive method __contains__(self,value) for use within the OurList class. This should return True if the list contains the value, and False otherwise.

  2. (5 points)

    Zelle's Chapter 13, "Discussion" question 4 (page 462)

  3. (5 points)

    Zelle's Chapter 13, "Programming Exercise" question  3 (pages 463)

  4. (5 points)

    Zelle's Chapter 13, "Programming Exercise" question  4 (pages 463)


Extra Credit

  1. (2 points)

    Write a recursive method __getslice__(self,i,j) for use within the OurList class. This method should return a new instance of OurList which represents the slice self[i:j]. You may assume that integers i and j are non-negative.

    Remember that the original list should not be mutated when computing a slice, or subseuqently modifying that computed slice.


Michael Goldwasser
CSCI 150, Fall 2005
Last modified: Monday, 28 November 2005
Course Home | Homework | Lab Hours | Programming | Schedule & Lecture Notes | Submit