C Program to find GCD and LCM using Recursion

This C program finds the GCD (Greatest Common Divisor) and LCM (Least Common Multiple) of two numbers using recursion. Recursion is a technique where a function calls itself to solve a smaller version of the same problem. The GCD is computed with the classic recursive Euclidean algorithm, and the LCM is then derived from it …

Fibonacci Series in C – Iterative, Recursive, and Array Methods

The Fibonacci series in C is a sequence where each number is the sum of the two preceding ones, starting from 0 and 1: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, … This page covers three approaches — iterative series printing, a recursive function, and a side-by-side comparison of their time and …

Factorial Program in C – Iterative and Recursive with Output

The factorial program in C is one of the most common exercises for learning recursion and loops. The factorial of a non-negative integer n, written n!, is the product of all positive integers from 1 to n. By definition, 0! = 1. This page covers two approaches — iterative and recursive — with compile-verified code, …

C Program to sort the string, using shell sort technique.

C Program to sort the string, using shell sort technique. Shell sort is the one of the oldest sorting technique, quite well for all types of arrays in c. The shell sort is a “diminishing increment sort”, better known as a “comb sort” to the unwashed programming masses. The algorithm makes multiple passes through the …

Merge Sort in C – Algorithm, Program, and Complexity

Merge sort in C is a classic divide-and-conquer sorting algorithm that guarantees O(n log n) time in all cases. It splits an array into halves, recursively sorts each half, then merges the sorted halves back together. Unlike bubble sort or insertion sort, merge sort never degrades to O(n²) — making it the preferred choice when …

Insertion Sort in C – Program, Algorithm and Complexity

Insertion sort is one of the simplest sorting algorithms and works exactly the way you sort a hand of playing cards. You take one card at a time and insert it into its correct position among the cards already sorted in your hand. It sorts the array one element at a time, building the sorted …