34:28

Fall Asleep While Learning About Algorithms

by Benjamin Boster

Rated
4.9
Type
talks
Activity
Meditation
Suitable for
Everyone
Plays
2.4k

In this episode of the I Can't Sleep Podcast, fall asleep while learning about algorithms. I get pretty excited about narrowing down problems to their basic parts and finding the fundamental problem. Learning more about algorithms was a delight for me. I hope it has the opposite effect on you. Happy sleeping!

SleepHistoryAlgorithmsHistorical ContextAlgorithm ExplanationAlgorithm ClassificationAlgorithm Design ParadigmAlgorithm AnalysisAlgorithm HistoryInformation

Transcript

Welcome back or welcome to the I Can't Sleep podcast where I read random articles from across the web to bore you to sleep with my soothing voice.

I'm your host Benjamin Boster.

Today's episode is from a Wikipedia article titled Algorithm.

In mathematics and computer science an algorithm is a finite sequence of mathematically rigorous instructions typically used to solve a class of specific problems or to perform a computation.

Algorithms are used as specifications for performing calculations and data processing.

More advanced algorithms can use conditionals to divert the code execution through various routes referred to as automated decision-making and deduce valid inferences referred to as automated reasoning,

Achieving automation eventually.

Using human characteristics as descriptors of machines and metaphorical ways was already practiced by Alan Turing with terms such as memory,

Search,

And stimulus.

In contrast a heuristic is an approach to problem-solving that may not be fully specified or may not guarantee correct or optimal results,

Especially in problem domains where there is no well-defined correct or optimal result.

For example social media recommender systems rely on heuristics in such a way that although widely characterized as algorithms in 21st century popular media cannot deliver correct results due to the nature of the problem.

As an effective method an algorithm can be expressed within a finite amount of space and time and in a well-defined formal language for calculating a function.

Starting from an initial state,

An initial input,

Perhaps empty,

The instructions describe a computation that when executed proceeds through a finite number of well-defined successive states eventually producing output and terminating at a final ending state.

The transition from one state to the next is not necessarily deterministic.

Some algorithms,

Known as randomized algorithms,

Incorporate random input.

Around 825 AD Persian scientist and polymath Muhammad ibn Musa al-Khwarizm wrote Kitab al-Hisab al-Hindi,

Book of Indian Computation,

And Kitab al-Jam wa'l-Tafriq al-Hisab al-Hindi,

Edition and Subtraction in Indian Arithmetic.

In the early 12th century,

Latin translations of the text involving the Hindu-Arabic numerical system and arithmetic appeared.

For example,

Liber al-Guarismi de Pratica Arismitrice,

Attributed to John of Seville,

And Liber al-Guarismi de Numero Indorum,

Attributed to Eldarad of Bath.

Hereby,

Al-Guarismi or al-Khwarizmi is the Latinization of al-Khwarizmi's name.

The text starts with the phrase,

Dixit al-Khwarizmi,

Or,

Thus spoke al-Khwarizmi.

In 1230 the English word algorithm is attested,

And then by Chaucer in 1391.

English adopted the French term.

In the 15th century,

Under the influence of the Greek word Arithmos,

Number,

Arithmetic,

The Latin word was altered to Algorithmus.

One informal definition is a set of rules that precisely defines a sequence of operations,

Which would include all computer programs,

Including programs that do not perform numeric calculations,

And,

For example,

Any prescribed bureaucratic procedure or cookbook recipe.

In general,

A program is an algorithm only if it stops eventually,

Even though infinite loops may sometimes prove desirable.

Boulos,

Jeffrey,

And 1974-1999 define an algorithm to be a set of instructions for determining an output,

Given explicitly,

In a form that can be followed by either a computing machine or a human who could only carry out specific elementary operations on symbols.

The concept of algorithm is also used to define the notion of decidability,

A notion that is central for explaining how formal systems come into being,

Starting from a small set of axioms and rules.

In logic,

The time that an algorithm requires to complete cannot be measured,

As it is not,

Apparently,

Related to the customary physical dimension.

From such uncertainties that characterize ongoing work stems the unavailability of a definition of algorithm that suits both concrete,

In some sense,

And abstract usage of the term.

Most algorithms are intended to be implemented as computer programs.

However,

Algorithms are also implemented by other means,

Such as in a biological neural network,

For example,

The human brain implementing arithmetic,

Or an insect looking for food,

In an electrical circuit,

Or in a mechanical device.

Since antiquity,

