add markdown identifier to code language (#36503)
This commit is contained in:
committed by
Randell Dawson
parent
590438ecfa
commit
dd3c0e0893
@ -66,9 +66,8 @@ Finally , we sort according to the hundred's digit (most significant digit):
|
|||||||
The array becomes : 10, 11, 17, 21, 34, 44, 123, 654 which is sorted. This is how our algorithm works.
|
The array becomes : 10, 11, 17, 21, 34, 44, 123, 654 which is sorted. This is how our algorithm works.
|
||||||
|
|
||||||
An implementation in C:
|
An implementation in C:
|
||||||
```
|
```c
|
||||||
void countsort(int arr[],int n,int place){
|
void countsort(int arr[],int n,int place){
|
||||||
|
|
||||||
int i,freq[range]={0}; //range for integers is 10 as digits range from 0-9
|
int i,freq[range]={0}; //range for integers is 10 as digits range from 0-9
|
||||||
int output[n];
|
int output[n];
|
||||||
|
|
||||||
@ -88,7 +87,6 @@ void countsort(int arr[],int n,int place){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void radixsort(ll arr[],int n,int maxx){ //maxx is the maximum element in the array
|
void radixsort(ll arr[],int n,int maxx){ //maxx is the maximum element in the array
|
||||||
|
|
||||||
int mul=1;
|
int mul=1;
|
||||||
while(maxx){
|
while(maxx){
|
||||||
countsort(arr,n,mul);
|
countsort(arr,n,mul);
|
||||||
@ -99,7 +97,7 @@ void radixsort(ll arr[],int n,int maxx){ //maxx is the maximum elemen
|
|||||||
```
|
```
|
||||||
An implementation in python :
|
An implementation in python :
|
||||||
|
|
||||||
```
|
```py
|
||||||
def counting_sort(arr, max_value, get_index):
|
def counting_sort(arr, max_value, get_index):
|
||||||
counts = [0] * max_value
|
counts = [0] * max_value
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user