How to resolve the algorithm Sort an outline at every level step by step in the Phix programming language
How to resolve the algorithm Sort an outline at every level step by step in the Phix programming language
Table of Contents
Problem Statement
Write and test a function over an indented plain text outline which either:
Your code should detect and warn of at least two types of inconsistent indentation:
Your code should be able to detect and handle both tab-indented, and space-indented (e.g. 4 space, 2 space etc) outlines, without being given any advance warning of the indent characters used, or the size of the indent units. You should also be able to specify different types of sort, for example, as a minimum, both ascending and descending lexical sorts. Your sort should not alter the type or size of the indentation units used in the input outline.
(For an application of Indent Respectful Sort, see the Sublime Text package of that name. The Python source text [1] is available for inspection on Github).
Tests
The output sequence of an ascending lexical sort of each level should be: The output sequence of a descending lexical sort of each level should be:
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Sort an outline at every level step by step in the Phix programming language
Source code in the phix programming language
You may also check:How to resolve the algorithm Extreme floating point values step by step in the Raku programming language
You may also check:How to resolve the algorithm Elliptic Curve Digital Signature Algorithm step by step in the Java programming language
You may also check:How to resolve the algorithm Bitmap/Midpoint circle algorithm step by step in the Delphi programming language
You may also check:How to resolve the algorithm Sum to 100 step by step in the Aime programming language
You may also check:How to resolve the algorithm HTTP step by step in the Go programming language