## DEV Community

Rishal Hurbans

Posted on • Updated on

# Algorithms are like recipes

Algorithms are like a pita bread recipe. There's a problem being solved (making good pita bread), ingredients required (pieces of input), a sequence of steps to follow (recipe instructions), and the resulting output, in this case, pita bread of a certain quality.

Algorithms can provide the same output given a specific input, always - these are called deterministic algorithms; or they can result in a different output when the steps involve an element of randomness or uncertainty - these are called stochastic algorithms.

The algorithm for a .max(x, y) function might involve comparing two numbers to find the maximum. Inputs are x and y, and the algorithm finds the largest - somewhat easy to intuit how it works.

The algorithm for Photoshop to cut a background might involve iterating through all the pixels in an image and finding edges or areas of contrast - there's a set of well known techniques for this.

The algorithm for Netflix might involve comparing the category of videos you've watched with the categories of all other movies out there to provide you with recommendations...

...or, it might compare your demographic data with other user's data, and provide you with recommendations based on movies they have watched - these algorithms' outputs are more difficult to estimate.

You might have heard of the joke: An algorithm is a word used by programmers when they don't want to explain what they did...

Deep learning models are solving some of the toughest problems today, but they're often mysterious in their workings. The future calls for algorithms to be more transparent, understandable, and accessible to people of varied skillsets - a mammoth of a challenge for us all!

If you enjoyed this thread, check out my book: Grokking Artificial Intelligence Algorithms with Manning, consider following me for more, or join my mailing list for infrequent knowledge drops in your inbox: rhurbans.com/subscribe.