This project will be due by 5 pm, Monday, September 29. To submit your
project, save it in the pp2
directory located in your directory under
/home/libs/dataStr/students/
on one of the department's Linux
machines (this is a shared directory, so you should be able to reach it
from any of the machines, including Jupiter).
You may work on this project by yourself or in a group of two or three. If you work in a group, be sure to include everyone's name in the comments at the top of each file. Also, be sure you understand the guidelines for group work listed in the syllabus--the fundamental idea is that everyone in the group should understand what everyone else has done, and be able to recreate it on their own.
The project is Programming Exercise 5-42 in the text (p. 279). Note that the instruction for part (c) is misleading; it should read
(c) Use these new operations to implement the following functions:That is, you should implement the
insertOrder
and
removeDuplicates
functions using the insert
and
erase
members that you added to the miniVector class in parts (a)
and (b).
You should start by creating your pp2
directory and copying the
book's miniVector implementation into it (the following commands assume
that you start in your directory under
/home/libs/dataStr/students/
):
mkdir pp2 cd pp2 cp /home/libs/dataStr/pp2/minivec.h minivec.hThe member functions for parts (a) and (b) go in your
minivec.h
file, while the code for parts (c) and (d) should go in a separate
.cc
file in the same directory. Remember to
#include "minivec.h"
from your main program, so that the correct
version of miniVector will be defined.
Here is a sample output:
Original random integers: 11 1 19 6 13 18 17 13 3 4 2 4 13 3 8 Ordered integers using insertOrder: 1 2 3 3 4 4 6 8 11 13 13 13 17 18 19 Unique integers using removeDuplicates: 1 2 3 4 6 8 11 13 17 18 19