Recursive Algorithm For Linear And Binary