Posts

Showing posts with the label Radix Sort

Implementation of 8 sorting Algorithms using Abstract Class & Templates in C++.

Problem: Implementation of 8 sorting Algorithms using Abstract Class in C++ which includes : -         o Bubble sort         o Selection Sort         o Insertion Sort         o Shell Sort         o Quick Sort         o Merge Sort         o Heap Sort         o Radix Sort         Solution : #include<iostream> #include<stdlib.h> #include<string.h> using namespace std; template <class T> class sort { public:     virtual void sorting(T *a, int beg, int n) = 0;     void swap(T &a, T &b);     void createlist(T *a, int n);     void display(T *a, int n); }; template <class T> void sort<T>::createlist(T *a, int n) {     int i;     for (i = 0; i < n; i++) {       ...