DSA Manual Updated
DSA Manual Updated
INSTITUTEOFTECHNOLOGY &
SCIENCE
INDORE-452003
(ANAUTONOMOUS INSTITUTE, ESTABLISHED IN1952)
LABORATORY JOURNAL
B.Tech. III YEAR
Mission
To generate experts in Science & Technology akin to society for its accelerated socio-
economic growth in professional and challenging environment,imparting human values.
Mission
To produce higher levels of human resources in the field of Electrical Engineering for
Nation’s accelerated socio-economical and technological growth in emerging areas of
human endeavour
Program Educational Objectives(PEOs)
PEO_1:To impart core knowledge of Electrical Engineering for technical careers.
PEO_2:To teach the advanced aspects of Electrical systems along with its design,
simulation and fabrication together with good communication skills.
PEO_3:To motivate students for higher studies in Electrical Engineering so as to develop high
vision in the technical career.
PSO#2: Apply the appropriate techniques and modern engineering tools to design and
develop complex electrical engineering projects, adapt in multi-disciplinary
environments and engage in life-long learning.
PSO#3: Propose & implement engineering solutions in the context of environment, society,
economy, professional ethics and have good communication skills.
Programme Outcomes(POs)
PO#2: Problem analysis: Identify, formulate, review research literature, and analyze
complex engineering problems reaching substantiated conclusions using first
principles of mathematics, natural sciences, and engineering sciences.
PO#5: Modern tool usage: Create, select, and apply appropriate techniques, resources, and
modern engineering and IT tools including prediction and modeling to complex
engineering activities with an understanding of the limitations.
PO#6:The engineer and society: Apply reasoning informed by the contextual knowledge to
assess societal, health, safety, legal and cultural issues and the consequent
responsibilities relevant to the professional engineering practice.
PO#8: Ethics: Apply ethical principles and commit to professional ethics and
responsibilities and norms of the engineering practice.
PO#12 :Life-long learning: Recognize the need for, and have the preparation and ability to
engage in independent and life-long learning in the broadest context of technological
change. s
OBJECTIVES: The Data Structure and Embedded System Programming Concept Laboratory is
designed:
LABORATORYOUTCOMES:
ASSESSMENT:
A. Continuous evaluation of laboratory journals with a weight-age of 40%. It includes
lab attendance as well as experiments performed in the lab.
B.Theend-termpracticalexaminationweight-ageis60%.
CO-POMAPPING:
CO’s PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12
CO1 1 1 3 2 2
CO2 3 1 2 2 3 2 2
CO3 1 3 3 3 2 2 2
CO4 3 3 3 2 2 2 2 2 2 2
CO5 3 3 3 3 3 2 2 3 2 1 3 3
CONTENTS
CO’S
Page
S.No Name of Experiment no
1 Programming Assignment
a) Find string length b) Reverse string with stack and without
stack C) Concatenate two strings d) String matching using
string library.
Tools Used:
Program
Code:
#include <stdio.h>
int main(){
printf("HelloWorld!\n”);
return 0;
}
Experimental Result:
Department of Electrical Engineering
EE32606: DATA STRUCTURE AND EMBEDDED SYSTEM
PROGRAMMING CONCEPT
Experiment No- 02
Tools Used:
Program
Code:
#include <stdio.h>
#include<math.h>
int main()
if (a==0) {
return 0;
D = ((b*b) - 4*a*c);
if (D >0) {
printf("Two distinct real roots are : %lf and %lf \n", root1, root2);
else if (D==0) {
root1 = -b/(2*a);
root2= (-b)/(2*a);
else{
printf(" Equation have complex roots: %lf + i%lf \n", real, imagenary);
printf(" Equation have complex roots: %lf - i%lf \n", real, imagenary);
return 0;
}
Experimental Result:
Department of Electrical Engineering
EE32606: DATA STRUCTURE AND EMBEDDED SYSTEM
PROGRAMMING CONCEPT
Experiment No- 03
Tools Used:
Program
Code:
#include<stdio.h>
void fibonacci(int x) {
next = t1 + t2;
t1 = t2;
t2 = next;
printf("\n");
int main() {
int n;
else{
fibonacci(n);
return 0;
}
Experimental Result:
Department of Electrical Engineering
EE32606: DATA STRUCTURE AND EMBEDDED SYSTEM
PROGRAMMING CONCEPT
Experiment No- 04
#include <stdio.h>
int main() {
int n1, n2;
printf("Enter two numbers: ");
scanf("%d %d", &n1, &n2);
return 0;
}
Experimental Result:
Department of Electrical Engineering
EE32606: DATA STRUCTURE AND EMBEDDED SYSTEM
PROGRAMMING CONCEPT
Experiment No- 05
int main() {
int n;
printf("Enter a positive integer: \n");
}
else{
fibonacci(n);
}
return 0;
}
Experimental Result:
Department of Electrical Engineering
EE32606: DATA STRUCTURE AND EMBEDDED SYSTEM
PROGRAMMING CONCEPT
Experiment No- 06
typedef struct {
double real;
double imag;
} Complex;
int main() {
Complex num1, num2, result;
int choice;
printf("Complex number calculator \n");
printf("Enter the first complex number: ");
scanf("%lf %lf", &num1.real, &num1.imag);
switch (choice) {
case 1:
result = addComplex(num1, num2);
printf("\nResult:");
printComplex(result);
break;
case 2:
result = substractComplex(num1, num2);
printf("\nResult:");
printComplex(result);
break;
case 3:
result = multiplyComplex(num1, num2);
printf("\nResult:");
printComplex(result);
break;
case 4:
result = divideComplex(num1, num2);
if (result.real !=0 || result.imag != 0) {
printf("\nResult:");
printComplex(result);
}
break;
default:
printf("Invalid Choice! \n");
}
return 0;
}
Experimental Result:
Department of Electrical Engineering
EE32606: DATA STRUCTURE AND EMBEDDED SYSTEM
PROGRAMMING CONCEPT
Experiment No- 07
Objective: Write a C program for string multiplication and also perform following string
operations:
a) Find string length b) Reverse string with stack and without stack C) Concatenate two
strings d) String matching using string library.
Tools Used:
Program Code:
Experimental Result:
Department of Electrical Engineering
EE32606: DATA STRUCTURE AND EMBEDDED SYSTEM
PROGRAMMING CONCEPT
Experiment No- 08
Objective: Write a C program for insertion and deletion of node at the beginning in the link list.
Tools Used:
Program Code:
#include <stdio.h>
#include <stdlib.h>
struct Node {
int data;
struct Node* next;
};
void insertAtBeginning(struct Node** head_ref, int new_data) {
if (new_node == NULL) {
printf("Memory allocation failed!\n");
return;
}
new_node->data = new_data;
new_node->next = *head_ref;
*head_ref = new_node;
int main() {
struct Node* head = NULL; // Initialize empty list
int choice, value;
while(1) {
printf("\n--- Linked List Operations ---\n");
printf("1. Insert at beginning\n");
printf("2. Delete from beginning\n");
printf("3. Display list\n");
printf("4. Exit\n");
printf("Enter your choice: ");
scanf("%d", &choice);
switch(choice) {
case 1:
printf("Enter value to insert: ");
scanf("%d", &value);
insertAtBeginning(&head, value);
break;
case 2:
deleteAtBeginning(&head);
break;
case 3:
displayList(head);
break;
case 4:
printf("Exiting program...\n");
exit(0);
default:
printf("Invalid choice! Please try again.\n");
}
}
return 0; }
Experimental Result:
Department of Electrical Engineering
EE32606: DATA STRUCTURE AND EMBEDDED SYSTEM
PROGRAMMING CONCEPT
Experiment No- 09
Objective: Write a C program for insertion and deletion of node at specific position in the link list.
Tools Used:
Program Code:
Experimental Result:
Department of Electrical Engineering
EE32606: DATA STRUCTURE AND EMBEDDED SYSTEM
PROGRAMMING CONCEPT
Experiment No- 10
Objective: Write a C program for insertion and deletion of node at the end in the link list.
Tools Used:
Program Code:
Experimental Result:
Department of Electrical Engineering
EE32606: DATA STRUCTURE AND EMBEDDED SYSTEM
PROGRAMMING CONCEPT
Experiment No- 11
Objective: Write a program in C for implementation of stacks using Linked lists and array.
Tools Used:
Program Code:
Experimental Result:
Department of Electrical Engineering
EE32606: DATA STRUCTURE AND EMBEDDED SYSTEM
PROGRAMMING CONCEPT
Experiment No- 12
Objective: Write a program in C for implementation of queue using Linked lists and array.
Tools Used:
Program Code:
Experimental Result:
Department of Electrical Engineering
EE32606: DATA STRUCTURE AND EMBEDDED SYSTEM
PROGRAMMING CONCEPT
Experiment No- 13
Objective: Write a program in C for selection sort a) Specific position b) Specific at sorted order.
Tools Used:
Program Code:
Experimental Result:
Department of Electrical Engineering
EE32606: DATA STRUCTURE AND EMBEDDED SYSTEM
PROGRAMMING CONCEPT
Experiment No- 16