Skip to main content

Posts

Showing posts from March, 2020
CIRCULAR-QUEUE Program /*circular-queue using array*/ #include<stdio.h> #include<stdlib.h> #define max 5 struct circular{     int item[max], rear; }c; int index; /*displaying circular queue*/ void display(){     if(c.rear == -1){         printf("\nCircular-Queue is empty");     }else{         printf("\nThe elements of Circular-Queue is: ");         for(index=0;index<=c.rear;index++){             printf("%d\t",c.item[index]);         }     } } /*inserting elements into circular-queue*/ void ins_que(){     int element;     if(c.rear == (max-1)){         printf("\nCircular-Queue is full");     }else{        ...
Queue What is queue ? A Queue is a linear structure which follows a particular order in which the operations are performed. The order is First In First Out (FIFO). program /*queue using array Fist-In-First-Out */ #include<stdio.h> #include<stdlib.h> #define max 5 struct queue{     int item[max], rear; }q; int index; /*displaying queue elements*/ void display(){     if(q.rear == -1){         printf("\nQueue is empty");     }else{         printf("\nThe queue elements is: ");         for(index=0;index<=q.rear;index++){             printf("%d\t",q.item[index]);         }     } } /*inserting elements into queue*/ void queue(){     int element;     if(q.rear == (max-1)){   ...
STACK what is stack ? Stack is an ordered list in which, insertion and deletion operations can be performed only at one end that is called top. Stack is a recursive data structures having pointer to its top element. Stack is also called linear data structure. Stacks are sometimes called as Last-In-First-Out(LIFO) lists. i.e. element which inserted first in the stack will deleted last from the stack. Application of Stack Recursion Expression evaluation and conversions Parsing Browsers Editors Tree traversals Operation on stack PUSH : Adding elements into stack POP : Removing elements from stack Stack program using Array  /*stack using array Last-In-First-Out (FIFO) */ #include<stdio.h> #include<stdlib.h> #define max 5 struct stack{     int item[max], top; }s; int index; //displaying stack elements void display(){     if(s.top == -1){         printf("\nStack is empty");     ...
What is Data Structure? Data Structure (DS) is a way to store and organize data so that it can be used efficiently. The C programming language has many data structures like an array, stack, queue, link list , tree etc. A programmer selects an appropriate Data Structure and uses it according to their convenience. Introduction:  Data Structure can be defined as a group of data elements which provides an efficient way of storing and organize data in the computer so that it can be use efficiently. Some example of data structures are, array link list stack queue Why we use Data structures ? as application are getting complex and amount of data is increasing bay by day , there may arise the following problems : Processor Speed : To handle very large amount of data, high speed processing is required, but as the data is growing day by day to the billion of files per entity, processor may be fail to deal with that much amount of data. Data Speed : Consider an in...