Posts

Data Structure Lab 6

Image
Source code : #include <iostream> using namespace std; #define size 5 int que[size],front=0,rear=0; //add value in enque void enque(int value) { if(size==rear && front==0) { cout<<"Qeue is full"<<endl; } else { que[rear]=value; rear++; cout<<value<<" value is enqeue in array"<<endl; } } //del value from que void deque() { int no; if(front==rear) { cout<<"Stack is empty"<<endl; } else { no=que[front]; front++; cout<<no<<" is deleted from que. "<<endl; } } void display() { if(front==rear) { cout<<"Stack is empty"<<endl; } else { for(int i=front;i<rear;i++) { cout<<que[i]<<"  "; } cout<<endl; } } int main() { int choice,value; do{ cout<<"****...

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++)        ...

Data Structure lab 2

                                                    LAB 02                                              Data Structure Lab              Task :1 Part 1    #include <iostream> using namespace std; void main(){        int count = 0;        int n ,flag=0;        cout << "Enter any integer: " ;        cin >> n;        for ( int i =2; i<=n-1; i++){      ...

Data Structure lab 1

Task 1: Write a Program to enter three integers and output the smallest integer using IF. #include <iostream> using namespace std; void smallest(int a,int b, int c); int main() {             int a,b,c;             cout<<"Enter 3 numbers"<<endl;             cin>>a;             cin>>b;             cin>>c;             smallest(a,b,c);             system("pause"); } void smallest(int a, int b, int c) {                         if (a...