Check for Rehashing Conditions
   Move current table to old table. 
   Allocate new current table with updated capacity.

check if there happened some active transfer to oldtable (this check is after the first copy from current to the old table)or else exit

Perform Incremental Transfer (Move 25% of Old Table)
 Calculate the range of indices to transfer(as per in the project descriptiongiven)
 For each index in the range
Get the file at m_oldTable
If the file is NULL or marked as deleted (!file->m_used), skip it.
Find the target index in m_currentTable(appropriate available index in the hash table (m_currentTable) for a given file based on collision handling and probing.)
If the target index in m_currentTable is empty 
         Then we insert it here (make sure to update all the current and old table properties following the insertion you do)

         
Else:Think about the else case as well here(happens because when the    target index in the new table (m_currentTable) is already occupied by a deleted file,in such case, The deleted file is no longer valid data, so it needs to be cleared to make room for the live file being transferred.)

If all entries in m_oldTable are processed 
 Remove the oldtable, and its memory should be deallocated. 

is the psuedocode for my hash function 

is there correct ? 

void FileSys::rehash() {
    cout << "Rehashing has been called." << endl;

    // Exit if no active transfer
    if (m_oldTable == nullptr) {
        return;
    }

    // If this is the first rehash initialize new table
    if (m_oldTable == nullptr) {
        cout << "New table for rehashing..." << endl;

        m_oldCap = m_currentCap;
        m_oldTable = m_currentTable;
        m_oldSize = m_currentSize;
        m_oldNumDeleted = m_currNumDeleted;
        m_oldProbing = m_currProbing;

        int newSize = findNextPrime((m_currentSize - m_currNumDeleted) * 4);
        m_currentCap = newSize;
        m_currNumDeleted = 0;
        m_currentSize = 0;
        m_currProbing = m_newPolicy;
        m_currentTable = new File*[m_currentCap]();
        m_transferIndex = 0;
    }

    // incremental transfer
    int batchLimit = m_oldCap / 4;
    int transferEnd = min(m_transferIndex + batchLimit, m_oldCap);
    cout << "Transferring files from index " << m_transferIndex  << " to " << transferEnd - 1 << endl;

    for (int i = m_transferIndex; i < transferEnd; ++i) {
        File* file = m_oldTable[i];
        if (file != nullptr && file->getUsed()) {
            if (insertIntoTable(*file, m_currentTable, m_currentCap)) {
                m_oldNumDeleted++;
                delete file;
                m_oldTable[i] = nullptr;
            }
        }
    }

    m_transferIndex = transferEnd;

     // Check if rehashing is complete
    if (m_transferIndex >= m_oldCap) {
        // Go through old table and delete anything left(marked as not used)
        for (int i = 0; i < m_oldCap; ++i) {
            if (m_oldTable[i] != nullptr) {
                delete m_oldTable[i];
                m_oldTable[i] = nullptr;
            }
        }

        // Deallocate old table memory
        delete[] m_oldTable;
        m_oldTable = nullptr;

        // Reset old table
        m_oldCap = 0;
        m_oldSize = 0;
        m_oldNumDeleted = 0;

        // Update probing policy if necessary
        if (m_newPolicy != m_currProbing) {
            changeProbPolicy(m_currProbing);
        }
    }
}