DEV Community

Cover image for How to Solve Any Algorithm

How to Solve Any Algorithm

Jared Nielsen on May 17, 2021

This article originally published at jarednielsen.com In 1992, Mary Oliver published Poem 133: The Summer Day, which ends with a question for the ...
Collapse
 
sbleks profile image
Bleks
  1. Farmer brings duck to side b
  2. Farmer goes back to side a
  3. Farmer brings fox over to side b
  4. Farmer brings duck back to side a
  5. Farmer brings corn to side b
  6. Farmer goes back to side a
  7. Farmer brings duck to side b

This way the Fox is never left alone with the duck and the duck is never left alone with the corn while getting all three to side b. No need for a cage!

Collapse
 
keskyle17 profile image
Chris Briggs

Interest article. The value of understanding how to construct truth tables to resolve problems during the decomposition stage is invaluable to programmers. Some investment in logic and discrete mathematics is worth its weight. I recommend Discrete Mathematics and it’s Applications.

Collapse
 
nielsenjared profile image
Jared Nielsen

Of course! Or should I say, O(f) course? I'll put this in the backlog. It would make a great future article. Thanks for the book rec. I'll check it out.

Collapse
 
cebuka profile image
Simon Chukwuebuka

Insightful article

Collapse
 
anagheshmuruli profile image
Anaghesh Muruli

Awesome!

Collapse
 
bam92 profile image
Abel Lifaefi Mbula

Thanks for this interresting post. I've written a post on how to write a pseudocode here.

Collapse
 
nielsenjared profile image
Jared Nielsen

Nice work on the pseudocode post. I found the verbs particularly useful. If anything, I would recommend/request examples of their use. Cheers!

Collapse
 
rohithv07 profile image
Rohith V

Great article with a nice example

Collapse
 
jighdan profile image
Reinny Almonte

Great Article!

 
pengriffey profile image
pengriffey

The cage is less efficient

Collapse
 
lluismf profile image
Lluís Josep Martínez

The first algorithm I was taught in a programming class was how to make a french omelette.

Collapse
 
nielsenjared profile image
Jared Nielsen

You know what they say, "If you want to make an omelette, you gotta break statement..."

When I was teaching, I used how to make peanut butter & jelly sandwiches as the first algorithm.

Collapse
 
lluismf profile image
Lluís Josep Martínez

All you need to do now is translate that plain language into JavaScript (shudder) , Python, or Java

Collapse
 
lainz profile image
Leandro Diaz

Thanks

Collapse
 
manolopez profile image
manolopez

something interesting and disturbing indeed.

Collapse
 
souvikkundu88 profile image
Souvik Kundu

Great article. Thank you.

Collapse
 
mmanflori profile image
flutterCode

Great article. thx

Collapse
 
naveennamani profile image
naveennamani

Simple solutions do exist when you "think outside the box".