Programming ConceptsSorting Algorithms

Sorting algorithms arrange data in a specific order, such as ascending or descending. Examples include Bubble Sort, Merge Sort, and Quick Sort.

// Example: JavaScript sort method
let arr = [5, 2, 8, 1];
arr.sort((a, b) => a - b);
console.log(arr); // Output: [1, 2, 5, 8]