CIS-3050 Algorithms and Data Structures
Due: Monday, Sept 20
This assignment is to implement two
template classes, Node and SList.
the singly linked node we went over in class. Include the
T data, Node<T> * next)
(Node<T> * next) // set the next pointer to a
getNext() // retrieve the next pointer
The constructor for Node should
being called with no arguments, with just a data argument, and
with both arguments supplied.
a singly-linked list that uses Node
Include the following methods:
size() const // return the size of the SList
insertFirst(const T data) // insert at the front of the
getFirst() // get the first element
removeFirst() // remove (delete) the first element in the SList
print() // print the contents of the SList
If is preferable (but not required) to implement print by overriding
the << operator in the SList class.
To be turned
- Your implementation of the Node class. This will consist
of (at least) Node.h, and possibly Node.cpp
- Your implementation of the SList class. This will consist
of SList.h and possibly SList.cpp
- A program (C++ main) that fully tests the SList class. Be
sure to test all the public functions
- Within the comments of SList and Node, be sure to mention the
runtime performance (Big-Oh notation) of each function of SList.
- Use dynamic memory allocation when inserting and removing
elements. Be sure to clean up after yourself!
- Write a test program that exercises all your elements. I
should be able to run your test program, and clearly see that all the
functions above work, without reading your actual test code.
- You may use whatever development environment/C++ compiler you
- Include your name and what environment/compiler you used in
README file that you submit
- All the files you create/modify should be placed in a zip file
and submitted via Blackboard. The assignment is due by midnight
on Monday, Sept. 20.
- All code should have reasonable comments/style. I'm not
enforcing a set style, but your code should be readable, and include
comments about anything that is nonobvious. For this first
assignment, I will assume that you know what this means, and provide
guidance for violators. I do reserve the right to take
deductions if your code is particular hard to read/undocumented, but my
goal is just to coach you in the right direction, unless the violation
is particularly major.
As needed, I can be reached via email, AIM or in my office on the 2nd
floor of the 700 building. See my schedule
for my official office hours. I also anticipate being
available during the afternoons until around 4p. If
you do need help,
including your source code files in any email to me can be helpful and
Good Luck and Good Coding!