Data and statistics

For Project 1 this week the three different algorithms are at the following pages in our online ‘VitalSource’ version of “Data Structures and Algorithms”, 13th Edition in Chapter 4 :

1. The first algorithm implementation is the C++ Code Segment at the top of page 179
(The “Recursive Version” of the function called isUnique(). ). See code at end to see this first function run.

2. The second algorithm implementation is the C++ Code Segment at the top of page 180
(The “Iterative Version” of the function called isUniqueLoop(). )

3. The third algorithm implementation is the C++ Code Segment at the bottom of page 180
(The “Sorting Version” of the function called isUniqueSort().)

You need to create a main routine to drive these functions in your source code.

It needs to set up an array and call them. You can have three separate programs — one for each function — or you can have one program and call each of the three functions in succession from your main routine. This program source code just calls isUnique() with a 30 element integer array in order to get a somewhat reasonable run time measurable in seconds. I wanted to get longer runs but found that using Gnu C++ (g++) on my Mac had problems with a recursion depth greater than 30 (e.g. when I provided an array of more than 30 integers such that isUnique() descended to a depth of 30 recursive calls). I used the ‘time’ program in MacOS/Linux/Unix to get the user and system run times (in seconds) and percentages. Generally this version runs in approximately 6 seconds elapsed time on my slow MacBook.

I have included screen shoots of the book as well as the instructions from the professor

Last Completed Projects

topic title academic level Writer delivered