DEV Community

Cover image for Algorithms are like recipes
Rishal Hurbans
Rishal Hurbans

Posted on • Edited 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.

Alt Text

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.

Top comments (1)

Collapse
 
ronni-nichols profile image
Ronni

Hi,

Wrapping a pita effectively involves a few simple steps to ensure that your fillings stay inside and the pita remains easy to eat.
Here are some effective ways to wrap a pita:

Basic Fold

Warm the Pita: Lightly warm the pita bread to make it more pliable.
Prepare Fillings: Lay out your fillings such as hummus, vegetables, meats, or sauces.
Spread Fillings: Place the fillings in the center of the pita, leaving some space around the edges.
Fold the Bottom: Fold the bottom edge of the pita up about one-third of the way.
Fold the Sides: Bring the left and right sides of the pita towards the center, overlapping them over the fillings.
Secure the Wrap: Hold the wrap firmly with your hand or use a piece of parchment paper or foil to keep it together.

Image description

Burrito Style

  • Warm the Pita: Slightly warm the pita to make it easier to handle.
  • Fillings Placement: Place the fillings in a line slightly off-center.
  • Fold Bottom Edge: Fold the bottom edge of the pita up and over the fillings.
  • Fold Sides Inward: Bring the left and right sides inward towards the center, enclosing the fillings.
  • Roll Up: Roll the pita from the bottom up, tucking in the sides as you go to keep everything secure.
  • Wrap in Paper/Foil: For extra security, wrap the pita in parchment paper or foil.

Pocket Style

  • Warm the Pita: Warm the pita slightly to make it easier to open.
  • Cut the Pita: Cut the pita in half to form two pockets.
  • Open the Pocket: Gently open each half to form a pocket.
  • Stuff the Pocket: Fill each pocket with your chosen ingredients. Start with a layer of spread or sauce to prevent the pita from becoming soggy.
  • Pack Tightly: Ensure the fillings are packed tightly but not overstuffed to prevent tearing.

Triangle Fold

  • Warm the Pita: Warm the pita to make it more flexible.
  • Place Fillings: Place your fillings in the center of the pita.
  • Fold Bottom Edge Up: Fold the bottom edge up to cover the fillings.
  • Fold One Side: Bring one side of the pita over the fillings, creating a triangular shape.
  • Fold Other Side: Fold the remaining side over the top, forming a compact triangle.
  • Secure with Paper/Foil: For added stability, wrap the pita in parchment paper or foil.

Tips for Wrapping Pita

  • Do not overfill: Overfilling can cause the pita to tear or the fillings to spill out.
  • Use spreads or sauces as a base: This can help hold the other ingredients in place and add flavor.
  • Wrap tightly: Wrapping tightly helps keep the ingredients together and makes it easier to eat.
  • Secure with paper/foil: Wrapping the pita in parchment paper or foil can help hold it together, especially if you plan to eat it later or on the go.

By following these steps, you can create a neatly wrapped pita that holds together well and is enjoyable to eat.