C Program to Sort N Elements Using Selection Sort — With Step-by-Step Example

Selection Sort works by repeatedly finding the minimum element from the unsorted portion of the array and placing it at the beginning. After each pass, the sorted portion grows by one element from the left. It always performs exactly O(n²) comparisons regardless of input order — unlike Bubble or Insertion Sort, there is no early …

C Program to Sort Names in Alphabetical Order (Bubble Sort)

Sorting names alphabetically in C means sorting an array of strings — and that’s what makes this program a classic: you can’t compare strings with > or swap them with =. You need strcmp() to compare and strcpy() to swap, and that pair of ideas is exactly what this exercise teaches. This version reads N …

Binary Search in C – Iterative and Recursive with Example

Binary search in C finds a target value in a sorted array by repeatedly halving the search space. At each step it compares the target against the middle element: if they match, the search is done; if the target is smaller, discard the right half; if larger, discard the left half. This gives O(log n) …