Recursive Insertion in Hash Table (Linear Probing) I was practicing implementing a hash function. I tried to use linear probing to insert in hash table. The insertion is working alright but I am not satisfied with the recursion. It doesn't feel like "good recursion". The Linear_Probing function instead of being recursive itself uses two other functions (excluding hash function) for recursive insertion: Index_Finder() and its auxiliary function.

Is there any way I can do the recursion better in this code for inserting into a hash table?

int Hash(int number); //&lt;Hash function returns index by adding the first and last digit of a number;
bool Linear_Probing(int array[], bool flags [], int MAX_SIZE, int number, int &amp;collisions); //&lt;This function if possible inserts the number in the Hash Table 
int Index_Finder(int number, bool flags[], int MAX_SIZE, int &amp;collisions); //&lt;This function finds the index where the number should be inserted. It returns -1 if no empty slot is found.
int Index_Finder(bool flags[], int MAX_SIZE, int index, int limit, int &amp;collisions); //&lt;This is an auxilary function


int main()
{
    const int MAX_SIZE = 11;
    int collisions = 0;
    int array[MAX_SIZE];
    bool flags[MAX_SIZE];

    for (int i = 0; i &lt; MAX_SIZE; i++)
    {
        array[i] = 0;
        flags[i] = false;

    }

    //&lt;Inserting numbers in hash table using linear probing
    Linear_Probing(array, flags, MAX_SIZE, 67, collisions);
    Linear_Probing(array, flags, MAX_SIZE, 19, collisions);
    Linear_Probing(array, flags, MAX_SIZE, 3, collisions);
    Linear_Probing(array, flags, MAX_SIZE, 808, collisions);
    Linear_Probing(array, flags, MAX_SIZE, 337, collisions);
    Linear_Probing(array, flags, MAX_SIZE, 1, collisions);
    Linear_Probing(array, flags, MAX_SIZE, 86, collisions);
    Linear_Probing(array, flags, MAX_SIZE, 38, collisions);

    return 0;
}

bool Linear_Probing(int array[], bool flags[], int MAX_SIZE, int number, int &amp;collisions)
{
    int dummy_collisions = 0;
    int index = Index_Finder(number, flags, MAX_SIZE, dummy_collisions);

    if (index == -1)
        return false;

    else
    {
        collisions += dummy_collisions;

        array[index] = number;
        flags[index] = true;
        return true;
    }
}

int Index_Finder(int number, bool flags[], int MAX_SIZE, int &amp;collisions)
{
    int index = Hash(number);

    if (index &lt; MAX_SIZE &amp;&amp; !flags[index])
        return index;

    if (index &gt;= MAX_SIZE)
    {
        index = 0;

        if (!flags[index])
            return index;

        else
            collisions++;
    }

    else
    {
        collisions++;
    }

    int limit = index;

    return Index_Finder(flags, MAX_SIZE, ++index, limit, collisions);

}

int Index_Finder(bool flags[], int MAX_SIZE, int index, int limit, int &amp;collisions)
{
    if (limit == index)
        return -1;

    if (index == MAX_SIZE)
        index = 0;

    if (!flags[index])
        return index;

    else
    {
        collisions++;
        return Index_Finder(flags, MAX_SIZE, ++index, limit, collisions);
    }
}


int Hash(int number)
{
    int first_digit = 0, last_digit = 0;
    bool first_time = true;

    while (number &gt; 0)
    {
        if (first_time)
        {
            first_digit = number % 10;
            number -= (number % 10);
            number /= 10;
            first_time = false;
        }

        else
        {
            last_digit = number % 10;
            number -= (number % 10);
            number /= 10;
        }
    }

    return (first_digit + last_digit);
}
When commenting to describe a function's purpose, it's more common to have them on top of the signature of the function definition.  Having them next to the prototypes like that makes those lines harder to read and increases the code'd horizontal length.
Your curly brace usage with single-line statements is inconsistent.  It's also better to use them for all statements like these and can prevent some bugs and ease maintenance.
Instead of initializing the arrays with a loop, you can use std::fill_n():

std::fill_n(array, MAX_SIZE, 0);
std::fill_n(flags, MAX_SIZE, false);


While it may not matter in smaller programs, it's still more concise and can be safer.
You're passing C-arrays to functions, which shouldn't be done in C++ as this will cause them to decay to pointers.  Instead, pass in an object of a container class such as std::vector (dynamic) or std::array (static).  Choose whichever best gets the job done for you.