How do algorithms discover how to get to the right answer?

By trying a lot of different methods until one worksIt can figure it out just by comparing the data

Perfect!

The algorithm needs to try a lot of different methods to find the right solution.