Input #include<bits/stdc++.h> using namespace std; template<class T> class Linear { public: int n; T a; T *arr; Linear(int x) { n=...
Data Structure Practicals
Syllabus with topics linked
Write a program using templates to sort a list of elements. Give user the option to perform sorting using Insertion sort, Bubble sort or Selection sort
Input #include<iostream> using namespace std; template <class X_Type> class SortingOfArray { public: X_Type *arr; int size; X_Type...
Implement Linked List using templates. Include functions for insertion, deletion and search of a number, reverse the list and concatenate two linked lists (include a function and also overload operator +)
Input #include<iostream> using namespace std; template<class t> class node { public: t data; node<t> *next; }; template<class...
Implement Doubly Linked List using templates. Include functions for insertion, deletion and search of a number, reverse the list
Input #include<iostream> using namespace std; template<class t> class node { public: t data; node *prev,*next; }; template<class...
Implement Circular Linked List using templates. Include functions for insertion, deletion and search of a number, reverse the list
Input #include<iostream> using namespace std; template<class t> class node { public: t data; node *next; }; template<class t>...
Perform Stack operations using Linked List implementation
Input #include <iostream> using namespace std; template <typename T> class Node { public: T info; Node<T>* next; Node() { next=0;...
Perform Stack operations using Array implementation. Use Templates
Input #include<iostream> using namespace std; template <class X_Type> class LinkedList_using_Array { X_Type arr[100]; int n ,...
Perform Queues operations using Circular Array implementation. Use Templates
Input #include<iostream> using namespace std; const int size=5; int flag=0; template<class t> class CQ { static const int...
Create and perform different operations on Double-ended Queues using Linked List implementation
Input #include <iostream> using namespace std; template <class T> class node { public: T info; node *next; node(T a,node *p=0)...
Write a program to scan a polynomial using linked list and add two polynomial
Input #include<iostream> using namespace std; class node { public: int power; int coeff; node *next; }; class poly { node *first; int...
Write a program to calculate factorial and to compute the factors of a given no. (i) using recursion, (i) using iteration
Input #include<iostream> using namespace std; int i = 1; int factorial(int n); void factor(int n, int i); int iter_factorial(int n);...
Write a program to display fibonacci series (i)using recursion, (ii) using iteration
Input #include <iostream> using namespace std; int Fibonacci(const int& n) { if (n <= 1) return 0; else if (n == 2 || n == 3)...
Write a program to calculate GCD of 2 number (i) with recursion (ii) without recursion
Input (with recursion) #include<iostream> #include <stdio.h> using namespace std; int GCD(int a, int b); int main() { cout <<...
Write a program to create a Binary Search Tree and include following operations in tree
Input #include<iostream> using namespace std; #define MAX 20 class bstnode { public: int info; bstnode *left, *right; bstnode() {...
Write a program to convert the Sparse Matrix into non-zero form and vice-versa
Input #include<iostream> using namespace std; void StoN() { int val, arrM[20][20], S[20][3], r=0, c=0, j; cout<<"\n Enter the...