1)my assignment as posted:
"Hash Table
Want it your way? Now's your chance! Instead of me assigning predefined header files, prototypes and whatnot, I'm going to give you the opportunity to design and implement a solution to a problem entirely on your own. All you have to do is design and implement an ADT to function as a hash table! To keep things simple, all your program has to do is read integer values from stdin and insert them into the table. Although each implementation will certainly differ significantly, there are some constraints that we'll agree on:
Your implementation has to be entirely your own code from scratch, no external libraries with pre-built components (e.g., the Standard Template Library).
You'll provide a complete implementation of the program, which means not only the ADT but also the test driver.
You should use the object-oriented techniques in C++ to create a class ADT for your hash table. Follow the book's approach in designing the ADT – first think about what operations are going to be necessary, sketch out an operations contract, which eventually will lead you to filling in a functional specification.
We'll be using “open addressing” (p.550), and the size of the hash table will be contained in a header file I'll give you called hashdefs.h, so you'll need to #include this file in your source code anywhere the size of the hash table is required.You'll find a copy of this file in the Project2 directory of your ssh account.
The hash function will be a simple “modulus” operation, where the hashed index is the remainder of dividing the search key by the size (capacity) of the hash table.
As we saw in class, there are several methods to handle collision resolution, but the one you'll implement is double-hashing (p.552); you can use h2(x) = R - (x % R) with "R" being the largest prime number smaller than the size of the hash table. A simple way to derive this prime number is to use Euler's equation of n2+ n + 41, which will produce prime numbers for n < 40. This means that the size of your hash table has to be greater than 41 and less than 1,608, but that's a constraint we can live with! The resulting number can then be used in your second hash function should you need to resort to double-hashing.
The final executable should be able to read integer values from stdin so I'll be able to test it by using redirection on the command line. The number read from stdin should be submitted to a hash table member function that will take it from there and attempt to store the integer in the ADT. So do whatever you want in your code to help you during the development phase, but the final executable should be able to run like this:
./a.out < ints.txt > results.txt
Your program should indicate what is happening as integers are inserted into the table. Since you'll be writing all your messages to stdout, I'll be able to collect whatever you're writing out into an output file (again, using redirection) and examine its contents after a program run. What kind of messages should you be writing to stdout? The way I see it, there are basically three types of messages that would be interesting to see: if a number is successfully inserted into the table, if a number cannot be inserted into the table (because there isn't an available location), and if a number can't be inserted because it's already in the table. We should agree on the format of each of these messages so that the output is consistent among different implementations, so here's what I suggest:
success: 42551 // 42551 was successfully inserted into the table
failure: 42551 // 42551 cannot be inserted, no available location
exists: 42551 // 42551 already exists in the table
"
Which is largely irrelevant to my issue. Now to your question of what number it can be anything, which is why I posted the question as "use Euler's formula to find the greatest prime number under :" As per the assignment the starting number can, and likely will change based upon some unknown criteria.
2) I fully understand that the "formula" that I am required to use will miss some prime numbers. I've been beating myself against this thing for 3 days now, and I have no concept of how it does anything except cause me no end of frustration.
3) 68 is the starting point I was given, and I need to check the numbers below it until I find the "largest" prime number. The point is that all of us use the same "formula" for finding prime numbers.