CSC 161 Grinnell College Fall, 2011
 
Imperative Problem Solving and Data Structures
 

CSC 161 Module 6: Pointers, Stacks, and Queues

Summary and Main Topics

This module applies previous concepts (e.g., pointers, linked lists) to widely-used dynamic data structures. Topics covered include:

  1. More about pointers
  2. Variations of linked lists
  3. Stacks
  4. Queues
Day Topic Preparation In-class Due Date Availability
for
Extra
Credit
Tuesday, November 15 Abstract data types
Module 6: Stacks, queues
Readings on      
Wednesday, November 16 Abstract data types
Module 6: Stacks
Reading on stacks

Four implementations of stacks:

  • main program using stack operations according to some implementation
  • approach 1, in which the stack contains an array of pointers and the stack just points to strings as entered
  • approach 2, in which the stack contains an array of the strings themselves and strings are copied onto the stack and back
  • approach 3, in which the stack contains an array of pointers and space is allocated to copy the string during each push operation.
  • approach 4, in which the stack contains an array of the strings themselves and strings are copied onto the stack and just a reference is to the string is returned by a pop. (This approach found on several student programs.)
lab on stacks    
Friday, November 18 Abstract data types
Module 6: Queues
Reading on queues lab on queues Tuesday, November 29  
Monday, November 21 Program management: header files Reading on program management lab on program management   Monday, December 5
Tuesday, November 22 Hour Test 3
Wednesday, November 23 Bash scripts
Module 6: Using Bash scripts for testing
Reading on Bash Scripts lab on bash scripts   Wednesday, December 7
Monday, November 28 Project   Photos with Stacks and Queues Due: Friday, November 2  

Project: Robot Pictures with Stacks and Queues

Working in pairs, students should develop a program that creates a stack and a queue, makes the robot take (at least) fifteen pictures, and show the pictures in a "movie" and a "reverse movie", using the stack and queue implementations.

Use a Makefile for compiling your program(s); the Makefile should compile the stack implementation, queue implementation and movie operations separately.

You should also consider possible mistakes that may arise with your implementation, develop a test plan, and run tests to ensure you code is working correctly.

Each image should be different from the previous. Possible ways to implement this would be to have the robot move between taking pictures, or have someone/something move in front of the robot.

Grading

This project will be worth 25 points, based on the following rubric:


This document is available on the World Wide Web as

http://www.cs.grinnell.edu/~walker/courses/161.fa11/module-pointers-stacks-queues/module-pointers-stacks-queues.shtml

created created 19 July 2011 by Henry M. Walker
last full revision 17 August 2011 by Henry M. Walker, Dilan Ustek, and April O'Neill
revised 2 September 2011 by Henry M. Walker
revised 18 November 2011 by Henry M. Walker
Valid HTML 4.01! Valid CSS!
For more information, please contact Henry M. Walker at walker@cs.grinnell.edu.