Advanced Python Algorithms: Bucket Sorting and Radix Sorting

Advanced Python Algorithm: Bucket Sorting and Radix Sorting Introduction What is bucket sort? Basic steps of bucket sorting Example of bucket sort What is radix sort? Basic steps of radix sort Example of radix sort Application of bucket sorting and radix sorting Application of bucket sorting Application of radix sort Python sample code Summary Introduction […]

Implementation of bucket sort, counting sort, radix sort

Radix sort The core idea of radix sorting is to divide a sorting rule into multiple keywords, and then use stability sorting according to the keywords. Radix sorting does not belong to “allocation sorting” (bucket sorting is a kind of “allocation sorting”). It just borrows the stability sorting of “allocation sorting” to achieve sorting based […]

C++ Standard Template (STL) – type support (numeric limits, max_digits10, radix, min_exponent)

Numerical limits Defined in header file Defined in the header file template< class T > class numeric_limits; The numeric_limits class template provides a standardized way of querying properties of various arithmetic types (e.g. the maximum possible value of type int is std::numeric_limits::max() ). The number of decimal digits required to distinguish all values of this […]

[C Language] Use queues to implement radix sorting

What is radix sort? Radix sort is a “distribution sort”, also known as “bucket sort” or bin sort. As the name suggests, it distributes the elements to be sorted through partial information of the key value. into some “buckets” to achieve the sorting effect. The radix sorting method is a stable sorting, and its time […]

Sorting algorithms: bucket sort, counting sort, radix sort

There are three sorting algorithms with O(n) time complexity: bucket sort, counting sort, and radix sort. Because the time complexity of these sorting algorithms is linear, this type of sorting algorithm is called linear sorting (Linear sort). The main reason why linear time complexity can be achieved is that these three algorithms are non-comparison-based sorting […]

[Introduction to Algorithms] Linear time sorting algorithm (comparative sorting time lower bound, decision tree, counting sort, radix sort)

Linear time sorting 1. Comparing the lower bound of the sorting algorithm and the decision tree model The sorting algorithms we have learned before all rely on comparisons between elements. We call these sorting methods comparison sort. Give you a few minutes to recall the time complexity of the sorting method we learned? For an […]

25. Selection sort, merge sort, radix sort

Table of Contents 1. Selection sorting (1) Simple selection sorting (2) Heap sort 2. Merge sort 3. Radix sorting 4. Comparison of various sorting methods (1) Time performance (2) Space performance (3) Stable performance of sorting method (4) Regarding “the lower limit of the time complexity of the sorting method” 1. Selection sort (1) Simple […]

9. idSpanMap uses radix tree instead of the original unordered_map 10. Performance comparison before and after using radix tree

9. idSpanMap uses a radix tree instead of the original unordered_map Our original idSpanMap used the unordered_map hash bucket in the STL container. Because the STL container itself does not guarantee thread safety, we need to lock it when accessing to ensure thread safety. This is the performance of the memory pool we wrote. bottleneck […]

Data Structures and Algorithms – Bucket Sort and Radix Sort (illustration, pseudocode, multi-keyword sort, radix sort code)

Directory bucket sort icon pseudocode time complexity radix sort Multi-keyword sorting Code (C language) Second priority thematic priority Bucket sort Suppose there are N students, and their grades are integers between 0 and 100 (so there are M=101 different grade values). How to sort students by grade in linear time? The processing method of bucket […]