dsa using c++ program

Selection Sort in Data Structures using C++ 0

Selection Sort in Data Structures using C++

Program 1 //Program for Selection sort #include<iostream> #define clrscr() system(“cls”) using namespace std; class Sort { public: void selectionsort(int ar[],int n) { int i,temp,j,min,loc; for(i=0;i<n;i++) { min=ar[i]; loc=i; for(j=i+1;j<n;j++) { if(ar[j]<min) { min=ar[j]; loc=j;...

Bubble Sort in Data Structures using C++ 0

Bubble Sort in Data Structures using C++

Program 1 // Program for Bubble sort #include<iostream> #define clrscr() system(“cls”) using namespace std; class Sort { public: void bubblesort(int ar[],int n) { int i,j,temp; for(i=0;i<n-1;i++) { for(j=0;j<n-i-1;j++) { if(ar[j]>ar[j+1]) { temp=ar[j]; ar[j]=ar[j+1]; ar[j+1]=temp;...

Stack in DSA using C++ 0

Stack in DSA using C++

Program 1 #include<iostream> #define MAXSIZE 10 #define clrscr() system(“cls”) using namespace std; class MyStack { private: int stack[MAXSIZE]; int top; public: MyStack() { top=-1; } int push(); int pop(); int display(); }; int MyStack::push()...