Sorting algorithms/Tree sort on a linked list: Difference between revisions
Sorting algorithms/Tree sort on a linked list (view source)
Revision as of 11:53, 12 July 2018
, 5 years agoUndo revision 263502 by Cloudius (talk) No reason given why all 5 existing solutions are considered incorrect nor any attempt to correct them.
(Fix completely broken Wikipedia links) |
|||
Line 11:
=={{header|J}}==
What *is* a sentence in Finnegan's Wake? Let's say that it's all the text leading up to a period, question mark or exclamation point if (and only if) the character is followed by a space or newline. (There are some practical difficulties here - this means, for example, that the first sentence of a chapter includes the chapter heading - but it's good enough for now.)
Line 97:
=={{header|Kotlin}}==
As I can't be bothered to download Finnegan's Wake and deal with the ensuing uncertainties, I've contented myself by following a similar approach to the Racket and Scheme entries:
<lang scala>// version 1.1.51
Line 152 ⟶ 151:
=={{header|Racket}}==
{{trans|Scheme}} -- this implementation illustrates differences in identifiers and syntaxes of Scheme and Racket's <code>match-lambda</code> family. [http://docs.racket-lang.org/reference/match.html <code>racket/match</code> documented here].
Line 190 ⟶ 188:
=={{header|Scheme}}==
The following implements a sorting algorithm that takes a linked list, puts each key into an unbalanced binary tree and returns an in-order traversal of the tree.
{{libheader|Matchable}}
{{works with|Chicken Scheme}}
<lang Scheme>(use matchable)
Line 230 ⟶ 226:
=={{header|zkl}}==
This code reads a file [of source code] line by line, and builds a binary tree of the first word of each line. Then prints the sorted list.
<lang zkl>class Node{
|