10 lines
928 B
Plaintext
10 lines
928 B
Plaintext
Write a function that orders two lists or arrays filled with numbers.
|
|
The function should accept two lists as arguments and return <code>true</code> if the first list should be ordered before the second, and <code>false</code> otherwise.
|
|
|
|
The order is determined by [[wp:Lexicographical order#Ordering of sequences of various lengths|lexicographic order]]: Comparing the first element of each list.
|
|
If the first elements are equal, then the second elements should be compared, and so on, until one of the list has no more elements.
|
|
If the first list runs out of elements the result is <code>true</code>.
|
|
If the second list or both run out of elements the result is <code>false</code>.
|
|
|
|
<small>Note: further clarification of lexicographical ordering is expounded on the talk page [[Talk:Order_two_numerical_lists#Lexicographic_order|here]] and [[Talk:Order_two_numerical_lists#Is_the_task_statement_consistent.3F|here]].</small>
|