C++ Program to Implement Radix Sort

This is a C++ Program to Sort the Given Data using Radix sort. Problem Description 1. In this algorithm sorting of data is done from least significant digit to most significant digit. 2. Here we need 10 different spaces labeled 0 to 9. 3. Assume we have ‘n’ number of inputs. 4. Let ‘d’ be … Read more

advertisement

C++ Program to Count Inversions in an Array

This is a C++ program to count the inversion in an array. Problem Description 1. The number of switches required to make an array sorted is termed as inversion count. 2. Its value varies with the sorting algorithms. 3. The time complexity is O(n^2). Problem Solution 1. Compare the values of the element with each … Read more

advertisement

C++ Program to Sort Linked List using Merge Sort

This is a C++ program to sort the given data using Merge Sort using linked list. Problem Description 1. Merge-sort is based on an algorithmic design pattern called divide-and-conquer. 2. It forms tree structure. 3. The height of the tree will be log(n). 4. we merge n element at every level of the tree. 5. … Read more

advertisement

C++ Program to Implement Heap Sort

This is a C++ program to sort the given data using Heap Sort. Problem Description 1. Heap sort is a comparison based algorithm. 2. It is improved version of selection sort. 3. The time complexity is O(n*log(n)). Problem Solution 1. Build a max heap using the given data element. 2. Delete the root node repeatedly. … Read more

advertisement

C++ Program to Implement Insertion Sort

Problem Description Write a C++ program to sort the given data using Insertion Sort. What is Insertion Sort? Insertion Sort in C++ is a simple sorting algorithm that works by dividing the list into sorted and unsorted portions. It repeatedly picks a value from the unsorted portion and inserts it into its correct position in … Read more

advertisement

Merge Sort in C++

What is Merge Sort? Merge Sort in C++ is a popular sorting algorithm that divides the input array into smaller subarrays, recursively sorts them, and then merges them to produce a sorted output in ascending or descending order. Merge Sort Algorithm Here’s the pseudo code for the Merge Sort algorithm in C++: void Merge(int arr[], … Read more

advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.