void displayHashValues(dataList L)
{
	/* variable declaration here */
	
/*	system("cls");
*/
	printf("\n\n%s", "Displaying Open and Closed Hash Values");
	printf("\n--------------------------------------\n");
	printf("\n%-10s","ID");
	printf("%-30s","Name");
	printf("%-15s","Open HValues");
	printf("%-15s","Closed HValues");
 
  	printf("\n");  
 
/*--------------------------------------------------------------------------------
  * Put the necessary code fragment here                                *
  *--------------------------------------------------------------------------------*/
  int i, openKey, closeKey;

  for(i=0;i<L.last;i++){
    	openKey = openHash(L.data[i].name.LName);
  	closeKey = closeHash(L.data[i].IDen);
  	printf("%s %s, %s %c.", L.data[i].IDen, L.data[i].name.LName, L.data[i].name.FName, L.data[i].name.MI);
  	printf("\t\t%d\t%d", openKey, closeKey);
  	printf("\n");
  }
    printf("\n\nPress any key to continue...  ");
    getch();
}
void insertDictionary(studRec stud, Dictionary D)
{
	
	//OPEN HASH
	int openKey;
	studPtr studNode, trav;

    openKey = openHash(stud.name.LName);
    studNode = (studPtr)malloc(sizeof(struct node));
	studNode->stud = stud;

	if(D->openHT[openKey].count > 0){
		for(trav = D->openHT[openKey].ptr; trav->next!=NULL && (strcmp(studNode->stud.name.LName, trav->stud.name.LName) > 0 && strcmp(studNode->stud.name.LName, trav->next->stud.name.LName) > 0); trav = trav->next){}
		studNode->next = trav->next;
		trav->next = studNode;	 	
	}else{
		studNode->next = D->openHT[openKey].ptr;
		D->openHT[openKey].ptr = studNode;
	}
	
	D->openHT[openKey].count++;
	
	//CLOSE HASH
	int closeKey, i, j=0;
	studPtr newNode;
	statusType empty = EMPTY, occupied = OCCUPIED;
	
	closeKey = closeHash(stud.IDen);
	newNode = (studPtr)malloc(sizeof(struct node));
	
	newNode->stud = stud;
	newNode->next = NULL;
	
	for(i=closeKey; j==0;i =(i+1)%(CLOSE_SIZE)){
		if(D->closeHT[i].status != OCCUPIED){
			D->closeHT[i].ptr = newNode;
			D->closeHT[i].status = OCCUPIED;
			D->closeHashCount++;
			printf("%s inserted at %d\n ", newNode->stud.name.LName, i);			
			j = 1;
		}
	}
}
GridDisplay::GridDisplay(int winSize, Tracklist *tracklist, Grid* grid_, QWidget *parent)
: MyDisplay(tracklist, parent), _winSize(winSize)
{
	this->grid_ = grid_;
	_cellSize = grid_->getCellSize(_winSize);
	setMinimumSize(winSize, winSize);
	setMouseTracking(true);
	setAcceptDrops(true);
	squareHasInitialized.resize(grid_->getHeight() * grid_->getWidth());
	for(int i = 0; i < grid_->getHeight() * grid_->getWidth(); i++)
		squareHasInitialized[i] = false;
	oldXPos = -1;
	oldYPos = -1;
	oldX1Pos = -1;
	oldY1Pos = -1;
	fullScreenMouseOn = false;
	initDone = false;
	fullScreenTimer = new QTimer(this);
	fullScreenTimer->setInterval(150);
	colourMapMode_ = false;


	connect(this, SIGNAL(clearMode()), grid_, SLOT(clearMode()));
	connect(this, SIGNAL(extractMode()), grid_, SLOT(setExtractMode()));
	connect(this, SIGNAL(trainMode()), grid_, SLOT(setTrainMode()));
	connect(this, SIGNAL(predictMode()), grid_, SLOT(setPredictMode()));
	connect(this, SIGNAL(initMode()), grid_, SLOT(setInitMode()));
	connect(this, SIGNAL(savePredictionGridSignal(QString)), grid_, SLOT(savePredictionGrid(QString)));
	connect(this, SIGNAL(openPredictionGridSignal(QString)), grid_, SLOT(openPredictionGrid(QString)));
	connect(grid_, SIGNAL(repaintSignal()), this, SLOT(repaintSlot()));
	connect(this, SIGNAL(cancelButtonPressed()), grid_, SLOT(cancelPressed()));
	connect(this, SIGNAL(hashLoadPressed()), grid_, SLOT(openHash()));
	connect(fullScreenTimer, SIGNAL(timeout()), this, SLOT(fullScreenMouseMove()));
	connect(grid_, SIGNAL(errorBox(QString)), this, SLOT(showErrorMessage(QString)));
	connect(this, SIGNAL(resetGridAction()), grid_, SLOT(resetGridSlot()));
}