<p>One non-computer-related example of an algorithm that just about everyone will have hard of, and most will have used, is <strong>a cooking recipe</strong>.</p>
<p>A recipe book is nothing less than a collection of algorithms that, when ‘run’, create certain dishes.  Each recipe contains an initial state (the ingredients and equipment), and an algorithm to be executed to reach the intended final state (a dish ready to eat).  Ideally, anyone can follow the recipe to create the dish.</p>
<p>Of course, recipes are nowhere near as strictly-defined as programming languages; the variable nature of the ingredients, available tools, skill and experience of the cook, and desired result all vary considerably.  And the cook is expected to interpret the recipe accordingly.  (Which is of course something you can discuss with students as needed.)</p>
<p>But as an introduction to the <em>idea</em> of an algorithm — a set of instructions to follow — it should be intuitively obvious to someone of almost any age.  (I've seen it used before, so I'm surprised it's not been mentioned here already.)</p>
<p>Recipes almost always contain sequences: separate instructions that should be actioned one after another (e.g. “Peel the potatoes.  Then put then in the pan.”).  They sometimes contain alternation (e.g. “If you're using frozen greens, thaw them first.”)  And they sometimes contain iteration (e.g. “Repeat for all the remaining burgers.”)  So they're effectively Turing-complete!  And they sometimes contain concurrency (e.g. “While the onions are sweating, grate the cheese.”), so there're plenty of analogies that could be drawn in more advanced classes.</p>
<p>In fact, there's even an esoteric programming language called <a href="https://esolangs.org/wiki/Chef" rel="nofollow noreferrer">Chef</a>, which reads exactly like a recipe — to the point where a good program can be cooked by a human as well as run by a computer!</p>

CC BY-SA 4.0
2024-10-19T10:53:44.473Z
2024-10-19T10:53:44.473Z
gidds
<p>When I attended a Mind, Brain, and Learning conference a few years ago, a lecturer posed the following question (paraphrased):</p>
<blockquote>
<p>If I ask you to figure out the cube root of a number like 150 in your head, and ask Albert Einstein or Richard Feynman to do the same, they will probably come up with the answer faster than you do.  But who will be using more of their brain to do it?  You or the great physicists of the era?</p>
</blockquote>
<p>The answer, he went on to explain, was that <em>you</em> would be using more of your brain to do it.  He went on to explain that experts use surprisingly small numbers of neurons to accomplish tasks within their own field of expertise.  Experts have invested a great deal of time and calories into <em>streamlining</em> those systems, and making them extremely efficient.</p>
<p>Novices, by contrast, engage relatively vast swaths of their brains in order to accomplish tasks.</p>
<p>The streamlining that the experts have done is mastering abstractions.</p>
<p>To my way of thinking, your stated goal sounds very nice, but it doesn't really work.</p>
<p><em>(NOTE: What follows is my best understanding of what is going on in the brain when we learn abstractions.  For the actual best information possible, I strongly recommend the National Academy of Science's How People Learn II - it's a deeply excellent book that goes heavily into what we know about the process of learning.)</em></p>
<p>The problem is that we naturally move from concrete to abstract, which is done in three parts: (1) we learn about something, (2) we make the observation that &quot;<em>this</em> is kind of like <em>that</em>&quot;, (3) see how much simpler and better this is, and then potentially (4) we continue with the questions, &quot;what other things are like these things?  What are the common features in how they behave or function?&quot;</p>
<p>Within the brain, it is actually the same three part process: (1) understand the shape of a system, (2) use the common parts of two systems to create a streamlined version of their common, essential parts, (3) rewire the original two systems to utilize the common elements, and then possibly (4) connect that streamlined system to many other ideas.</p>
<p><strong>(Please note the order in which I created that abstraction for you in the previous two paragraphs, and consider whether it would have been somehow clearer if I reversed them.)</strong></p>
<p>The second and fourth phases are actually cyclical.  When we connect to a new system (phase 3), we frequently wind up revisiting the second phase as the new, connecting ideas provide insight into the abstraction that we didn't notice before.  This process naturally benefits all of the connected systems.</p>
<p>Also notice that the order remains <strong>concrete to abstract</strong> even at this late phase, when we already have a good, abstract construction.</p>
<p>When we do all this, we are building our abstraction, which can also be described as winnowing down a system to its essential features.  This process is insanely useful!  (More on that in a bit.)</p>
<p>We don't work from abstract to concrete naturally, <em>unless we already have good, firm ideas of the particular abstract systems being used</em>.</p>
<p>If you want to get a sense of how hard this is for humans, notice how we struggle to explain the process of quantum computing, which puts us all in a position of having to begin abstractly, and attempting to concretize from there.  It's so hard for precisely this reason.  Without concrete systems that behave like the quantum systems, it borders on impossibly difficult for us to build up useful abstractions in the first place.</p>
<h1>Why we frequently want to teach this way</h1>
<p>You're not at all alone in wishing to teach the abstractions from the outset.  (It is a bit of a perennial issue here on CSEducators, actually.)  Teachers <em>often</em> really want to begin from the abstraction.  It's instinctive!</p>
<p>After all, a firm abstraction is <em>absolutely wonderful</em>.  It is a little key that opens vast swaths of thought to the key holder.</p>
<p>The abstraction is also <em>much simpler than any of the derived systems</em>, which have little details that can be hard to understand without thoroughly understanding the abstraction that makes the whole system work in the first place.</p>
<p>Once you have the abstraction in place, all of those confusing little details hardly need to be remembered.  They can be quickly and trivially re-derived when we need them.</p>
<p>It makes sense that, almost as soon as we learn a good abstraction, we switch over to using it very heavily in our thinking.  It vastly simplifies and streamlines our thought process when faced with complex systems. Win-win!</p>
<p>It is natural to want to get your students to think this way as well.  After all, <strong>if they can see the bigger picture the way that you do</strong>, they will be able to take advantage of how <em>simple</em> it all is, just like you do.  Why not start there, show them the beautiful simplicity, and then show them how trivial it is to now understand a lot of wonderful things?</p>
<p>Hopefully you can see the answer: the students can't do it.  That mode of thinking is unlocked only by having at least one, and hopefully more, concrete, well-understood examples <em>first</em>, because those concrete examples are what permit us to comprehend the key secondary features.</p>
<p>Looking at it from a neural basis, the novice mind lacks the information that must be winnowed and simplified in order to create the streamlined pathways.</p>
<p>We teachers can absolutely help guide students along the path to these kinds of abstractions.  But the first step to make it manageable for a human brain is to make sure that brain has a few concrete examples to work off of.</p>
<h1>So, what can we do?</h1>
<p>So how can you help your students get to the abstract part?   You (1) journey through a topic concretely. You (2 and 3) regularly point out when something they're learning is similar to something they've already learned.  You regularly discuss the abstract elements that are coming up.</p>
<p>Start concrete, move slowly towards the abstract.</p>
<p>It feels positively glacial to work this way, but that's something of an illusion. We simply forget how long it took us to find, winnow down, and make our own beautiful abstractions. The slow pace is really just the time it takes to build the abstraction in the students mind.</p>

CC BY-SA 4.0
2021-08-25T23:58:10.620Z
Though if you want to look at a really prodigious mental calculator, I'd suggest John von Neumann. He looked to have the ability _innately_ like a savant as it was there ever since his youngest years; meaning it was genetic pot luck - lots of it, like winning the jackpot. For the rest of us without such luck to be able to "just know", then it has to be built up, as you suggest, like a building. But in this case, the question I believe could be asked as "can you 'build that building' _without a programming language_ specifically?" _not_ "can you skip building the building?"
The_Sympathizer
CC BY-SA 4.0
2021-08-25T23:59:23.783Z
(Note: just to get in before anyone objects to my characterization, yes JvN also had to go through much rigorous education and learning and stuff too, but it was all _atop_ that innate foundation. Which is what put him above all the rest, even others considered "geniuses" of his time. It's like everyone's building a building, but his was being built atop a mountain. Guess which one reaches higher, and/or who has to build more and who has to build less?)
The_Sympathizer
CC BY-SA 4.0
2021-08-26T18:50:15.943Z
@The_Sympathizer  TIT somehow JvN "won the genetic lottery" is dangerous and closeminded.  It's not even clear if humans compared to those that don't have cognitive disorders *can* be geniuses to other people in the sense that they are strictly more intelligent on the basis of genetics.  IQ tests basically never transfer to other groups of people, and even the idea of thinking about numbers linearly is not how humans naturally think about numbers.   What *does* appear to happen, is that all these "prodigies" are well exposed to ideas and practice in these fields well before anyone else does.
Krupip
CC BY-SA 4.0
2021-08-26T18:54:17.167Z
@The_Sympathizer Often, a child has a *slight* inclination for something and an adult sees it and is amazed, and feels they have a "genius" on their hand, then gives *that* child all the resources in the world to succeed in that thing.  JvN and co's "intelligence" is far more likely explained by the opportunity complex than anything else.  If you taught an 8 year old calculus, would you not expect to be better at calculus than other kids?  Assumptions otherwise are pedestal lifting, lionizing and hubris.  It's the same sort of thinking that lead people to believe in superior races of people.
Krupip
CC BY-SA 4.0
2021-08-27T00:24:19.833Z
@Krupip: Yes, but how do you know that he had only a "slight" natural inclination? And I'm not saying the other stuff doesn't matter - it's more _both,_ not one xor the other. And moreover, failure to provide such resources should be considered a crime of the state (i.e. like a human rights abuse), provided it has the power to do so.
The_Sympathizer
CC BY-SA 4.0
2021-08-27T05:02:49.257Z
@The_Sympathizer That's only viable in the post-scarcity world. My government absolutely can provide the resources to learn various fields for all underage citizens at the expense of infrastructure, healthcare, and military budget. Doesn't mean the government and voters are going to approve it.
Martheen
CC BY-SA 4.0
2021-08-27T18:52:25.960Z
@ben-i hi, I hope my question isn't directly off topic to OP's question. But based on your answer, I am wondering, is your answer one of the reasons why the SICP course (6.001) fell out of favor nowadays because the concepts in the book are too abstract for beginners? I am not a teacher BTW, I just came here because I am a little intrigued by your answer.
lightning_missile
CC BY-SA 4.0
2021-08-27T19:32:30.687Z
@lightning_missile I've never used SICP for beginners, only for 3rd year students.  Is that even a thing?  It seems inappropriate to me.  OTOH, some college and university classes try to winnow out students that aren't exceptional in their intro classes, so maybe that's a good technique to eliminate students who would need a lot of support.
Ben I.
CC BY-SA 4.0
2021-08-28T09:28:28.750Z
@The_Sympathizer beware the fixed mind set ( https://www.ted.com/talks/carol_dweck_the_power_of_believing_that_you_can_improve?language=en ) It will hold you and your students back. Another observation on nature vs nurture: I say a presentation that said that nearly all mental illness comes from environmental stress. This stress breaks us. However, genetic factors [and past history], effect **where** we will break.
ctrl-alt-delor
CC BY-SA 4.0
2021-08-28T12:58:02.183Z
“experts use surprisingly small numbers of neutrons to accomplish tasks”—That should be “neurons,” as the amount of “neutrons” involved in any macroscopic object is going to be simply staggering :P (Also, I’d be kind of surprised if Einstein or Feynman spent much, if any, time thinking about how to perform cube roots in their heads. Maybe Feynman, he seems quirky like that...)
KRyan
CC BY-SA 4.0
2021-08-28T13:51:31.823Z
@KRyan Haha good catch! I'm going to blame that on fat thumbs and autocorrect 
Ben I.
CC BY-SA 4.0
2021-08-25T12:55:50.477Z
2024-10-18T15:05:54.713Z
2024-10-18T15:05:54.713Z
Ben I.
<p>About 20 years ago, I interviewed at a rather well known American software company.  I met with about a dozen people over a day that lasted from 8:30 to 4:30.</p>
<p>One of the questions was to come up with an algorithmic solution to blindly traversing a space that looked like this, from one end to the other:</p>
<pre><code>+----+
|    |
|    |
|    +---------+
|              |
+---------+    |
          |    |
          |    |
          +----+
</code></pre>
<p>The solution it to take a step forward. If you bump into anything, rotate to the right (or to the left, just be consistent).  if you bump into something again, rotate 180 degrees.  If you don't bump into anything after any of these actions, take another step forward.  You'll eventually get to the end.</p>
<p>You could draw something like that on the board and let suggest possible solutions.  Then you could see if the algorithm works in other maze-like shapes.</p>
<p>I think coming up with simple exercises like this is a good way to stimulate algorithm thinking.</p>
<p>You could also do this in groups, drawing the outline on the floor with tape.  Initially, a guider guides the person, giving instructions to a blind-folded (or pretend blind-folded) walker.  Once the walker gets to the end, the group gets to figure out how the walker could do this algorithmically, without a guider.</p>
<p><strong>Update: Another <em>Tape-On-The-Floor</em> Example</strong></p>
<p>Tape off N cells in a row, each big enough for someone to stand in. Then tape off one more square not part of the array of cells. Label that last one <code>T</code> for temporary.</p>
<pre><code>+----+----+----+----+----+----+----+---'+
|    |    |    |    |    |    |    |    |
|    |    |    |    |    |    |    |    |
|    |    |    |    |    |    |    |    |
+----+----+----+----+----+----+----+---'+

      +----+
      |    |
      |  T |
      |    |
      +----+
</code></pre>
<p>Randomly select N students and put them in the cells of the array. Tell them that the goal is to sort them out by height. Give them a few rules.</p>
<ol>
<li>A cell (including the temporary one) can be empty or full</li>
<li>A student must always be in a cell (or be transitioning between cells)</li>
<li>Only one student can move at a time.</li>
</ol>
<p>See if they come up with a sorting algorithm. If not, coach them into coming up with a bubble sort. The temporary cell is to enable swapping (otherwise rule 3 is broken).</p>
<p>Note, you are also talking about variables and possibly memory.</p>
<p>Once they get sorted. Have them apply the same algorithm with a different comparator function and sort them out by first name.</p>
<p>Then, get random stuff from the classroom (a pen, a stapler, a sheet of paper, etc). Now they can apply the same algorithm to different types with a different comparator.</p>
<p>I'm trying to think of how to refactor out the swapping function.</p>

CC BY-SA 4.0
2021-08-26T00:57:41.167Z
2021-08-27T02:46:40.453Z
2021-08-27T02:46:40.453Z
Flydog57
<p>When I was about eight years old, my teacher asked the class to describe fool-proof ways to make a cup of tea, or to strike a match then use it to light something like a gas-flame or a cigarette.</p>
<p>How would that not meet your citeria?</p>

CC BY-SA 4.0
2021-08-25T21:57:54.433Z
For me it was drawing a smiley face on a whiteboard. Imo this is the correct answer. This really shows how the "programmer mindset" is.
Hello Goodbye
CC BY-SA 4.0
2021-08-26T04:29:19.303Z
For a concrete example of how such teaching might go, try the ["can you teach me to make a PB&J sandwich?"](https://www.youtube.com/watch?v=Ct-lOOUqmyY) video.
Daniel Wagner
CC BY-SA 4.0
2021-08-26T16:54:20.587Z
Tnx @Danielwagner that was worth an answer!
Rushi
CC BY-SA 4.0
2021-08-28T09:30:44.150Z
Yes, I remember the days. You could not see the black-board for all the smoke.
ctrl-alt-delor
CC BY-SA 4.0
2021-08-25T20:30:33.850Z
2021-08-25T20:30:33.850Z
Robbie Goodwin
<p>My go-to answer for this question would be <a href="https://csunplugged.org/en/" rel="nofollow noreferrer">CS Unplugged</a>, an open-source &quot;collection of free learning activities that teach Computer Science through engaging games and puzzles that use cards, string, crayons and lots of running around&quot;. It has been around and maintained for at least 18 years now... and even if it may be a bit low-level for high school students, I expect that you can at least find inspiration there.</p>

CC BY-SA 4.0
2021-08-27T10:03:05.500Z
2021-08-27T10:03:05.500Z
orithena
<p>The &quot;Introduction to Algorithms&quot; text by Cormen, Leiserson, Rivest, and Stein uses pseudocode (so, not any particular programming language), but assumes an introductory programming course as a prerequisite.</p>
<p>If you want students to develop algorithmic thinking skills as part of an introductory programming course, consider the textbook &quot;Introduction to Computation and Programming using Python&quot; by John Guttag.  Many interesting problems are discussed there, including bisection search, Newton-Raphson, and sorting and searching algorithms.  Most introductory programming texts place too much emphasis on syntax, whereas this book by Guttag introduces a minimal amount of Python syntax and focuses on computational and algorithmic thinking.</p>

CC BY-SA 4.0
2023-01-18T07:22:52.030Z
2023-01-18T07:22:52.030Z
Ashwin Ganesan
<blockquote>
<p>But I would like to teach algorithmic thinking per se, independent of the underlying programming language.</p>
</blockquote>
<p>The current classic book is</p>
<p>&quot;Introduction to Algorithms&quot; Third Edition by Thomas H. Cormen (<a href="http://www.worldcat.org/oclc/1120499607" rel="nofollow noreferrer">WorldCat</a>)</p>
<p>It is a collage level book but then again so are computer algorithms.</p>

CC BY-SA 4.0
2021-08-25T19:24:25.040Z
The OP asked for something other than "books that teach how to do algorithms in language X or Y". CLRS is a book that teaches how to do algorithms in pseudocode. How is this not a "book that teaches how to do algorithms in language X or Y"? Except the added disadvantage that you can't even run the code in the book to see how it works.
Jörg W Mittag
CC BY-SA 4.0
2021-08-25T19:44:29.950Z
@JörgWMittag Please read the question again, carefully. The OP states `Do you know any book or Internet resource for that?`
Guy Coder
CC BY-SA 4.0
2021-08-26T09:09:11.180Z
The point is when u teach using pseudo code, u concentrate on the ideas irrelevant of the Programming language the students learn/use that could vary through the years. What usually happens when I used to teach is the TA in the lab (there r secs&labs associated with the course) might help the students in the their assignments of turning pseudo code to program. The language differs thru the years (or faculties)Pascal,C,C++,Java. However, now Python is much easier since it's Algorithmic in nature; both MIT & Tim Roughgarden use it in their Algorithms & Data Structures courses
ShAr
CC BY-SA 4.0
2021-08-26T09:16:40.677Z
Let me add that, the idea that I give u the grade on this course according to ur understanding of the concepts choosing the right algorithm technique or data structure to approach the problem irrelevant of ur practice or excellence in programming skills as a developer, that's the responsibility of other courses. If I am a company to hire u according to ur grades either in a developer or a designer job I should know which evaluates which, although they're connected.
ShAr
CC BY-SA 4.0
2021-08-26T17:32:19.370Z
@ShAr  can you give me an example of a programming language that *isn't* "algorithmic in nature"?  I'm not even sure what it means.
Bloke Down The Pub
CC BY-SA 4.0
2021-08-26T19:54:35.523Z
@BlokeDownThePub: Prolog (it's pretty purely declarative), AWK, the combination of Lex and YACC.  Not every problem is best described/solved by a user-written algorithm.
Flydog57
CC BY-SA 4.0
2021-08-29T22:48:30.410Z
@ShAr, if you go the pseudocode path, you must state what is --and isn't-- valid pseudocode, so you don't get "algorithms" that read "solve the problem". Surprise: You just invented a specific programming language, with all the irking quirks. With the *heavy* disadvantage that you can't check/execute/test the programs at all.
vonbrand
CC BY-SA 4.0
2021-08-29T22:51:42.133Z
@BlokeDownThePub, Prolog is "declarative" in that you don't state the execution order; but if you aren't acutely aware how the backtracking search works, you get nowhere. Worst of both worlds.
vonbrand
CC BY-SA 4.0
2021-08-30T06:26:48.223Z
Not really, you just have to make it clear & understandable, and discribe the complexity of each step/statement; it is called "Pseudo". Anyways this whole debate is endless; if the question asker care about Algorithmic Thinking from a Mathematical point of view I added another book link in one of those comments, although high school book it's what he's asking and can give the intuition about the methodology. https://www.amazon.com/Teaching-Learning-Algorithms-School-Mathematics/dp/0873534409
ShAr
CC BY-SA 4.0
2021-08-25T12:20:08.303Z
2021-08-25T12:20:08.303Z
Guy Coder
<p>I preferred to wrap up what in the comments &amp; what is new here</p>
<p>This course is usually called <em><strong>Algorithms Design &amp; Analysis</strong></em>, I haven't taught say in 10 yrs but those are classics:</p>
<p>-The famous K-nuth  <em>The art of Computer Programming</em> vols 2,3</p>
<p>-Sartaj Sahni book, I can't remember the name now, but it exactly explains the point; it starts with an outline of the main techniques <em>hill climbing, dynamic Programming, Divide-and-Conquer,...</em></p>
<p>-<em>The Hardest Problems</em> by Sara Baase, but I don't recall now if this is under-graduate or post-graduate
(sorry the book name is <em>Computer Algorithms: Introduction to Analysis &amp; Design</em>, it is  just that chapter about P, NP, NPC,... we copied when were students 30yrs ago and is just became like built in my mind)</p>
<p>-The grey book with navy blue tree leaves on it, probably by Ullman Hopcroft; sorry I can't remember the exact title.</p>
<p>»»» In all cases programming languages differ in nature; I mean sure you can realize there's some differences between C++, Java, Python,...</p>
<p>We do not want the student to mix the properties of the language ( for example what's easy &amp; hard in it), the difficulty of coding with the abstract complexity of the Algorithm you are using.</p>
<p>That's like a basic concept when you teach algorithm to explain the difference between the complexity of different algorithms Vs the running time of different implementations of the same algorithm</p>
<p>I also found this book, although for high school, it might give an intuition of what you are asking about, or was it your original starting point???
<a href="https://rads.stackoverflow.com/amzn/click/com/0873534409" rel="nofollow noreferrer" rel="nofollow noreferrer">https://www.amazon.com/Teaching-Learning-Algorithms-School-Mathematics/dp/0873534409</a>
<a href="https://eric.ed.gov/?id=ED419669" rel="nofollow noreferrer">https://eric.ed.gov/?id=ED419669</a></p>

CC BY-SA 4.0
2021-08-26T20:37:03.650Z
2021-08-30T06:49:04.150Z
2021-08-30T06:49:04.150Z
ShAr
<p>My go-to source for algorithmic thinking is <a href="https://rads.stackoverflow.com/amzn/click/com/038790641X" rel="nofollow noreferrer" rel="nofollow noreferrer">The Science of Programming</a> by David Gries (one of my mentors in CS). Algorithms are expressed in an abstract language that was also used (and made popular for exposition) in the papers of Dijkstra.</p>
<p>The basis of the algorithmic thinking was to examine preconditions and postconditions for a problem and to work from either end toward a solution. The technique is useful, also, in establishing the theoretical efficiency of an algorithm.</p>
<p>Unfortunately, the book is hard to come by, and expensive if you can find it.</p>

CC BY-SA 4.0
2021-08-26T15:26:33.330Z
2021-08-26T15:26:33.330Z
Buffy
<p>Another non-computer related example that I've seen used is that of <strong>a knitting pattern</strong>.</p>
<p>A garment with a specific pattern or structure needs an exact sequence of stitches and other operations; a knitting pattern is an algorithm which describes those in full detail, so that anyone following it can create a near-identical garment (subject to variations in the yarn, gauge/tension, etc.).</p>
<p>Within a pattern, the symbols used have precise meanings, and so the analogy with a programming language is fairly close.  Different patterns may use different symbols (like different programming languages).  Many use iteration, instead of repeating long sequences many times — though I'm not sure if any use alternation, so I don't know if any would be considered Turing-complete.  And while many patterns use only a single yarn at a time, some keep two or more in play, so knitting patterns can be either single-threaded or multi-threaded!  (Sorry.)</p>
<p>And again, there's an esoteric computer language called <a href="https://esolangs.org/wiki/Purl" rel="nofollow noreferrer">Purl</a> in which programs look like, and may be interpreted as, knitting patterns!  (Though that site says the results may be rather awkward…)</p>

CC BY-SA 4.0
2024-10-20T16:13:53.603Z
2024-10-20T16:13:53.603Z
gidds
<p>check this <a href="https://youtu.be/8hly31xKli0" rel="nofollow noreferrer">https://youtu.be/8hly31xKli0</a>
Algorithms and Data Structures - Full Course for Beginners from Treehouse</p>
<p>freeCodeCamp.org</p>

CC BY-SA 4.0
2021-08-25T09:37:13.447Z
2021-08-25T09:37:13.447Z
aqdesk
<p>I am to teach Algorithms and Data Structures. There are lots of books that teach how to do algorithms in language X or Y. But I would like to teach algorithmic thinking per se, independent of the underlying programming language.</p>
<p>Do you know any book or Internet resource for that? Especially that contains problems and exercises in the style of high school mathematics problems.</p>

CC BY-SA 4.0
2021-08-26T07:03:08.257Z
This is like wanting to train swimming, but without a body of water. Habitually applying algorithmic thinking in non-programming domains or situations comes from having efficiently honed it via programming, not *vice versa*.
Kaz
CC BY-SA 4.0
2021-08-26T17:37:15.950Z
You could use English, but you'd end up structuring & formalising it to the point that it was basically pseudocode, which is arguably a programming language since you can program carbon units with it. So I'm not sure what you're asking is even possible.
Bloke Down The Pub
CC BY-SA 4.0
2021-08-26T23:19:28.833Z
@Kaz That's just silly, go tell the ancient greeks that. https://en.wikipedia.org/wiki/Timeline_of_algorithms
TCooper
CC BY-SA 4.0
2021-08-26T23:48:48.117Z
Pencil-and-paper arithmetic uses algorithms, such as long division. Students who can perform long division already have an algorithmic concept. Symbolic games and puzzles include algorithmic concepts. These things all have one thing in common: they provide some representation of the data structure, but the manipulations of it to search through the possible space are left to the human.
Kaz
CC BY-SA 4.0
2021-08-27T14:45:29.030Z
What do you mean? Could you give an example of "algorithmic thinking per se" without programming language? Or perhaps you mean "without being concerned with the minute details of a particular programming language"? I think any precise description of an algorithm is a programming language. Do you want to be even independent of paradigm (imperative, functional, logical)?
Pablo H
CC BY-SA 4.0
2021-08-27T18:24:04.243Z
_now if we could just sort all the answers by length ..._
ti7
CC BY-SA 4.0
2021-08-28T18:41:22.807Z
you don't have to use a programming language to understand the difference between linear search & binary search, bubble sort/ insertion sort/quicksort/merge sort/... etc; Probabilistic Algorithms worked fine with Pseudo code for post-graduates. Most available lectures for MIT, Stanford,...etc do not go into programming details in Algorithms & Data structures courses, we only do that sometimes or make lab stress on it because it's a chance for students to practice programming skills as well
ShAr
CC BY-SA 4.0
2021-08-29T12:58:24.323Z
If you want high school Mathematics style, there is this book *The Teaching & Learning of Algorithms in School Mathematics. 1998 Yearbook* 
 https://eric.ed.gov/?id=ED419669. I just bought it out of curiosity or maybe as intellectual exercise
ShAr
<algorithms><computational-thinking>
Teaching algorithmic thinking without a programming language
# Teaching algorithmic thinking without a programming language

(Asked by: username_0 on 2021-08-25)

I am to teach Algorithms and Data Structures. There are lots of books that teach how to do algorithms in language X or Y. But I would like to teach algorithmic thinking per se, independent of the underlying programming language.

Do you know any book or Internet resource for that? Especially that contains problems and exercises in the style of high school mathematics problems.

**Tags:** algorithms, computational-thinking

> **Comments:**
> **username_1**: This is like wanting to train swimming, but without a body of water. Habitually applying algorithmic thinking in non-programming domains or situations comes from having efficiently honed it via programming, not *vice versa*.  
> **username_2**: You could use English, but you'd end up structuring & formalising it to the point that it was basically pseudocode, which is arguably a programming language since you can program carbon units with it. So I'm not sure what you're asking is even possible.  
> **username_3**: @username_1 That's just silly, go tell the ancient greeks that. https://en.wikipedia.org/wiki/Timeline_of_algorithms  
> **username_1**: Pencil-and-paper arithmetic uses algorithms, such as long division. Students who can perform long division already have an algorithmic concept. Symbolic games and puzzles include algorithmic concepts. These things all have one thing in common: they provide some representation of the data structure, but the manipulations of it to search through the possible space are left to the human.  
> **username_4**: What do you mean? Could you give an example of "algorithmic thinking per se" without programming language? Or perhaps you mean "without being concerned with the minute details of a particular programming language"? I think any precise description of an algorithm is a programming language. Do you want to be even independent of paradigm (imperative, functional, logical)?  
> **username_5**: _now if we could just sort all the answers by length ..._  
> **username_6**: you don't have to use a programming language to understand the difference between linear search & binary search, bubble sort/ insertion sort/quicksort/merge sort/... etc; Probabilistic Algorithms worked fine with Pseudo code for post-graduates. Most available lectures for MIT, Stanford,...etc do not go into programming details in Algorithms & Data structures courses, we only do that sometimes or make lab stress on it because it's a chance for students to practice programming skills as well  
> **username_6**: If you want high school Mathematics style, there is this book *The Teaching & Learning of Algorithms in School Mathematics. 1998 Yearbook*   https://eric.ed.gov/?id=ED419669. I just bought it out of curiosity or maybe as intellectual exercise  

---

## 11 answers

### Answer by username_8 on 2021-08-25. Score: 34 | Accepted answer

When I attended a Mind, Brain, and Learning conference a few years ago, a lecturer posed the following question (paraphrased):

> If I ask you to figure out the cube root of a number like 150 in your head, and ask Albert Einstein or Richard Feynman to do the same, they will probably come up with the answer faster than you do. But who will be using more of their brain to do it? You or the great physicists of the era?

The answer, he went on to explain, was that *you* would be using more of your brain to do it. He went on to explain that experts use surprisingly small numbers of neurons to accomplish tasks within their own field of expertise. Experts have invested a great deal of time and calories into *streamlining* those systems, and making them extremely efficient.

Novices, by contrast, engage relatively vast swaths of their brains in order to accomplish tasks.

The streamlining that the experts have done is mastering abstractions.

To my way of thinking, your stated goal sounds very nice, but it doesn't really work.

*(NOTE: What follows is my best understanding of what is going on in the brain when we learn abstractions. For the actual best information possible, I strongly recommend the National Academy of Science's How People Learn II - it's a deeply excellent book that goes heavily into what we know about the process of learning.)*

The problem is that we naturally move from concrete to abstract, which is done in three parts: (1) we learn about something, (2) we make the observation that "*this* is kind of like *that*", (3) see how much simpler and better this is, and then potentially (4) we continue with the questions, "what other things are like these things? What are the common features in how they behave or function?"

Within the brain, it is actually the same three part process: (1) understand the shape of a system, (2) use the common parts of two systems to create a streamlined version of their common, essential parts, (3) rewire the original two systems to utilize the common elements, and then possibly (4) connect that streamlined system to many other ideas.

**(Please note the order in which I created that abstraction for you in the previous two paragraphs, and consider whether it would have been somehow clearer if I reversed them.)**

The second and fourth phases are actually cyclical. When we connect to a new system (phase 3), we frequently wind up revisiting the second phase as the new, connecting ideas provide insight into the abstraction that we didn't notice before. This process naturally benefits all of the connected systems.

Also notice that the order remains **concrete to abstract** even at this late phase, when we already have a good, abstract construction.

When we do all this, we are building our abstraction, which can also be described as winnowing down a system to its essential features. This process is insanely useful! (More on that in a bit.)

We don't work from abstract to concrete naturally, *unless we already have good, firm ideas of the particular abstract systems being used*.

If you want to get a sense of how hard this is for humans, notice how we struggle to explain the process of quantum computing, which puts us all in a position of having to begin abstractly, and attempting to concretize from there. It's so hard for precisely this reason. Without concrete systems that behave like the quantum systems, it borders on impossibly difficult for us to build up useful abstractions in the first place.

# Why we frequently want to teach this way

You're not at all alone in wishing to teach the abstractions from the outset. (It is a bit of a perennial issue here on CSEducators, actually.) Teachers *often* really want to begin from the abstraction. It's instinctive!

After all, a firm abstraction is *absolutely wonderful*. It is a little key that opens vast swaths of thought to the key holder.

The abstraction is also *much simpler than any of the derived systems*, which have little details that can be hard to understand without thoroughly understanding the abstraction that makes the whole system work in the first place.

Once you have the abstraction in place, all of those confusing little details hardly need to be remembered. They can be quickly and trivially re-derived when we need them.

It makes sense that, almost as soon as we learn a good abstraction, we switch over to using it very heavily in our thinking. It vastly simplifies and streamlines our thought process when faced with complex systems. Win-win!

It is natural to want to get your students to think this way as well. After all, **if they can see the bigger picture the way that you do**, they will be able to take advantage of how *simple* it all is, just like you do. Why not start there, show them the beautiful simplicity, and then show them how trivial it is to now understand a lot of wonderful things?

Hopefully you can see the answer: the students can't do it. That mode of thinking is unlocked only by having at least one, and hopefully more, concrete, well-understood examples *first*, because those concrete examples are what permit us to comprehend the key secondary features.

Looking at it from a neural basis, the novice mind lacks the information that must be winnowed and simplified in order to create the streamlined pathways.

We teachers can absolutely help guide students along the path to these kinds of abstractions. But the first step to make it manageable for a human brain is to make sure that brain has a few concrete examples to work off of.

# So, what can we do?

So how can you help your students get to the abstract part? You (1) journey through a topic concretely. You (2 and 3) regularly point out when something they're learning is similar to something they've already learned. You regularly discuss the abstract elements that are coming up.

Start concrete, move slowly towards the abstract.

It feels positively glacial to work this way, but that's something of an illusion. We simply forget how long it took us to find, winnow down, and make our own beautiful abstractions. The slow pace is really just the time it takes to build the abstraction in the students mind.

> **Comments:**
> **username_9**: Though if you want to look at a really prodigious mental calculator, I'd suggest John von Neumann. He looked to have the ability _innately_ like a savant as it was there ever since his youngest years; meaning it was genetic pot luck - lots of it, like winning the jackpot. For the rest of us without such luck to be able to "just know", then it has to be built up, as you suggest, like a building. But in this case, the question I believe could be asked as "can you 'build that building' _without a programming language_ specifically?" _not_ "can you skip building the building?"  
> **username_9**: (Note: just to get in before anyone objects to my characterization, yes JvN also had to go through much rigorous education and learning and stuff too, but it was all _atop_ that innate foundation. Which is what put him above all the rest, even others considered "geniuses" of his time. It's like everyone's building a building, but his was being built atop a mountain. Guess which one reaches higher, and/or who has to build more and who has to build less?)  
> **username_10**: @username_9  TIT somehow JvN "won the genetic lottery" is dangerous and closeminded.  It's not even clear if humans compared to those that don't have cognitive disorders *can* be geniuses to other people in the sense that they are strictly more intelligent on the basis of genetics.  IQ tests basically never transfer to other groups of people, and even the idea of thinking about numbers linearly is not how humans naturally think about numbers.   What *does* appear to happen, is that all these "prodigies" are well exposed to ideas and practice in these fields well before anyone else does.  
> **username_10**: @username_9 Often, a child has a *slight* inclination for something and an adult sees it and is amazed, and feels they have a "genius" on their hand, then gives *that* child all the resources in the world to succeed in that thing.  JvN and co's "intelligence" is far more likely explained by the opportunity complex than anything else.  If you taught an 8 year old calculus, would you not expect to be better at calculus than other kids?  Assumptions otherwise are pedestal lifting, lionizing and hubris.  It's the same sort of thinking that lead people to believe in superior races of people.  
> **username_9**: @username_10: Yes, but how do you know that he had only a "slight" natural inclination? And I'm not saying the other stuff doesn't matter - it's more _both,_ not one xor the other. And moreover, failure to provide such resources should be considered a crime of the state (i.e. like a human rights abuse), provided it has the power to do so.  
> **username_11**: @username_9 That's only viable in the post-scarcity world. My government absolutely can provide the resources to learn various fields for all underage citizens at the expense of infrastructure, healthcare, and military budget. Doesn't mean the government and voters are going to approve it.  
> **username_12**: @ben-i hi, I hope my question isn't directly off topic to OP's question. But based on your answer, I am wondering, is your answer one of the reasons why the SICP course (6.001) fell out of favor nowadays because the concepts in the book are too abstract for beginners? I am not a teacher BTW, I just came here because I am a little intrigued by your answer.  
> **username_8**: @username_12 I've never used SICP for beginners, only for 3rd year students.  Is that even a thing?  It seems inappropriate to me.  OTOH, some college and university classes try to winnow out students that aren't exceptional in their intro classes, so maybe that's a good technique to eliminate students who would need a lot of support.  
> **username_13**: @username_9 beware the fixed mind set ( https://www.ted.com/talks/carol_dweck_the_power_of_believing_that_you_can_improve?language=en ) It will hold you and your students back. Another observation on nature vs nurture: I say a presentation that said that nearly all mental illness comes from environmental stress. This stress breaks us. However, genetic factors [and past history], effect **where** we will break.  
> **username_14**: “experts use surprisingly small numbers of neutrons to accomplish tasks”—That should be “neurons,” as the amount of “neutrons” involved in any macroscopic object is going to be simply staggering :P (Also, I’d be kind of surprised if Einstein or Feynman spent much, if any, time thinking about how to perform cube roots in their heads. Maybe Feynman, he seems quirky like that...)  
> **username_8**: @username_14 Haha good catch! I'm going to blame that on fat thumbs and autocorrect   

---

### Answer by username_15 on 2021-08-26. Score: 9

About 20 years ago, I interviewed at a rather well known American software company.  I met with about a dozen people over a day that lasted from 8:30 to 4:30.
One of the questions was to come up with an algorithmic solution to blindly traversing a space that looked like this, from one end to the other:
+----+
|    |
|    |
|    +---------+
|              |
+---------+    |
          |    |
          |    |
          +----+

The solution it to take a step forward. If you bump into anything, rotate to the right (or to the left, just be consistent).  if you bump into something again, rotate 180 degrees.  If you don't bump into anything after any of these actions, take another step forward.  You'll eventually get to the end.
You could draw something like that on the board and let suggest possible solutions.  Then you could see if the algorithm works in other maze-like shapes.
I think coming up with simple exercises like this is a good way to stimulate algorithm thinking.
You could also do this in groups, drawing the outline on the floor with tape.  Initially, a guider guides the person, giving instructions to a blind-folded (or pretend blind-folded) walker.  Once the walker gets to the end, the group gets to figure out how the walker could do this algorithmically, without a guider.
Update: Another Tape-On-The-Floor Example
Tape off N cells in a row, each big enough for someone to stand in. Then tape off one more square not part of the array of cells. Label that last one T for temporary.
+----+----+----+----+----+----+----+---'+
|    |    |    |    |    |    |    |    |
|    |    |    |    |    |    |    |    |
|    |    |    |    |    |    |    |    |
+----+----+----+----+----+----+----+---'+

      +----+
      |    |
      |  T |
      |    |
      +----+

Randomly select N students and put them in the cells of the array. Tell them that the goal is to sort them out by height. Give them a few rules.

A cell (including the temporary one) can be empty or full
A student must always be in a cell (or be transitioning between cells)
Only one student can move at a time.

See if they come up with a sorting algorithm. If not, coach them into coming up with a bubble sort. The temporary cell is to enable swapping (otherwise rule 3 is broken).
Note, you are also talking about variables and possibly memory.
Once they get sorted. Have them apply the same algorithm with a different comparator function and sort them out by first name.
Then, get random stuff from the classroom (a pen, a stapler, a sheet of paper, etc). Now they can apply the same algorithm to different types with a different comparator.
I'm trying to think of how to refactor out the swapping function.


---

### Answer by username_16 on 2021-08-25. Score: 9

When I was about eight years old, my teacher asked the class to describe fool-proof ways to make a cup of tea, or to strike a match then use it to light something like a gas-flame or a cigarette.

How would that not meet your citeria?

> **Comments:**
> **username_17**: For me it was drawing a smiley face on a whiteboard. Imo this is the correct answer. This really shows how the "programmer mindset" is.  
> **username_18**: For a concrete example of how such teaching might go, try the ["can you teach me to make a PB&J sandwich?"](https://www.youtube.com/watch?v=Ct-lOOUqmyY) video.  
> **username_19**: Tnx @Danielwagner that was worth an answer!  
> **username_13**: Yes, I remember the days. You could not see the black-board for all the smoke.  

---

### Answer by username_20 on 2021-08-27. Score: 4

My go-to answer for this question would be [CS Unplugged](https://csunplugged.org/en/), an open-source "collection of free learning activities that teach Computer Science through engaging games and puzzles that use cards, string, crayons and lots of running around". It has been around and maintained for at least 18 years now... and even if it may be a bit low-level for high school students, I expect that you can at least find inspiration there.


---

### Answer by username_22 on 2021-08-25. Score: 4

> But I would like to teach algorithmic thinking per se, independent of the underlying programming language.

The current classic book is

"Introduction to Algorithms" Third Edition by Thomas H. Cormen ([WorldCat](http://www.worldcat.org/oclc/1120499607))

It is a collage level book but then again so are computer algorithms.

> **Comments:**
> **username_23**: The OP asked for something other than "books that teach how to do algorithms in language X or Y". CLRS is a book that teaches how to do algorithms in pseudocode. How is this not a "book that teaches how to do algorithms in language X or Y"? Except the added disadvantage that you can't even run the code in the book to see how it works.  
> **username_22**: @JörgWMittag Please read the question again, carefully. The OP states `Do you know any book or Internet resource for that?`  
> **username_6**: The point is when u teach using pseudo code, u concentrate on the ideas irrelevant of the Programming language the students learn/use that could vary through the years. What usually happens when I used to teach is the TA in the lab (there r secs&labs associated with the course) might help the students in the their assignments of turning pseudo code to program. The language differs thru the years (or faculties)Pascal,C,C++,Java. However, now Python is much easier since it's Algorithmic in nature; both MIT & Tim Roughgarden use it in their Algorithms & Data Structures courses  
> **username_6**: Let me add that, the idea that I give u the grade on this course according to ur understanding of the concepts choosing the right algorithm technique or data structure to approach the problem irrelevant of ur practice or excellence in programming skills as a developer, that's the responsibility of other courses. If I am a company to hire u according to ur grades either in a developer or a designer job I should know which evaluates which, although they're connected.  
> **username_2**: @username_6  can you give me an example of a programming language that *isn't* "algorithmic in nature"?  I'm not even sure what it means.  
> **username_15**: @BlokeDownThePub: Prolog (it's pretty purely declarative), AWK, the combination of Lex and YACC.  Not every problem is best described/solved by a user-written algorithm.  
> **username_24**: @username_6, if you go the pseudocode path, you must state what is --and isn't-- valid pseudocode, so you don't get "algorithms" that read "solve the problem". Surprise: You just invented a specific programming language, with all the irking quirks. With the *heavy* disadvantage that you can't check/execute/test the programs at all.  
> **username_24**: @BlokeDownThePub, Prolog is "declarative" in that you don't state the execution order; but if you aren't acutely aware how the backtracking search works, you get nowhere. Worst of both worlds.  
> **username_6**: Not really, you just have to make it clear & understandable, and discribe the complexity of each step/statement; it is called "Pseudo". Anyways this whole debate is endless; if the question asker care about Algorithmic Thinking from a Mathematical point of view I added another book link in one of those comments, although high school book it's what he's asking and can give the intuition about the methodology. https://www.amazon.com/Teaching-Learning-Algorithms-School-Mathematics/dp/0873534409  

---

### Answer by username_21 on 2023-01-18. Score: 3

The "Introduction to Algorithms" text by Cormen, Leiserson, Rivest, and Stein uses pseudocode (so, not any particular programming language), but assumes an introductory programming course as a prerequisite.

If you want students to develop algorithmic thinking skills as part of an introductory programming course, consider the textbook "Introduction to Computation and Programming using Python" by John Guttag. Many interesting problems are discussed there, including bisection search, Newton-Raphson, and sorting and searching algorithms. Most introductory programming texts place too much emphasis on syntax, whereas this book by Guttag introduces a minimal amount of Python syntax and focuses on computational and algorithmic thinking.


---

### Answer by username_6 on 2021-08-26. Score: 2

I preferred to wrap up what in the comments & what is new here

This course is usually called ***Algorithms Design & Analysis***, I haven't taught say in 10 yrs but those are classics:

-The famous K-nuth *The art of Computer Programming* vols 2,3

-Sartaj Sahni book, I can't remember the name now, but it exactly explains the point; it starts with an outline of the main techniques *hill climbing, dynamic Programming, Divide-and-Conquer,...*

-*The Hardest Problems* by Sara Baase, but I don't recall now if this is under-graduate or post-graduate
(sorry the book name is *Computer Algorithms: Introduction to Analysis & Design*, it is just that chapter about P, NP, NPC,... we copied when were students 30yrs ago and is just became like built in my mind)

-The grey book with navy blue tree leaves on it, probably by Ullman Hopcroft; sorry I can't remember the exact title.

»»» In all cases programming languages differ in nature; I mean sure you can realize there's some differences between C++, Java, Python,...

We do not want the student to mix the properties of the language ( for example what's easy & hard in it), the difficulty of coding with the abstract complexity of the Algorithm you are using.

That's like a basic concept when you teach algorithm to explain the difference between the complexity of different algorithms Vs the running time of different implementations of the same algorithm

I also found this book, although for high school, it might give an intuition of what you are asking about, or was it your original starting point???
[https://www.amazon.com/Teaching-Learning-Algorithms-School-Mathematics/dp/0873534409](https://rads.stackoverflow.com/amzn/click/com/0873534409)
<https://eric.ed.gov/?id=ED419669>


---

### Answer by username_25 on 2021-08-26. Score: 2

My go-to source for algorithmic thinking is [The Science of Programming](https://rads.stackoverflow.com/amzn/click/com/038790641X) by David Gries (one of my mentors in CS). Algorithms are expressed in an abstract language that was also used (and made popular for exposition) in the papers of Dijkstra.

The basis of the algorithmic thinking was to examine preconditions and postconditions for a problem and to work from either end toward a solution. The technique is useful, also, in establishing the theoretical efficiency of an algorithm.

Unfortunately, the book is hard to come by, and expensive if you can find it.


---

### Answer by username_7 on 2024-10-20. Score: 2

Another non-computer related example that I've seen used is that of **a knitting pattern**.

A garment with a specific pattern or structure needs an exact sequence of stitches and other operations; a knitting pattern is an algorithm which describes those in full detail, so that anyone following it can create a near-identical garment (subject to variations in the yarn, gauge/tension, etc.).

Within a pattern, the symbols used have precise meanings, and so the analogy with a programming language is fairly close.  Different patterns may use different symbols (like different programming languages).  Many use iteration, instead of repeating long sequences many times — though I'm not sure if any use alternation, so I don't know if any would be considered Turing-complete.  And while many patterns use only a single yarn at a time, some keep two or more in play, so knitting patterns can be either single-threaded or multi-threaded!  (Sorry.)

And again, there's an esoteric computer language called [Purl](https://esolangs.org/wiki/Purl) in which programs look like, and may be interpreted as, knitting patterns!  (Though that site says the results may be rather awkward…)


---

### Answer by username_26 on 2021-08-25. Score: 2

check this <https://youtu.be/8hly31xKli0>
Algorithms and Data Structures - Full Course for Beginners from Treehouse

freeCodeCamp.org


---

### Answer by username_7 on 2024-10-19. Score: 1

One non-computer-related example of an algorithm that just about everyone will have hard of, and most will have used, is **a cooking recipe**.

A recipe book is nothing less than a collection of algorithms that, when ‘run’, create certain dishes.  Each recipe contains an initial state (the ingredients and equipment), and an algorithm to be executed to reach the intended final state (a dish ready to eat).  Ideally, anyone can follow the recipe to create the dish.

Of course, recipes are nowhere near as strictly-defined as programming languages; the variable nature of the ingredients, available tools, skill and experience of the cook, and desired result all vary considerably.  And the cook is expected to interpret the recipe accordingly.  (Which is of course something you can discuss with students as needed.)

But as an introduction to the *idea* of an algorithm — a set of instructions to follow — it should be intuitively obvious to someone of almost any age.  (I've seen it used before, so I'm surprised it's not been mentioned here already.)

Recipes almost always contain sequences: separate instructions that should be actioned one after another (e.g. “Peel the potatoes.  Then put then in the pan.”).  They sometimes contain alternation (e.g. “If you're using frozen greens, thaw them first.”)  And they sometimes contain iteration (e.g. “Repeat for all the remaining burgers.”)  So they're effectively Turing-complete!  And they sometimes contain concurrency (e.g. “While the onions are sweating, grate the cheese.”), so there're plenty of analogies that could be drawn in more advanced classes.

In fact, there's even an esoteric programming language called [Chef](https://esolangs.org/wiki/Chef), which reads exactly like a recipe — to the point where a good program can be cooked by a human as well as run by a computer!


---