Step-by-step procedures for solving mathematical problems have been attested.

This includes in Babylonian mathematics around 2500 BC,

Egyptian mathematics around 1550 BC,

Indian mathematics around 800 BC and later,

The Ilfa oracle around 500 BC,

Greek mathematics around 240 BC,

And Arabic mathematics around 800 AD.

The earliest evidence of algorithms is found in the Babylonian mathematics of ancient Mesopotamia,

Modern Iraq.

A Sumerian clay tablet found in Surpak,

Near Baghdad,

And dated to circa 2500 BC described the earliest division algorithm.

During the Hammurabi dynasty,

Circa 1800 to circa 1600 BC,

Babylonian clay tablets described algorithms for computing formulas.

Algorithms were also used in Babylonian astronomy.

Babylonian clay tablets describe and employ algorithmic procedures to compute the time and place of significant astronomical events.

Algorithms for arithmetic are also found in ancient Egyptian mathematics,

Dating back to the Rhind mathematical papyrus,

Circa 1550 BC.

Algorithms were later used in ancient Hellenistic mathematics.

Two examples are the sieve of Eratosthenes,

Which was described in the Introduction to Arithmetic by Nicomachus,

And the Euclidean algorithm,

Which was first described in Euclid's Elements,

Circa 300 BC.

Examples of ancient Indian mathematics included the Shulba Sutras and the Kerala school.

The first cryptographic algorithm for deciphering encrypted code was developed by Al-Kindi,

A 9th century Arab mathematician,

In A Manuscript on Deciphering Cryptographic Messages.

He gave the first description of cryptoanalysis by frequency analysis,

The earliest code-breaking algorithm.

Bolter credits the invention of the weight-driven clock as the key invention of Europe in the Middle Ages.

In particular,

He credits the verge escapement mechanism that provides us with the tick and tock of a mechanical clock.

The accurate automatic machine led immediately to mechanical automata,

Beginning in the 13th century,

And finally to computational machines,

The difference engine and analytical engines of Charles Babbage and Countess Ada Lovelace,

Mid-19th century.

Lovelace is credited with the first creation of an algorithm intended for processing on a computer.

Babbage's analytical engine,

The first device considered a real Turing complete computer instead of just a calculator,

And is sometimes called history's first programmer as a result,

Though a full implementation of Babbage's second device would not be realized until decades after her lifetime.

Bell and Newell,

1971,

Indicate that the jacquard loom,

1801,

A precursor to holores cards,

Punch cards,

1887,

And telephone switching technologies,

Were the roots of a tree leading to the development of the first computers.

By the mid-19th century,

The telegraph,

The precursor of the telephone,

Was in use throughout the world,

Its discrete and distinguishable encoding of letters as dots and dashes,

Common sound.

By the late 19th century,

The ticker tape,

Circa 1870s,

Was in use,

As was the use of holores cards in the 1890 US census.

Then came the teleprinter,

Circa 1910,

With its punched paper use of Bodo code on tape.

Telephone switching networks of electromechanical relays,

Invented 1835,

Was behind the work of George Stibitz,

1937,

The inventor of the digital adding device.

As he worked in Bell laboratories,

He observed the burdensome use of mechanical calculators with gears.

He went home one evening in 1937,

Intending to test his idea.

When the tinkering was over,

Stibitz had constructed a binary adding machine.

Mathematician Martin Davis supported the particular importance of the electromechanical relay.

In 1928,

A partial formalization of the modern concept of algorithms began with attempts to solve the decision problem posed by David Hilbert.

Later formalizations were framed as attempts to define effective calculability or effective method.

Those formalizations included the Gödel-Herbrand clean recursive functions of 1930,

1934,

And 1935,

Alonzo Church's IMDA calculus of 1936,

Emil Post's formulation one of 1936,

And Alan Turing's Turing machine of 1936,

37,

And 1939.

Algorithms can be expressed in many kinds of notation,

Including natural languages,

Pseudocode,

Flowcharts,

Track and charts,

Programming languages,

Or control tables processed by interpreters.

Natural language expressions of algorithms tend to be verbose and ambiguous,

And are rarely used for complex or technical algorithms.

Pseudocode,

Flowcharts,

Track and charts,

And control tables are structured ways to express algorithms that avoid many of the ambiguities common in statements based on natural language.

Programming languages are primarily intended for expressing algorithms in a form that can be executed by a computer,

But they are also often used as a way to define or document algorithms.

