Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

Data structure (module 2)

Rating
-
Sold
-
Pages
19
Uploaded on
30-01-2025
Written in
2024/2025

These are cls notes,these are easy to study

Institution
Course

Content preview

MODULE II
1. Write a c program to perform insertion, deletion and display operation on queue(10)
(OR) Define queue. Write Qinsert and Qdelete procedures for queues using arrays(10)
2. Write short note on dequeue and priority queue(5)
3. Write a function CQinsert() and CQdelete() operation on circular queue(8)
4. What is linked list. List and explain the different types of linked list with examples(8)
5. Write a c function for the following operations on linked list(12)
a. Insertion at the beginning
b. Insertion at the end
c. Deletion at the beginning
d. Deletion at the end
(OR) Write the following algorithms for singly linked list:
e. Inserting ITEM as the first node in the list
f. Deleting the last node in the list
6. Define Ackerman function recursively and evaluate A(3,0). Also, develop c code for the
same (7)
7. Differentiate single(SLL) and Doubly(DLL) linked list(4)
8. Write the function for: i) finding the length of the list ii) concatenation two list iii)
Reverse the list (10)
9. Write a c function for the following operations on Circular linked list(12)
a. Insertion at the beginning
b. Insertion at the end
c. Deletion at the beginning
d. Deletion at the end
(OR) Write a c function to insert a node at front and delete a node from the rear end in a
circularly linked list(8)
10. What is recursion? Write the recursive procedure for
a. Finding GCD of two numbers
b. To find n fibonacci number
c. Factorial of a number
11. Write and explain how do you implement the operations of stack using singly linked
list(SLL) with the help of C-statement(10)
12. Write a node structure for the linked representation of a polynomial. Explain the
algorithm to add two polynomials represented using linked list(8)
13. Write a C function to add two polynomials represented as circular list with header
node(8)

,1. Write a c program to perform insertion, deletion and display operation on queue(10)
(OR)Define queue. Write Qinsert and Qdelete procedures for queues using arrays(10)
 C Program
#include<conio.h>
#include<stdio.h>
#include<process.h>
#define MAX 50
int queue_arr[MAX];
int rear = –1;
int front = –1;
void insert ()
{
int added_item;
if (rear==MAX-1)
{
printf("\nQueue Overflow\n");
getch();
return;
}
else
{
if (front==–1)
front=0;
printf(“\nInput the element for adding in queue: ”);
scanf(“%d”, &added_item);
rear=rear+1;
queue_arr[rear] = added_item ;
}
}
void del()
{
if (front == –1 || front > rear)
{
printf ("\nQueue Underflow\n");
return;
}
else
{
printf ("\nElement deleted from queue is : %d\n",queue_arr[front]);
front=front+1;
}
}

void display()
{
int i;

, if (front == –1 || front > rear)
{
printf (“\nQueue is empty\n”);
return;
}
else
{
printf(“\nQueue is :\n”);
for(i=front;i<= rear;i++)
printf(“%d ”,queue_arr[i]);
printf(“\n”);
}
}

void main()
{
int choice;
while (1)
{
clrscr();
printf(“\n1.Insert\n”);
printf(“2.Delete\n”);
printf(“3.Display\n”);
printf(“4.Quit\n”);
printf(“\nEnter your choice:”);
scanf(“%d”, & choice);
switch(choice)
{
case 1 :
insert(); break;
case 2:
del();
getch(); break;
case 3:
display();
getch(); break;
case 4:
exit(1);
default:
printf (“\n Wrong choice\n”);
getch();
}
}
}
2. Write short note on dequeue and priority queue(5)

Written for

Institution
Course

Document information

Uploaded on
January 30, 2025
Number of pages
19
Written in
2024/2025
Type
Class notes
Professor(s)
Santosh
Contains
Data structure

Subjects

$8.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
supriyadhonedhone

Also available in package deal

Get to know the seller

Seller avatar
supriyadhonedhone Guru nanak dev engineering College,bidar
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 year
Number of followers
0
Documents
5
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions