Stack overflow issue with array of linkedlist
<p>For starters my program is to create a hash table of names where collison is handled by chaining.
So i create an array of Linked List. Problem is my array is very large 88801 to be exact.  Im thinking thats why im getting a stack over flow but im not sure.  My code is below.  Some one tried telling me to make the array a set of pointers to linked list.<br>
IE putting LinkedList* hashbucket1[88801] which this removed the stack overflow issue but caused other linking errors.  Guess im trying to figure out what is the best way to impliment an array of linked list of strings.  If im on the right track and its something small im over looking please point it out or tell me to scrap this and start over with a given path in mind.  If i need to link or zip up my other files let me know and i can.</p>

<pre><code>#include &lt;iostream&gt;
#include "LinkedList.h"
#include &lt;string&gt;
#include &lt;fstream&gt;

using namespace std;

 unsigned long djb2(string&amp; str) 
 { 
 unsigned long hash = 5381; 

  for(string::iterator it = str.begin();it!=str.end();it++)  
    hash = ((hash &lt;&lt; 5) + hash) + *it; /* hash * 33 + character */ 

 return hash; 
 }

  static unsigned long sdbm(string&amp; str)
{
    unsigned long hash = 0;
    int c;

   for(string::iterator it = str.begin();it!=str.end();it++)
        hash = *it + (hash &lt;&lt; 6) + (hash &lt;&lt; 16) - hash;

    return hash;
  }


  void insert(LinkedList HashList1[], LinkedList HashList2[], int listSize);

    int main() {
char command;
int listSize = 88801;
LinkedList HashList1[88801];
LinkedList HashList2[88801];
bool invalidcommand;
do{
    do{
        cout &lt;&lt; "MENU" &lt;&lt; endl;
        cout &lt;&lt; "(I)nsert new entry" &lt;&lt; endl;
        cout &lt;&lt; "(S)earch" &lt;&lt; endl;
        cout &lt;&lt; "(D)elete Entry" &lt;&lt; endl;
        cout &lt;&lt; "(C)reate Hast Table" &lt;&lt; endl;
        cout &lt;&lt; "(L)og File" &lt;&lt; endl;
        cout &lt;&lt; "(Q)uit and Exit Program" &lt;&lt; endl;

        cin &gt;&gt; command;

    if(command == 'I'){
        insert(HashList1, HashList2, listSize);
    }else if(command == 'S'){
  //            search(HashList1, HashList2, listSize);
    }else if(command == 'D'){

    }else if(command == 'L'){ 
    //  save(HashList1, HashList2, listSize);
    }else if(command == 'C'){
    //  load(HashList1, HashList2, listSize);
    }
}while(command != 'Q');

return 0;
    };

    void insert(LinkedList HashList1[], LinkedList HashList2[], int listSize){

string lastName;
bool invalidID;
//Person newPerson;
do
{
    invalidID = false;
    cout &lt;&lt; "Please enter Last Name: ";
    cin &gt;&gt; lastName;
    while(cin.fail())
    {
        cin.clear();
        cin.ignore();
    }
}while(invalidID);
//newPerson.setLastName(lastName);
int hashBucket1;
int hashBucket2;
hashBucket1 = djb2(lastName) % listSize;
hashBucket2 = sdbm(lastName) % listSize;
LinkedList bucket1;
if(!HashList1[hashBucket1].find(lastName)){     
    //HashList1[hashBucket1].insert(newPerson);
    HashList1[hashBucket1].insert(lastName);

}else{
    if(!bucket1.find(lastName)){

        HashList1[hashBucket1].insert(lastName);
    }else{
    cout &lt;&lt; "List already contains an entry with the last name " &lt;&lt; lastName &lt;&lt; endl;
    }
}
LinkedList bucket2;
if(HashList2[hashBucket2].find(lastName)){
//  bucket2.insert(newPerson);
}else{
    if(!bucket2.find(lastName)){
        //bucket2.insert(newPerson);
    }else{
    cout &lt;&lt; "List already contains an entry with the last name " &lt;&lt; lastName &lt;&lt; endl;
    }
}
   }
</code></pre>
