Well the optimiser won't use any algorithm. The optimiser optimises queries, it doesn't run them.
Why does it matter?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability