Editing 2407: Depth and Breadth

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 8: Line 8:
  
 
==Explanation==
 
==Explanation==
 +
{{incomplete|Created by a LOAF OF DEATH. Please mention here why this explanation isn't complete. Do NOT delete this tag too soon.}}
 +
 
{{w|Tree (data structure)|Tree structure}}s are one of the most common data structures used in computer science.  The common ways of enumerating items arranged in a tree is either {{w|Depth-first search|depth-first}}, or {{w|Breadth-first search|breadth-first}}, which are depicted accurately in the comic.  Randall humorously combines the words, to produce "brepth-first", "deadth-first", "bread-first", and "death-first" search algorithms.
 
{{w|Tree (data structure)|Tree structure}}s are one of the most common data structures used in computer science.  The common ways of enumerating items arranged in a tree is either {{w|Depth-first search|depth-first}}, or {{w|Breadth-first search|breadth-first}}, which are depicted accurately in the comic.  Randall humorously combines the words, to produce "brepth-first", "deadth-first", "bread-first", and "death-first" search algorithms.
  
Line 15: Line 17:
  
 
The nature of the "deadth-first" algorithm is unclear and inefficient, since it searches the same nodes multiple times before moving to an entirely different region of the tree.  It might be useful in a context where examining nodes has some probability of returning a noisy or incorrect result, such as searching for small objects that may be overlooked.
 
The nature of the "deadth-first" algorithm is unclear and inefficient, since it searches the same nodes multiple times before moving to an entirely different region of the tree.  It might be useful in a context where examining nodes has some probability of returning a noisy or incorrect result, such as searching for small objects that may be overlooked.
 
It may also be how people with OCD search, but this would be very stereotypical.
 
  
 
The bread-first search is taken literally.  Bread is searched for first.  Since the computer user now has already met their want to find bread, the computer has no reason to explore the tree at all.{{Citation needed}}
 
The bread-first search is taken literally.  Bread is searched for first.  Since the computer user now has already met their want to find bread, the computer has no reason to explore the tree at all.{{Citation needed}}
  
The title text introduces a "death-first" search, in which the user explores what it is like to be dead, before considering anything else. Specifically, the title text refers to hell, which calls to mind the adventures of Dante Alighieri in {{w|Inferno (Dante)| his ''Inferno''}}, and is a less likely place for keys to be left than one's coat pockets {{Citation needed}}. In 2021 (the year this comic was published) there are commemorations for the 700th anniversary of Dante's Death. These are expected to take place among the living only, and not in Hell.{{Citation needed}} A much more pleasant death-first algorithm might be to skip hell and purgatory and search heaven first, perhaps multiple times (which in itself would be a use of the deadth-first approach).
+
The title text introduces a "death-first" search, in which the user explores what it is like to be dead, before considering anything else. Specifically, the title text refers to hell, which calls to mind the adventures of Dante Alighieri in {{w|Inferno (Dante)| his ''Inferno''}}, and is a less likely place for keys to be left than one's coat pockets {{Citation needed}}. In 2021 (the year this comic was published) there are celebrations for the 700th anniversary of Dante's Death. Celebrations are expected to take place among the living only, and not in Hell.{{Citation needed}} A much more pleasant death-first algorithm might be to skip hell and purgatory and search heaven first, perhaps multiple times (which in itself would be a use of the deadth-first approach).
  
 
==Transcript==
 
==Transcript==
 +
{{incomplete transcript|Do NOT delete this tag too soon.}}
 +
 
:[Five panels, each containing identical copies of a rooted tree graph, grayed out in the background. The tree has a height of 3 and 15 nodes.]
 
:[Five panels, each containing identical copies of a rooted tree graph, grayed out in the background. The tree has a height of 3 and 15 nodes.]
 
:[In all five panels, a black twisty arrow in the foreground indicates the order in which nodes are traversed. The arrow does not complete the entire traversal but cuts off at some point. Backtracking is indicated with a dotted line.]
 
:[In all five panels, a black twisty arrow in the foreground indicates the order in which nodes are traversed. The arrow does not complete the entire traversal but cuts off at some point. Backtracking is indicated with a dotted line.]
Line 41: Line 43:
  
 
:Bread-first search
 
:Bread-first search
:[The arrow starts at node 1, then immediately leaves the tree off to the right to point to a small loaf labeled "Bread".]
+
:[The arrow starts at node 1, then leaves the tree off to the right to point to a loaf labeled "Bread".]
  
 
{{comic discussion}}
 
{{comic discussion}}
 
[[Category:Programming]]
 
[[Category:Programming]]
 
[[Category:Food]]
 
[[Category:Food]]

Please note that all contributions to explain xkcd may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see explain xkcd:Copyrights for details). Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel | Editing help (opens in new window)