There is a wide variety of representations possible,

And one can express a given Turing machine program as a sequence of machine tables,

As flow charts and track and charts,

Or as a form of rudimentary machine code or assembly code called sets of quadruples.

Representations of algorithms can also be classified into three accepted levels of Turing machine description.

High-level description,

Implementation description,

And formal description.

A high-level description describes qualities of the algorithm itself,

Ignoring how it is implemented on the Turing machine.

An implementation description describes the general manner in which the machine moves its head and stores data in order to carry out the algorithm,

But doesn't give exact states.

In the most detail,

A formal description gives the exact state table and list of transitions of the Turing machine.

The graphical aid called a flowchart offers a way to describe and document an algorithm,

And a computer program corresponding to it.

Like the program flow of a Minsky machine,

A flowchart always starts at the top of a page and proceeds down.

Its primary symbols are only four.

The directed arrow,

Showing program flow,

The rectangle,

Sequence,

Go-to,

The diamond,

If then else,

And the dot,

Or tie.

The Berm-Jacopini canonical structures are made of these primitive shapes.

Substructures can nest in rectangles,

But only if a single exit occurs from the superstructure.

It is frequently important to know how much of a particular resource,

Such as time or storage,

Is theoretically required for a given algorithm.

Methods have been developed for the analysis of algorithms to obtain such quantitative answers,

Estimates.

For example,

An algorithm that adds up the elements of a list of n numbers would have a time requirement of O-n,

Using big O notation.

At all times,

The algorithm only needs to remember two values,

The sum of all the elements so far,

And its current position in the input list.

Therefore,

It is said to have a space requirement of O-1,

If the space required to store the input numbers is not counted,

Or O-n,

If it is counted.

Different algorithms may complete the same task with a different set of instructions in less or more time,

Space,

Or effort than others.

For example,

A binary search algorithm with cost O log-n outperforms the sequential search,

Cost O-n,

When used for table lookups on sorted lists or arrays.

The analysis and study of algorithms is a discipline of computer science,

And is often practiced abstractly without the use of specific programming language or implementation.

In this sense,

Algorithm analysis resembles other mathematical disciplines,

In that it focuses on the underlying properties of the algorithm,

And not on the specifics of any particular implementation.

Usually,

Pseudocode is used for analysis,

As it is the simplest and most general representation.

However,

Ultimately,

Most algorithms are usually implemented on particular hardware software platforms,

And their algorithmic efficiency is eventually put to the test using real code.

For the solution of a one-off problem,

The efficiency of a particular algorithm may not have significant consequences,

Unless n is extremely large.

But for algorithms designed for fast,

Interactive,

Commercial,

Or long-life scientific usage,

It may be critical.

Scaling from small-n to large-n frequently exposes inefficient algorithms that are otherwise benign.

Empirical testing is useful because it may uncover unexpected interactions that affect performance.

Benchmarks may be used to compare before-and-after potential improvements to an algorithm,

After program optimization.

Empirical tests cannot replace formal analysis,

Though,

And are not trivial to perform in a fair manner.

To illustrate the potential improvements possible even in well-established algorithms,

A recent significant innovation relating to FFT algorithms,

Used heavily in the field of image processing,

Can decrease processing time up to 1,

000 times for applications like medical imaging.

In general,

Speed improvements depend on special properties of the problem,

Which are very common in practical applications.

Speed-ups of this magnitude enable computing devices that make extensive use of image processing,

Like digital cameras and medical equipment,

To consume less power.

Algorithm design refers to a method or a mathematical process for problem-solving and engineering algorithms.

The design of algorithms is part of many solution theories,

Such as divide-and-conquer or dynamic programming within operation research.

Techniques for designing and implementing algorithm designs are also called algorithm design patterns,

With examples including the template method pattern and the decorator pattern.

One of the most common aspects of algorithm design is resource,

Runtime,

Memory usage,

Efficiency.

The big O notation is used to describe,

For example,

An algorithm's runtime growth as the size of its input increases.

Per the Church-Turing thesis,

Any algorithm can be computed by a model known by the Turing complete.

In fact,

It has been demonstrated that Turing completeness requires only four instruction types.

Conditional GOTO,

Unconditional GOTO,

Assignment,

HALT.

However,

Kameny and Kurtz observe that,

While undisciplined use of unconditional GOTOs and conditional if-then GOTOs can result in spaghetti code,

A programmer can write structured programs using only these instructions.

On the other hand,

