44 lines
1.2 KiB
Plaintext
44 lines
1.2 KiB
Plaintext
{{Sorting Algorithm}}
|
|
|
|
[[wp:Object identifier|Object identifiers (OID)]] are strings used to identify objects in network data.
|
|
|
|
|
|
;Task:
|
|
Show how to sort a list of OIDs, in their natural sort order.
|
|
|
|
{{task heading|Details}}
|
|
|
|
* An OID consists of one or more non-negative integers in base 10, separated by dots. It starts and ends with a number.
|
|
* Their natural sort order is [[wp:Lexicographical_order|lexicographical]] with regard to the dot-separated fields, using numeric comparison between fields.
|
|
|
|
{{task heading|Test case}}
|
|
|
|
:::: {| class="wikitable"
|
|
|-
|
|
! Input ''(list of strings)''
|
|
! Output ''(list of strings)''
|
|
|-
|
|
|
|
|
<code>1.3.6.1.4.1.11.2.17.19.3.4.0.10</code><br>
|
|
<code>1.3.6.1.4.1.11.2.17.5.2.0.79</code><br>
|
|
<code>1.3.6.1.4.1.11.2.17.19.3.4.0.4</code><br>
|
|
<code>1.3.6.1.4.1.11150.3.4.0.1</code><br>
|
|
<code>1.3.6.1.4.1.11.2.17.19.3.4.0.1</code><br>
|
|
<code>1.3.6.1.4.1.11150.3.4.0</code>
|
|
|
|
|
<code>1.3.6.1.4.1.11.2.17.5.2.0.79</code><br>
|
|
<code>1.3.6.1.4.1.11.2.17.19.3.4.0.1</code><br>
|
|
<code>1.3.6.1.4.1.11.2.17.19.3.4.0.4</code><br>
|
|
<code>1.3.6.1.4.1.11.2.17.19.3.4.0.10</code><br>
|
|
<code>1.3.6.1.4.1.11150.3.4.0</code><br>
|
|
<code>1.3.6.1.4.1.11150.3.4.0.1</code>
|
|
|}
|
|
|
|
{{task heading|Related tasks}}
|
|
|
|
* [[Natural sorting]]
|
|
* [[Sort using a custom comparator]]
|
|
|
|
<hr>
|
|
|