Posts

Showing posts from March, 2018

Data Structure Lab 5

Image
#include<iostream> #define MAX 5 using namespace std; int STACK[MAX],TOP; //stack initialization void initStack(){     TOP=-1; } //check it is empty or not int isEmpty(){     if(TOP==-1)         return 1;     else         return 0; } //check stack is full or not int isFull(){     if(TOP==MAX-1)         return 1;     else           return 0; } void push(int num){     if(isFull()){         cout<<"STACK is FULL."<<endl;         return;     }     ++TOP;     STACK[TOP]=num;     cout<<num<<" has been inserted."<<endl; } void display(){     int i;     if(isEmpty()){         cout<<"STACK is EMPTY."<<endl;         return; ...

Data Structure lab 4

Data Structure lab 4: Create a program that take an array of 10 inputs from the user and generate the sorted out put using the following Algorithms; •       Bubble Sort •       Insertion Sort •       Selection Sort Code: #include <iostream> using namespace std; void bubblesort(int c[]) {                 int temp;                 for (int j = 1; j < 10; j++)                 {                                 for (int i = 0; i< 10-j; i++)        ...