It is also possible and not too hard to write badly structured programs in a structured language.

Towswaras augments the three Bermiakopini canonical structures.

Sequence,

If-then-else,

And while-do with two more,

Do-while and case.

An additional benefit of a structured program is that it lends itself to proofs of correctness using mathematical induction.

There are various ways to classify algorithms,

Each with his own merits.

By implementation.

One way to classify algorithms is by implementation means.

Recursion.

A recursion algorithm is one that invokes,

Makes reference to itself repeatedly,

Until a certain condition,

Also known as termination condition,

Matches,

Which is a method common to functional programming.

Iterative algorithms use repetitive constructs like loops and sometimes additional data structures like stacks to solve the given problems.

Some problems are naturally suited for one implementation or the other.

For example,

Towers of Hanoi is well understood using recursive implementation.

Every recursive version has an equivalent,

But possibly more or less complex iterative version,

And vice versa.

Serial,

Parallel,

Or distributed.

Algorithms are usually discussed with the assumption that computers execute one instruction of an algorithm at a time.

Those computers are sometimes called serial computers.

An algorithm designed for such an environment is called a serial algorithm,

As opposed to parallel algorithms or distributed algorithms.

Parallel algorithms are algorithms that take advantage of computer architectures,

Where multiple processors can work on a problem at the same time.

Distributed algorithms are algorithms that use multiple machines connected to a computer network.

Parallel and distributed algorithms divide the problem into more symmetrical or asymmetrical sub-problems,

And collect the results back together.

For example,

A CPU would be an example of a parallel algorithm.

The resource consumption in such algorithms is not only processor cycles on each processor,

But also the communication overhead between the processors.

Some sorting algorithms can be parallelized efficiently,

But their communication overhead is expensive.

Iterative algorithms are generally parallelizable,

But some problems have no parallel algorithms,

And are called inherently serial problems.

Deterministic or non-deterministic.

Deterministic algorithms solve the problem with exact decision at every step of the algorithm,

Whereas non-deterministic algorithms solve problems via guessing,

Although typical guesses are made more accurate through the use of heuristics.

Exact or approximate.

While many algorithms reach an exact solution,

Approximation algorithms seek an approximation that is closer to the true solution.

The approximation can be reached by either using a deterministic or a random strategy.

Such algorithms have practical value for many hard problems.

One of the examples of an approximate algorithm is the knapsack problem,

Where there is a set of given items.

Its goal is to pack the knapsack to get the maximum total value.

Each item has some weight and some value.

The total weight that can be carried is no more than some fixed number,

X,

So the solution must consider weights of its items as well as their value.

Quantum algorithm.

Quantum algorithms run on a realistic model of quantum computation.

The term is usually used for those algorithms which seem inherently quantum or use some essential feature of quantum computing,

Such as quantum superposition or quantum entanglement.

By design paradigm.

Another way of classifying algorithms is by their design methodology or paradigm.

There is a certain number of paradigms,

Each different from the other.

Furthermore,

Each of these categories includes many different types of algorithms.

Some common paradigms are brute force or exhaustive search.

Brute force is a method of problem solving that involves systematically trying every possible option until the optimal solution is found.

This approach can be very time-consuming,

As it requires going through every possible combination of variables.

However,

It is often used when other methods are not available or too complex.

Brute force can be used to solve a variety of problems,

Including finding the shortest path between two points and cracking passwords.

Divide-and-conquer.

A divide-and-conquer algorithm repeatedly reduces an instance of a problem to one or more smaller instances of the same problem,

Usually recursively,

Until the instances are small enough to solve easily.

One such example of divide-and-conquer is merge sorting.

Sorting can be done on each segment of data after dividing data into segments,

And sorting of entire data can be obtained in the conquer phase by merging the segments.

A simpler variant of divide-and-conquer is called a decrease-and-conquer algorithm,

Which solves an identical sub-problem and uses the solution of this sub-problem to solve the bigger problem.

Divide-and-conquer divides the problem into multiple sub-problems,

And so the conquer stage is more complex than decrease-and-conquer algorithms.

An example of a decrease-and-conquer algorithm is the binary search algorithm.

Search and enumeration.

Many problems,

Such as playing chess,

Can be modeled as problems on graphs.

A graph exploration algorithm specifies rules for moving around a graph,

And is useful for such problems.

This category also includes search algorithms,

Branch and bound enumeration,

And backtracking.

Randomized algorithm.

Such algorithms make some choices randomly,

