DS LAB Manual (2) Final
DS LAB Manual (2) Final
EXPERIMENT: 1
Develop a Program in C for the following:
a. Declare a calendar as an array of 7 elements (A dynamically Created array) to
represent 7 days of a week. Each Element of the array is a structure having three fields.
The first field is the name of the Day (A dynamically allocated String), the second field
is the date of the Day (An integer), and the third field is the description of the activity
for a particular day (A dynamically allocated String).
b. Write functions create (), read () and display (); to create the calendar, to read the data
from the keyboard and to print weeks activity details report on screen.
Program Code:
#include<stdio.h>
#include<stdlib.h>
#include <string.h>
typedef struct {
char *name;
int date;
char *description;
} Day;
void create(Day *week, int size) {
for (int i = 0; i < size; i++) {
week[i].name = (char *)malloc(20 * sizeof(char));
week[i].description = (char *)malloc(100 * sizeof(char));
}
}
EXPERIMENT: 2
Design, develop and Implement a Program in C for the following operations on Strings
a. Read a main String (STR), a Pattern String (PAT) and a Replace String (REP)
b. Perform Pattern Matching Operation: Find and Replace all occurrences of PAT in STR
with REP if PAT exists in STR. Report suitable messages in case PAT does not exist in
STR.
c. Support the program with functions for each of the above operations. Don't use
Built-in functions.
PROGRAM CODE:
#include <stdio.h>
int findPattern(const char* str, const char* pat, int start) { int i, j;
for (i = start; str[i] != '\0'; i++) {
for (j = 0; pat[j] != '\0' && str[i + j] == pat[j]; j++); if (pat[j] == '\0')
return i;
}
return -1;
}
temp[j] = '\0';
for (i = 0; temp[i] != '\0'; i++) str[i] = temp[i]; str[i] = '\0';
i = pos + k;
} else break;
}
if (!found) {
printf("Pattern not found in the string.\n");
}
}
CASE 1:
CASE 2:
CASE 3:
Enter the main string (STR): Executing C Program Enter the pattern string (PAT): C++
Enter the replace string (REP): Python
Pattern not found in the string.
Modified String: Executing C Program
EXPERIMENT: 3
Design, Develop and Implement a menu driven Program in C for the following
operations on
STACK of Integers (Array Implementation of Stack with maximum size MAX)
a. Push an Element on to Stack
b. Pop an Element from Stack
c. Demonstrate how Stack can be used to check Palindrome
d. Demonstrate Overflow and Underflow situations on Stack
e. Display the status of Stack
f. Exit
Support the program with appropriate functions for each of the above operations
PROGRAM CODE:
#include <stdio.h>
#include <stdlib.h>
#define MAX 3
int arr[MAX],rev[MAX];
int top = -1;
int isFull() {
return (top == MAX -1)?1:0;
}
void push() {
int item;
if(isFull()){
printf("\nFull stack!\n");
return;
}
printf("Enter the Element to be Inserted\n");
scanf("%d",&item);
printf("\n%d pushed!\n",item); arr[++top]
= item;
}
int isEmpty() {
return (top == -1)?1:0;
}
printf("\n%d popped!\n",item);
}
void display(){
if(isEmpty()) {
printf("Empty stack!\n");
return;
}
else{
printf("\nStack Contents:\n");
for(int i=top;i>=0;i--){
printf("%d\t",arr[i]);
}
}
}
void pali()
{
int i=0,j=top, flag = 1;
if(top==-1){
printf("Push some elements into the stack first\n");
return;
}
else{
while(i<=top){
rev[j--]=arr[i++];
for(i=0;i<=top;i++){
if(arr[i]!=rev[i]){ flag
= 0;
}
}
}
if(flag){
for(i=0;i<=top;i++){
printf("%d\t",arr[i]);
}
printf("\nPalindrome\n");
}
else
printf("Not Palindrome\n");
switch(choice)
{
case 1: push(); break;
case 2: pop();
break;
case 3: pali();
break;
case 4: display();
break;
case 5: printf("\nProgram Ternminated\n");
exit(0);
2.Pop
3.Palindrome 4.Display
5.Exit
Enter your choice: 3 Not
Palindrome
-------- STACK OPERATIONS
1.Push
2.Pop
3.Palindrome
5.Exit
EXPERIMENT: 4
Design, Develop and Implement a Program in C for converting an Infix Expression to Postfix
Expression. Program should support for both parenthesized and free parenthesized expressions
with the operators: +, -, *, /, %( Remainder), ^ (Power) and alphanumeric operands.
PROGRAM CODE:
int i = 0, k = 0;
printf("\n\nRead the Infix Expression ? "); scanf("%s",
infx);
push('#');
while ((ch = infx[i++]) != '\0'){ if
(ch == '(')
push(ch);
else{ /* Operator */
while (pr(s[top]) >= pr(ch))
pofx[k++] = pop(); push(ch);
}
}
while (s[top] != '#') /* Pop from stack till empty */ pofx[k++]
= pop();
pofx[k] = '\0'; /* Make pofx as valid string */
printf("\n\nGiven Infix Expn: %s \nPostfix Expn: %s\n", infx, pofx);
}
Execution:
INPUT:
OUTPUT:
Design, Develop and Implement a Program in C for the following Stack Applications
a. Evaluation of Suffix expression with single digit operands and operators: +, -, *, /,
%, ^ b. Solving Tower of Hanoi problem with n disks
#include <stdio.h>
#include <math.h>
#define MAX 20
struct stack
{
int top;
float str[MAX];
}s; //stack
char postfix[MAX]; //postfix
void push(float);
float pop ();
int isoperand(char);
float operate(float,float,char);
int main()
{
int i=0;
printf("Enter Expression:");
scanf("%s",postfix);
float ans,op1,op2;
while(postfix[i]!='\0'){
if(isoperand(postfix[i]))
push(postfix[i]-48);
else {
op1=pop();
op2=pop();
ans=operate(op1,op2,postfix[i]);
push(ans);
printf("%f %c %f = %f\n",op2,postfix[i],op1,ans);
}
i++;
}
printf("%f",s.str[s.top]);
}
int isoperand(char x)
{
if(x>='0' && x<='9')
return 1;
return 0;
}
Prof.Seetha Das V, Assistant Professor CSE (ICSB) Page 12
PACE, Mangalore Data Structures Laboratory (BCSL305)
void push(float x)
{
if(s.top==MAX-1)
printf("Stack is full\nStack overflow\n");
else
{
s.top++;
s.str[s.top]=x;
}
}
float pop()
{
if(s.top==-1)
{
printf("Stack is emplty\nSTACK UNDERFLOW\n");
}
else{
s.top--;
return s.str[s.top+1];
}
}
Execution:
INPUT:
Enter Expression:231*+9-
OUTPUT:
3.000000 * 1.000000 = 3.000000
2.000000 + 3.000000 = 5.000000
5.000000 - 9.000000 = -4.000000
-4.000000
Prof.Seetha Das V, Assistant Professor CSE (ICSB) Page 13
PACE, Mangalore Data Structures Laboratory (BCSL305)
PROGRAM CODE: 5B
#include <stdio.h>
#include <math.h>
void tower(int n, char source, char temp,char destination)
{
if(n == 0)
return;
tower(n-1, source, destination, temp);
printf("\nMove disc %d from %c to %c", n, source, destination); tower(n-1, temp, source, destination); }
void main() {
int n;
printf("\nEnter the number of discs: \n");
scanf("%d", &n); tower(n, 'A', 'B', 'C');
printf("\n\nTotal Number of moves are: %d", (int)pow(2,n)-1);
}
Execution:
INPUT:
Enter the number of discs:
3
OUTPUT:
Move disc 1 from A to C
Move disc 2 from A to B
Move disc 1 from C to B
Move disc 3 from A to C
Move disc 1 from B to A
Move disc 2 from B to C
Move disc 1 from A to C
EXPERIMENT: 6
Design, Develop and Implement a menu driven Program in C for the following
operations on Circular QUEUE of Characters (Array Implementation of Queue with
maximum size MAX)
a. Insert an Element on to Circular QUEUE
b. Delete an Element from Circular QUEUE
c. Demonstrate Overflow and Underflow situations on Circular QUEUE
d. Display the status of Circular QUEUE
e. Exit
Support the program with appropriate functions for each of the above operations
PROGRAM CODE:
#include<stdio.h>
#include<stdlib.h>
#define SIZE 5
int CQ[SIZE];
int front=-1; int
rear=-1, ch;
int IsCQ_Full();
int IsCQ_Empty();
void CQ_Insert(int );
void CQ_Delet();
void CQ_Display();
void main()
{
while(1){
printf("1.Insert\n2.Delete\n3.Display\n4.Exit\n");
int ele;
printf("Enter your choice\n");
scanf("%d",&ch);
switch(ch){
case 1: if(IsCQ_Full())
printf("Circular Queue Overflow\n");
else{
printf("Enter the element to be inserted\n");
scanf("%d",&ele);
CQ_Insert(ele);
}
break;
case 2: if(IsCQ_Empty())
printf("Circular Queue Underflow\n");
else
CQ_Delet();
Prof.Seetha Das V, Assistant Professor CSE (ICSB) Page 15
PACE, Mangalore Data Structures Laboratory (BCSL305)
break;
case 3: if(IsCQ_Empty())
printf("Circular Queue Underflow\n");
else
CQ_Display();
break;
case 4: exit(0);
Page 18
}
}
}
void CQ_Insert(int item)
{
if(front==-1)
front++;
rear = (rear+1)%SIZE;
CQ[rear] =item;
}
void CQ_Delet()
{
int item;
item=CQ[front];
printf("Deleted element is: %d\n",item);
front = (front+1)%SIZE;
}
void CQ_Display()
{
int i;
if(front==-1)
printf("Circular Queue is Empty\n");
else{
printf("Elements of the circular queue are..\n");
i=front;
while(i!=rear){
printf("%d\t",CQ[i]);
i=(i+1)%SIZE;
}
printf("%d\n",CQ[i]);
}
}
int IsCQ_Full()
{
if(front ==(rear+1)%SIZE)
return 0;
}
Page 19
Execution:
1.Insert
2.Delete
3.Display
4.Exit
Enter your choice 3
Circular Queue Underflow
1.Insert
2.Delete
3.Display
4.Exit
Enter your choice 2
Circular Queue Underflow
1.Insert
2.Delete
3.Display
4.Exit
Enter your choice 1
Enter the element to be inserted
21
1.Insert
2.Delete
3.Display
4.Exit
Enter your choice 1
Enter the element to be inserted
45
1.Insert
2.Delete
3.Display
4.Exit
Enter your choice1
4.Exit
Enter your choice 3
Elements of the circular queue are..
21 45 97
Page 20
1.Insert
2.Delete
3.Display
4.Exit
Enter your choice
2
Deleted element is: 21
1.Insert
2.Delete
3.Display
4.Exit
Enter your choice
4
Program Terminated
EXPERIMENT 7
Develop a menu driven Program in C for the following operations on Singly Linked List
(SLL) of Student Data with the fields: USN, Name, Programme, Sem, PhNo.
a. Create a SLL of N Students Data by using front insertion.
b. Display the status of SLL and count the number of nodes in it
c. Perform Insertion / Deletion at End of SLL
d. Perform Insertion / Deletion at Front of SLL(Demonstration of stack)
e. Exit
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int count=0;
struct stud
{
long int ph;
int sem;
char name[15],usn[15],brnch[8];
struct stud *next;
};
printf("\nlist is empty\n");
}
else{
printf("student details are as follows:\n");
while(temp!=NULL){
printf("\n************** \n");
printf("NAME:%s\nUSN:%s\nBRANCH:%s\nSEM:%d\nPHONE NO.:%ld\n",temp-
>name,temp->usn,temp->brnch,temp->sem,temp->ph);
printf("\n*************** \n");
temp=temp->next;
}
printf("\nNo. of nodes=%d\n",count);
}
}
void insert_head(long int p,int s,char na[20],char u[20],char b[20])
{
newnode =(struct stud*)malloc(sizeof(struct stud));
newnode->ph=p;
newnode->sem=s;
strcpy(newnode->name,na);
strcpy(newnode->usn,u);
strcpy(newnode->brnch,b);
newnode->next=NULL;
count++;
if(head == NULL){
head = newnode;
return;
}
newnode->next = head;
head = newnode;
}
void insert_tail(long int p,int s,char na[20],char u[20],char b[20])
{
newnode =(struct stud*)malloc(sizeof(struct stud));
}
temp = head;
while(temp->next !=NULL)
temp = temp->next;
temp->next = newnode;
tail=temp;
}
void delete_head()
{
temp=head;
if(temp==NULL){
printf("list is empty\n");
return;
}
else{
head=head->next;
printf("deleted node is:\n");
printf(" \n");
printf("NAME:%s\nUSN:%s\nBRANCH:%s\nSEM:%d\nPHONE NO.:%ld\n",temp-
>name, temp->usn,temp->brnch,temp->sem,temp->ph);
printf(" \n");
free(temp);
count--;
}
}
void delete_tail()
{
if(head == NULL){
printf("List Empty\n");
return;
}
tail->next = NULL;
}
count--;
}
void main()
{
int choice,num,i;
long int ph;
int sem;
char name[20],usn[20],brnch[20];
while(1){
printf("--------MENU-----------\n");
printf("1.create\n2.Insert from head\n3.Insert from tail\n4.Delete from head\n5.Delete from
tail\n6.display\n7.exit\n");
printf(" \n");
printf("Enter your choice\n");
scanf("%d",&choice);
switch(choice){
case 1:
printf("\nEnter the Number of students\n");
scanf("%d",&num);
for(i=0;i<num;i++){
printf("Enter the %d Students name usn branch sem phno.respectively\n",i+1);
scanf("%s%s%s%d%ld",name,usn,brnch,&sem,&ph);
create(ph,sem,name,usn,brnch);
}
display();
break;
case 7: printf("Program Terminated\n");
exit(0);
default:printf("invalid option\n");
}
}
}
Execution:
dept-cse@deptcse-desktop:~$ ./a.out
--------MENU-----------
1.create
2.Insert from head
3.Insert from tail
4.Delete from head
5.Delete from tail
6.display
7.exit
***************
No. of nodes=1
Enter your choice
2
enter the name usn branch sem phno. of the student respectively
bob
78
is
5
98079866
Enter your choice
6
student details are as follows:
**************
NAME:bob
USN:78
BRANCH:is
SEM:5
PHONE NO.:98079866
***************
**************
NAME:adil
USN:32
BRANCH:cs
SEM:3
PHONE NO.:897987896
***************
**************
NAME:wilson
USN:99
BRANCH:me
SEM:7
PHONE NO.:9866755555
***************
No. of nodes=3
NAME:bob
USN:78
BRANCH:is
SEM:5
PHONE NO.:98079866
EXPERIMENT: 8
Develop a menu driven Program in C for the following operations on Doubly Linked List (DLL) of
Employee Data with the fields: SSN, Name, Dept, Designation, Sal, PhNo
f. Exit
Program:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Employee Structure
typedef struct Employee {
char ssn[20];
char name[100];
char dept[50];
char designation[50];
double sal;
char phNo[15];
struct Employee *prev, *next;
} Employee;
// Function Declarations
Employee* createEmployee();
Employee* insertAtEnd(Employee* head);
void display(Employee* head);
int countNodes(Employee* head);
Employee* deleteAtEnd(Employee* head);
Employee* insertAtFront(Employee* head);
Employee* deleteAtFront(Employee* head);
// Main Function
int main() {
Employee *head = NULL;
int choice, count;
while(1) {
printf("\nMenu:\n");
printf("1. Insert Employee at End\n");
scanf("%d", &choice);
switch(choice) {
case 1: head = insertAtEnd(head); break;
case 2: display(head); break;
case 3: count = countNodes(head);
printf("Total number of employees: %d\n", count);
break;
case 4: head = deleteAtEnd(head); break;
case 5: head = insertAtFront(head); break;
case 6: head = deleteAtFront(head); break;
case 7: exit(0);
default: printf("Invalid choice!\n");
}
}
return 0;
}
// Function Definitions
Employee* createEmployee() {
Employee *newNode = (Employee*)malloc(sizeof(Employee));
printf("Enter SSN: ");
scanf("%s", newNode->ssn);
printf("Enter Name: ");
scanf("%s", newNode->name); // Use fgets for multi-word names
printf("Enter Department: ");
scanf("%s", newNode->dept);
printf("Enter Designation: ");
scanf("%s", newNode->designation);
printf("Enter Salary: ");
scanf("%lf", &newNode->sal);
printf("Enter Phone Number: ");
scanf("%s", newNode->phNo);
newNode->prev = NULL;
newNode->next = NULL;
return newNode;
}
Employee* insertAtEnd(Employee* head) {
Employee *newNode = createEmployee();
if (head == NULL) {
if (head == NULL) {
printf("List is empty!\n");
return;
}
while (temp != NULL) {
printf("SSN: %s, Name: %s, Dept: %s, Designation: %s, Salary: %.2f, Phone No: %s\n",
temp->ssn, temp->name, temp->dept, temp->designation, temp->sal, temp->phNo);
temp = temp->next;
}
}
int countNodes(Employee* head) {
int count = 0;
Employee *temp = head;
while (temp != NULL) {
count++;
temp = temp->next;
}
return count;
}
Employee* deleteAtEnd(Employee* head) {
if (head == NULL) {
printf("List is already empty!\n");
return NULL;
} else if (head->next == NULL) {
free(head);
return NULL;
} else {
Employee *temp = head;
while (temp->next != NULL) {
Execution
Menu:
1. Insert Employee at End
2. Display Employees
3. Count Employees
4. Delete Employee at End
5. Insert Employee at Front
6. Delete Employee at Front
7. Exit
Enter your choice: 1
Enter SSN: 123
7. Exit
Enter your choice: 2
SSN: 123, Name: Rahul, Dept: Finance, Designation: Manager, Salary: 45000.00, Phone No: 87636
SSN: 124, Name: Arun, Dept: HR, Designation: Engineer, Salary: 30000.00, Phone No: 12345
Menu:
1. Insert Employee at End
2. Display Employees
3. Count Employees
4. Delete Employee at End
5. Insert Employee at Front
6. Delete Employee at Front
7. Exit
Enter your choice: 3
Total number of employees: 2
Menu:
1. Insert Employee at End
2. Display Employees
2. Display Employees
3. Count Employees
4. Delete Employee at End
5. Insert Employee at Front
6. Delete Employee at Front
7. Exit
Enter your choice: 5
Enter SSN: 134
Enter Name: krish
Enter Department: finace
Enter Designation: Accountant
Enter Salary: 20000
Enter Phone Number: 1234
Menu:
1. Insert Employee at End
2. Display Employees
3. Count Employees
4. Delete Employee at End
5. Insert Employee at Front
6. Delete Employee at Front
7. Exit
Enter your choice: 2
SSN: 134, Name: krish, Dept: finace, Designation: Accountant, Salary: 20000.00, Phone No: 1234
SSN: 123, Name: Rahul, Dept: Finance, Designation: Manager, Salary: 45000.00, Phone No: 87636
Menu:
1. Insert Employee at End
EXPERIMENT: 9
Develop a Program in C for the following operations on Singly Circular Linked List (SCLL) with
header nodes
g. Represent and Evaluate a Polynomial P(x,y,z) = 6x^2 y^2 z - 4yz^5 +3x^3 yz+2xy^5 z - 2xyz^3
h. Find the sum of two polynomials POLY1(x,y,z) and POLY2(x,y,z) and store the result in
POLYSUM(x,y,z)
Support the program with appropriate functions for each of the above operations
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
newTerm->next = *head;
} else {
int main() {
Term *poly1 = NULL, *poly2 = NULL, *polySum = NULL;
int coeff, xExp, yExp, zExp;
int n, i;
double x, y, z, result;
// Evaluate POLY1
printf("Enter values for x, y, and z to evaluate POLY1: ");
scanf("%lf %lf %lf", &x, &y, &z);
// Display POLYSUM
printf("POLYSUM(x, y, z) = ");
Term *temp = polySum;
if (temp != NULL) {
do {
printf("%+dx^%dy^%dz ", temp->coeff, temp->xExp, temp->yExp, temp->zExp);
temp = temp->next;
return 0;
}
Execution
Program Terminated
EXPERIMENT: 10
Develop a menu driven Program in C for the following operations on Binary Search Tree (BST)
of Integers.
i. Create a BST of N Integers: 6, 9, 5, 2, 8, 15, 24, 14, 7, 8, 5, 2
k. Search the BST for a given element (KEY) and report the appropriate message
l. Exit
Program code :
#include <stdio.h>
#include <stdlib.h>
// Define a structure for BST nodes
struct BSTNode {
int data;
struct BSTNode *left, *right;
};
// Function to create a new BST node
struct BSTNode* newNode(int item) {
struct BSTNode* temp = (struct BSTNode*)malloc(sizeof(struct BSTNode));
temp->data = item;
temp->left = temp->right = NULL;
return temp;
}
// Function to insert a new node with a given key in the BST
struct BSTNode* insert(struct BSTNode* node, int key) {
// If the tree is empty, return a new node
if (node == NULL) return newNode(key);
// Otherwise, recur down the tree
if (key < node->data)
node->left = insert(node->left, key);
else if (key > node->data)
node->right = insert(node->right, key);
// return the (unchanged) node pointer
return node;
}
// Inorder traversal of BST
// Creating BST
for(int i = 0; i < n; i++) {
root = insert(root, data[i]);
}
do {
printf("\nMenu\n");
printf("1. Display Inorder\n");
printf("2. Display Preorder\n");
printf("3. Display Postorder\n");
printf("4. Search\n");
printf("5. Exit\n");
printf("Enter your choice: ");
scanf("%d", &choice);
switch(choice) {
case 1:
printf("Inorder traversal: ");
inorder(root);
break;
case 2:
printf("Preorder traversal: ");
preorder(root);
break;
case 3:
printf("Postorder traversal: ");
postorder(root);
break;
case 4:
printf("Enter the element to search: ");
scanf("%d", &key);
if (search(root, key) != NULL)
printf("Element found\n");
else
printf("Element not found\n");
break;
case 5:
printf("Exiting...\n");
break;
default:
printf("Invalid choice\n");
}
} while (choice != 5);
return 0;
}
Output :
Menu
1. Display Inorder
2. Display Preorder
3. Display Postorder
4. Search
5. Exit
Enter your choice: 1
Inorder traversal: 2 5 6 7 8 9 14 15 24
Menu
1. Display Inorder
2. Display Preorder
3. Display Postorder
4. Search
5. Exit
Enter your choice: 2
Preorder traversal: 6 5 2 9 8 7 15 14 24
Menu
1. Display Inorder
2. Display Preorder
3. Display Postorder
4. Search
5. Exit
Enter your choice: 3
Postorder traversal: 2 5 7 8 14 24 15 9 6
Menu
1. Display Inorder
2. Display Preorder
3. Display Postorder
4. Search
5. Exit
Enter your choice: 4
Enter the element to search: 8
Element found
Menu
1. Display Inorder
2. Display Preorder
3. Display Postorder
4. Search
5. Exit
Enter your choice: 5
Exiting...
EXPERIMENT: 11
Develop a Program in C for the following operations on Graph(G) of Cities
n. Print all the nodes reachable from a given starting node in a digraph using DFS/BFS
method
#include <stdio.h>
#include <stdlib.h>
// Global Variables
int adjMatrix[MAX][MAX]; // Adjacency matrix to store the graph
int visited[MAX]; // Array to keep track of visited cities
int n; // Number of cities
// DFS function
void DFS(int city) {
int i;
// BFS function
void BFS(int startCity) {
int queue[MAX], front = 0, rear = -1, i;
visited[startCity] = 1;
queue[++rear] = startCity;
// Main function
int main() {
int choice, startCity;
createGraph();
printf("Enter the starting city number between 0 and %d: ", n-1);
scanf("%d", &startCity);
if (choice == 1) {
printf("Cities reachable from city %d using DFS:\n", startCity);
DFS(startCity);
} else if (choice == 2) {
printf("Cities reachable from city %d using BFS:\n", startCity);
BFS(startCity);
} else {
printf("Invalid choice!\n");
}
return 0;
}
EXPERIMENT: 12
Given a File of N employee records with a set K of Keys (4-digit) which uniquely determine the
records in file F. Assume that file F is maintained in memory by a Hash Table (HT) of m memory
locations with L as the set of memory addresses (2-digit) of locations in HT. Let the keys in K and
addresses in L are Integers. Develop a Program in C that uses Hash function H: K →L as H(K)=K
mod m (remainder method), and implement hashing technique to map a given key K to the address
space L. Resolve the collision (if any) using linear probing.
#include <stdio.h>
#include <stdlib.h>
#define MAX 100
int create(int);
void display (int[]);
int main()
do{
display(a);
printf("\nProgram Terminated\n");
return 0;
}
int key;
key=num%100;
return key;
}
else{
printf("\nCollision Detected...!!!\n");
for(i=key; i!=(key-1); i=(i+1)%MAX) {
count++;
if(a[i] == -1){ a[i]
= num;
flag =1;
int i,choice;
else{
Execution
Collision Detected...!!!
Collision Detected...!!!
Collision Detected...!!!
Collision Detected...!!!
Collision Detected...!!!
1. Display ALL
2. Filtered Display
2
0 8899
1 3200
2 4301
66 6666
67 5667
68 3266
98 7898
99 5698
Program Terminated