Start from the beginning:
List_3358<int> *newList=new List_3358<int>[33971];
A magic number (explicit int constant > 2 - bad style). Possible solution:
const size_t TABLESIZE = 33971; // what is it and why...
typedef list<int> VChain;
...
VChain* pHash = new VChain[TABLESIZE];
An example of a wrong code and an irresponsible design:
char tempo = *argv[argc-1];
// this and the line below stores the last parameter(the number) into an int
int n = atoi(&tempo);
It was just your imagination that the last parameter is a single digit. Suppose the program started without parameters or with /? parameter (common convention: an user ask help on parameters, all good programs must support this feature). Alas, the next statement is wrong in any case. The atoi function wants a pointer to C-string (char array terminated by null chr). Of course, you get unpredictable result here.
Strictly speaking, it's the
most valued reason of your troubles. This unpredictable wrong number becames your SIZE value...
Apropos, a very strange all cmd line parameters concatenation is a very dangerous action too.
Avoid unusual redeclarations of common and well-known library names (rand, for example). It's possible but looks like a bad style.
To spread butter on butter:
vector<string> files = vector<string>();
// absolutely the same effect as in clear and simple
vector<string> files;
// but the 1st strange construct is (potentially) more expensive.
The readdir function returns ALL directory entries: files, directories, links, sockets etc. You need file entries only. Use d_type field of struct dirent to recognize file entries. Consult your system docs for right values of the d_type field.
Try to correct errors then try again...