Or pseudo- randomly.

They can be very useful in finding approximate solutions for problems,

Where finding exact solutions can be impractical.

For some of these problems,

It is known that the fastest approximations must involve some randomness.

Whether randomized algorithms with polynomial time complexity can be the fastest algorithm for some problems,

Is an open question known as the P versus NP problem.

There are two large classes of such algorithms.

One,

Monte Carlo algorithms return a correct answer with high probability,

E.

G.

RP is a subclass of these that run in polynomial time.

Two,

Las Vegas algorithms always return the correct answer,

But their running time is only probabilistically bound.

Reduction of complexity.

This technique involves solving a difficult problem by transforming it into a better known problem,

For which we have,

Hopefully,

Asymptotically optimal algorithms.

The goal is to find a reducing algorithm whose complexity is not dominated by the resulting reduced algorithms.

For example,

One selection algorithm for finding the median in an unsorted list involves first sorting the list,

The expensive portion,

And then pulling out the middle element in the sorted list,

The cheap portion.

This technique is also known as transform and conquer.

Backtracking.

In this approach,

Multiple solutions are billed incrementally and abandoned when it is determined that they cannot lead to a valid full solution.

Optimization problems.

For optimization problems,

There is a more specific classification of algorithms.

An algorithm for such problems may fall into one or more of the general categories described above,

As well as into one of the following.

Linear programming.

When searching for optimal solutions to a linear function bound to linear equality and inequality constraints,

The constraints of the problem can be used directly in producing the optimal solutions.

There are algorithms that can solve any problem in this category,

Such as the popular simplex algorithm.

Problems that can be solved with linear programming,

Including the maximum flow problem for directed graphs.

If a problem additionally requires that one or more of the unknowns must be an integer,

Then it is classified in integer programming.

A linear programming algorithm can solve such a problem if it can be proved that all restrictions for integer values are superficial,

I.

E.

The solutions satisfy these restrictions anyway.

In the general case,

A specialized algorithm or an algorithm that finds approximate solutions is used,

Depending on the difficulty of the problem.

Dynamic programming.

When a problem shows optimal substructures,

Meaning the optimal solution to a problem can be constructed from optimal solutions to subproblems and overlapping subproblems,

Meaning the same subproblems are used to solve many different problem instances,

A quicker approach called dynamic programming avoids re-computing solutions that have already been computed.

For example,

Floyd-Warshall algorithm,

The shortest path to a goal from a vertex in a weighted graph,

Can be found by using the shortest path to the goal from all adjacent vertices.

Dynamic programming and memoization go together.

The main difference between dynamic programming and divide-and-conquer is that subproblems are more or less independent in divide-and-conquer,

Whereas subproblems overlap in dynamic programming.

The difference between dynamic programming and straightforward recursion is in caching or memoization of recursive calls.

When subproblems are independent and there is no repetition,

Memoization does not help.

Hence,

Dynamic programming is not a solution for all complex problems.

By using memoization or maintaining a table of subproblems already solved,

Dynamic programming reduces the exponential nature of many problems to polynomial complexity.

The greedy method.

A greedy algorithm is similar to a dynamic programming algorithm in that it works by examining substructures,

In this case not of the problem but of a given solution.

Such algorithms start with some solution,

Which may be given or have been constructed in some way,

And improve it by making small modifications.

For some problems they can find the optimal solution,

While for others they stop at local optima,

That is,

At solutions that cannot be improved by the algorithm but are not optimum.

The most popular use of greedy algorithms is for finding the minimal spanning tree,

Where finding the optimal solution is possible with this method.

Meet your Teacher

Benjamin BosterPleasant Grove, UT, USA

4.9 (49)

Recent Reviews

A-L

December 11, 2025

Brilliant! I cannot recall even one thing about this(!)

Diane

August 11, 2024

This was as boring as they come. Really bad. So, yeah, thanks for the great track. A perfect antidote to sleeplessness. 😉👊🏻🥱😴

Cindy

August 9, 2024

That was a good one! Really boring after the first 5-10 minutes. Thanks again!

More from Benjamin Boster

Loading...

Related Meditations

Loading...

Related Teachers

Loading...
© 2026 Benjamin Boster. All rights reserved. All copyright in this work remains with the original creator. No part of this material may be reproduced, distributed, or transmitted in any form or by any means, without the prior written permission of the copyright owner.

How can we help?

Sleep better
Reduce stress or anxiety
Meditation
Spirituality
Something else