Homework Assignments
Current
Due - Tuesday, May 9, 2006
- Write, compile, debug, and test a Stack class. You
may implement your stack using an array or a linked list. Your
Stack class must provide the push, pop, top, isEmpty, size, and
printStack functions. You must also support a recursive
reversePrint function that will print your stack from bottom to
top. Electronically submit all files required to compile and
run your program.
Past Due
Due - Thursday, Apr 27, 2006
- Chapter 16 - 16.2
- Write an algorithm for a new stack function which will
return the second element from the top of the stack without
changing the stack. Your algorithm should call push, pop, and
top to access stack elements. (you may not directly refer to the
second-to-top element.)
- Write an algorithm for a new stack function removeAll. This
function takes as input an element, removes all occurrences of
that element from the stack, and leaves the remaining elements
in their orignal order. For example, assume the original stack
was: 10, 45, 6, 77, 6, 6. After the call removeAll(6), the stack
will be as follows: 10, 45, 77. You must use push, pop, and top
to move elements. You may NOT access elements directly.
Due - Thursday, Apr 13, 2006
- Add the functions removeTail and reverseList to the
LinkedList class submitted on April 6.
Due - Thursday, Apr 6, 2006
- Write, compile, debug, and test a LinkedList
class. Your class should support the insertAtHead, removeHead,
insertAtTail, printList (which must be implemented
recursively), size, and isEmpty functions. You must
implement a Node class that will be used to store a
single string and will represent a single element of your
LinkedList. All data members of all classes must be declared
private or protected. Electronically submit LinkedList.h,
LinkedList.cpp, Node.h, Node.cpp, and
Test.cpp.
Due - Thursday, Mar 30, 2006
- Describe a recursive algorithm to count the number of
nodes in a linked list.
- Describe an algorithm to reverse a linked list.
Due - Thursday, Mar 16, 2006
- Chapter 6 - 6.3, 6.4, 6.15(a)
- Chapter 8 - 8.19
Due - Tuesday, Feb 28, 2006
- Chapter 3 - 3.1, 3.2
- Chapter 4 - 4.1, 4.6, 4.7, 4.11
Due - Tuesday, Feb 21, 2006
- Write a program that will (1) read from a file information
about a collection of CDs and store the information in an array
of pointers to CD objects; (2) print all information contained
in the array; and (3) save the information to a new output file.
Use the CD class that you have already implemented and debugged.
You must also define a Database class that contains the array of
pointers to CDs as a private data member. This class should
implement (at least) three functions that will perform the
operations described above. Test this class by writing a
Test.cpp file that contains a main function that creates a
Database and invokes its member functions. Electronically
submit CD.h, CD.cpp, Database.h,
Database.cpp, and Test.cpp.
Due - Thursday, Feb 16, 2006
- Chapter 2 - 2.14, 2.22
- Read Project 1.
- Implement
a CD class that will store all relevant information about
a single CD. Make sure that you define all appropriate accessor
and modifier functions for the private data members of the
class and include a print function that will print relevant information about the CD.
Test this class by writing a Test.cpp file that contains
a main function that creates one or more CD objects and invokes
all member functions of the CD class at least once.
Electronically submit CD.h, CD.cpp, and
Test.cpp.
Due - Thursday, Feb 9, 2006
To Be Assigned
Sami Rollins