Implementing Common Sorting Algorithms in Java
Algorithmic Complexity
Understanding the complexity of sorting algorithms is essential for selecting the appropriate one for a given task.
Bubble Sort
Bubble Sort repeatedly steps through the list, compares adjacent items, and swaps them if they are in the wrong order. This process repeats until no swaps are needed. An optimized version include ...
Posted on Thu, 18 Jun 2026 16:24:37 +0000 by bilbot
Comprehensive Guide to Eight Fundamental Sorting Algorithms
Sorting Fundamentals
Sorting is the process of arranging a sequence of records in either ascending or descending order based on one or more specified keys.
Stability: A sorting algorithm is considered stable if, for records with identical keys, their relative order remains unchanged after sorting. If the input has r[i] = r[j] with i < j, sta ...
Posted on Mon, 18 May 2026 09:06:09 +0000 by mvleus
Selection Sort and Heap Sort Algorithms
Selection Sort
Core Concept
During each iteration, the element with the smallest (or largest) key is identified from the unsorted portion and appended to the sorted sub-sequence.
Implementation
void selectionSort(int data[], int size) {
for (int current = 0; current < size - 1; ++current) {
int smallestIdx = current;
for ...
Posted on Sun, 17 May 2026 02:00:21 +0000 by mikecurtin
Greedy Algorithm Applications: Digit Removal and Three-Value Sorting
Minimizing a Number by Removing Digits
The goal is to take a high-precision positive integer n (up to 240 digits) and remove s digits such that the remaining digits, in their original order, form the smallest possible integer.
Problem Strategy
A common mistake is to sort the digits and remove largest ones. However, this violates the rule of ma ...
Posted on Thu, 14 May 2026 14:08:55 +0000 by kucing
Implementing Bubble Sort in C
Bubble Sort operates by repeatedly comparing adjacent elements in an array and swapping them if they are in the wrong order. This process is repeated until the entire array is sorted, with larger elements gradually moving towards the end like bubbles rising to the surface.
Bubble Sort is suitable for small datasets or partially sorted data and ...
Posted on Thu, 14 May 2026 05:23:15 +0000 by joviyach
A Comprehensive Guide to Bubble Sort in C
Bubble Sort is an elementary sorting algorithm that operates by repeatedly scanning an unsorted list, comparing each pair of adjacent elements, and swapping them if they are in the wrong order. This process continues until the entire list is sorted, with larger elements gradually "bubbling up" to the end of the list over each iteratio ...
Posted on Mon, 11 May 2026 05:54:31 +0000 by stef686
Implementing Sorting Algorithms with C++ Templates
This article demonstrates how to implement common sorting algorithms using C++ class templates with dynamic array storage. The implementation includes ranking sort, selection sort with early termination, bubble sort with early termination, and insertion sort.
Requirements
No STL containers (arrrays, vectors, etc.) Must use class templates (temp ...
Posted on Sat, 09 May 2026 10:41:46 +0000 by angelena
Implementation and Analysis of Core Sorting Algorithms
Sorting algorithms are categorized into internal and external types. Internal sorting processes data entirely in memory, while external sorting handles datasets too large for memory, requiring access to external storage. This guide focuses on internal sorting algorithms.
For large datasets (n), algorithms with O(n log n) time complexity, such a ...
Posted on Thu, 07 May 2026 16:15:45 +0000 by Tedglen2