# C++ Programming Code Examples

## C++ > Sorting Searching Code Examples

### Program to Implement Merge Sort using Linked List

Prints Day Name of Week Array Constant -
Input week day number from user. Store it in a variable say week. Print Monday if week=1. I have assumed Monday as first day of week. And check condition for all 7 days & print the

Use The KMP Pattern Searching Algorithm -
Program performs a Pattern Searching using "KMP" 'Pattern Searching Algorithm'. Pattern searching is used for Finding the Existence of a Substring in a String. The pattern searching

Checking Singly Linked List is Palindrome -
C Program checks whether the Singly Linked list is a palindrome. A Palindrome is a Pattern in List in which the contents when read from front is the same as when read from last. So

C++ Multiply Two Matrices use 2D Arrays -
C++ Code is very simple it takes input in two 2D arrays each with size of 2X2. After taking the input program "multiply two matrix" in 3 nested for loops. Size of arrays is defined use

C Program to Add two Complex Numbers -
This C Program adds two complex numbers. A Complex Number is a number that can be put in the form a + bi, where a and b are real numbers & i is called imaginary unit, where...

Efficient Implementations of Disjoint Sets -
numElements is the initial number of disjoint sets. Union "Two Disjoint" sets. For simplicity, we assume "root1 and root2" are distinct and represent set names. "root1" is the root of set

C++ Codings Global Function Friend Class -
Similar to friend class, this 'C++ Function' can access the private and protected members of another class. A 'Global Function' can also be 'declared as friend' as shown in the C++ Code

C Code Traverse the Tree Non-Recursively -
C language code, using iteration, searches for a given node in a tree. The tree we have used is the binary search tree. A binary search tree follows a concept of nodes whose numbers...