THE EVOLUTION OF ALGORITHMS: FROM ANCIENT ROOTS TO MODERN COMPLEXITY