Thanks, I just noticed a error on the insertion. I updated the first post within the correct code and tests.
Spoiler
Code:
// Here you add the element on the array before the position `middleIndex`
if( arraySize < middleIndex + 2 )
{
ArrayPushCell( array, element );
}
else
{
ArrayInsertCellBefore( array, middleIndex, element )
}
-->
Code:
// Here you add the element on the array
if( arraySize )
{
// Get the `currentCell` at the position `middleIndex`
currentCell = ArrayGetCell( array, middleIndex );
// To determinate whether to add the `element` after or before the position `middleIndex`.
if( currentCell < element )
{
ArrayInsertCellAfter( array, middleIndex, element )
}
else
{
ArrayInsertCellBefore( array, middleIndex, element )
}
}
else
{
ArrayPushCell( array, element );
}
__________________