Once having the base case #40 , finding pivots function and lema 3.3 Data structure #42 , we can implement the main algorithm function. For reference: https://dl.acm.org/doi/pdf/10.1145/3717823.3718179 <img width="631" height="875" alt="Image" src="https://github.com/user-attachments/assets/e7017955-c4a0-49c9-8aa6-b31885af1e40" />