!!!!!!!!

Try using std::set /std::unordered_set, for container type it will be easier then using vector/dequeue I guess ; please if u did use them contact me about them

Ford-Johnson algorithm

For cpp09 – ex02, we are required to use a minimum-comparison sorting algorithm.

The subject references Donald E. Knuth’s The Art of Computer Programming, Volume 3: Sorting and Searching, specifically Chapter 5.3, “Optimum Sorting”, and Section 5.3.1, “Minimum-Comparison Sorting”, where the Ford–Johnson algorithm (also known as merge-insertion sort) is described at page 184.

This algorithm is designed to sort a sequence using the minimum possible number of comparisons, approaching the theoretical lower bound for comparison-based sorting.

The act of sorting :

Before I dive into sorting , we should know if the data sort-able or no

Laws of data sort-ability

The foundation of comparison-based sorting relies on the law of trichotomy.

The law of trichotomy states that for any two elements a and b, exactly one of the following relations is true:

This law guarantees that elements can be compared in a consistent and unambiguous way.

To be sort-able, a set of N elements must satisfy this property for every pair of elements, meaning the comparison defines a total order.

When this condition is met, a sorting algorithm can correctly determine the relative order of all elements.

Exactly one of the possibilities a < b,a = b,b < a is true.