mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-13 23:56:07 +00:00
Sort the coding languages by applications. (#721)
This commit is contained in:
@@ -24,14 +24,14 @@ $$
|
||||
|
||||
此外,我们需要小幅改动计数排序代码,使之可以根据数字的第 $k$ 位进行排序。
|
||||
|
||||
=== "Java"
|
||||
=== "Python"
|
||||
|
||||
```java title="radix_sort.java"
|
||||
[class]{radix_sort}-[func]{digit}
|
||||
```python title="radix_sort.py"
|
||||
[class]{}-[func]{digit}
|
||||
|
||||
[class]{radix_sort}-[func]{countingSortDigit}
|
||||
[class]{}-[func]{counting_sort_digit}
|
||||
|
||||
[class]{radix_sort}-[func]{radixSort}
|
||||
[class]{}-[func]{radix_sort}
|
||||
```
|
||||
|
||||
=== "C++"
|
||||
@@ -44,14 +44,24 @@ $$
|
||||
[class]{}-[func]{radixSort}
|
||||
```
|
||||
|
||||
=== "Python"
|
||||
=== "Java"
|
||||
|
||||
```python title="radix_sort.py"
|
||||
[class]{}-[func]{digit}
|
||||
```java title="radix_sort.java"
|
||||
[class]{radix_sort}-[func]{digit}
|
||||
|
||||
[class]{}-[func]{counting_sort_digit}
|
||||
[class]{radix_sort}-[func]{countingSortDigit}
|
||||
|
||||
[class]{}-[func]{radix_sort}
|
||||
[class]{radix_sort}-[func]{radixSort}
|
||||
```
|
||||
|
||||
=== "C#"
|
||||
|
||||
```csharp title="radix_sort.cs"
|
||||
[class]{radix_sort}-[func]{digit}
|
||||
|
||||
[class]{radix_sort}-[func]{countingSortDigit}
|
||||
|
||||
[class]{radix_sort}-[func]{radixSort}
|
||||
```
|
||||
|
||||
=== "Go"
|
||||
@@ -64,6 +74,16 @@ $$
|
||||
[class]{}-[func]{radixSort}
|
||||
```
|
||||
|
||||
=== "Swift"
|
||||
|
||||
```swift title="radix_sort.swift"
|
||||
[class]{}-[func]{digit}
|
||||
|
||||
[class]{}-[func]{countingSortDigit}
|
||||
|
||||
[class]{}-[func]{radixSort}
|
||||
```
|
||||
|
||||
=== "JS"
|
||||
|
||||
```javascript title="radix_sort.js"
|
||||
@@ -84,46 +104,6 @@ $$
|
||||
[class]{}-[func]{radixSort}
|
||||
```
|
||||
|
||||
=== "C"
|
||||
|
||||
```c title="radix_sort.c"
|
||||
[class]{}-[func]{digit}
|
||||
|
||||
[class]{}-[func]{countingSortDigit}
|
||||
|
||||
[class]{}-[func]{radixSort}
|
||||
```
|
||||
|
||||
=== "C#"
|
||||
|
||||
```csharp title="radix_sort.cs"
|
||||
[class]{radix_sort}-[func]{digit}
|
||||
|
||||
[class]{radix_sort}-[func]{countingSortDigit}
|
||||
|
||||
[class]{radix_sort}-[func]{radixSort}
|
||||
```
|
||||
|
||||
=== "Swift"
|
||||
|
||||
```swift title="radix_sort.swift"
|
||||
[class]{}-[func]{digit}
|
||||
|
||||
[class]{}-[func]{countingSortDigit}
|
||||
|
||||
[class]{}-[func]{radixSort}
|
||||
```
|
||||
|
||||
=== "Zig"
|
||||
|
||||
```zig title="radix_sort.zig"
|
||||
[class]{}-[func]{digit}
|
||||
|
||||
[class]{}-[func]{countingSortDigit}
|
||||
|
||||
[class]{}-[func]{radixSort}
|
||||
```
|
||||
|
||||
=== "Dart"
|
||||
|
||||
```dart title="radix_sort.dart"
|
||||
@@ -144,6 +124,26 @@ $$
|
||||
[class]{}-[func]{radix_sort}
|
||||
```
|
||||
|
||||
=== "C"
|
||||
|
||||
```c title="radix_sort.c"
|
||||
[class]{}-[func]{digit}
|
||||
|
||||
[class]{}-[func]{countingSortDigit}
|
||||
|
||||
[class]{}-[func]{radixSort}
|
||||
```
|
||||
|
||||
=== "Zig"
|
||||
|
||||
```zig title="radix_sort.zig"
|
||||
[class]{}-[func]{digit}
|
||||
|
||||
[class]{}-[func]{countingSortDigit}
|
||||
|
||||
[class]{}-[func]{radixSort}
|
||||
```
|
||||
|
||||
!!! question "为什么从最低位开始排序?"
|
||||
|
||||
在连续的排序轮次中,后一轮排序会覆盖前一轮排序的结果。举例来说,如果第一轮排序结果 $a < b$ ,而第二轮排序结果 $a > b$ ,那么第二轮的结果将取代第一轮的结果。由于数字的高位优先级高于低位,我们应该先排序低位再排序高位。
|
||||
|
||||
Reference in New Issue
Block a user