FirstRanker Logo

FirstRanker.com - FirstRanker's Choice is a hub of Question Papers & Study Materials for B-Tech, B.E, M-Tech, MCA, M.Sc, MBBS, BDS, MBA, B.Sc, Degree, B.Sc Nursing, B-Pharmacy, D-Pharmacy, MD, Medical, Dental, Engineering students. All services of FirstRanker.com are FREE

📱

Get the MBBS Question Bank Android App

Access previous years' papers, solved question papers, notes, and more on the go!

Install From Play Store

Download Anna University B-Tech ECE 3rd Sem EC8381 Fundamentals of Data Structures in C FDSC Lab Manual Question Paper

Download Anna University B.Tech (Bachelor of Technology) ECE (Electronics And Communications Engineering) 3rd Sem EC8381 Fundamentals of Data Structures in C FDSC Lab Manual Question Paper.

This post was last modified on 13 December 2019

Anna University B.Tech Lab Manual


FirstRanker.com

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

EC8381 - FUNDAMENTALS OF DATA STRUCTURES IN C

--- Content provided by⁠ FirstRanker.com ---

III SEMESTER - R 2017

LABORATORY MANUAL

Name :

Register No. :

Section :

--- Content provided by‌ FirstRanker.com ---

FirstRanker.com

VISION

is committed to provide highly disciplined, conscientious and enterprising professionals conforming to global standards through value based quality education and training.

MISSION

  • To provide competent technical manpower capable of meeting requirements of the industry
  • --- Content provided by​ FirstRanker.com ---

  • To contribute to the promotion of Academic Excellence in pursuit of Technical Education at different levels
  • To train the students to sell his brawn and brain to the highest bidder but to never put a price tag on heart and soul

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

VISION

To impart professional education integrated with human values to the younger generation, so as to shape them as proficient and dedicated engineers, capable of providing comprehensive solutions to the challenges in deploying technology for the service of humanity

--- Content provided by FirstRanker.com ---

MISSION

  • To educate the students with the state-of-art technologies to meet the growing challenges of the electronics industry
  • To carry out research through continuous interaction with research institutes and industry, on advances in communication systems
  • To provide the students with strong ground rules to facilitate them for systematic learning, innovation and ethical practices

FirstRanker.com

--- Content provided by⁠ FirstRanker.com ---

PROGRAMME EDUCATIONAL OBJECTIVES (PEOS)

  1. Fundamentals

    To impart students with fundamental knowledge in Mathematics, Science and fundamentals of Engineering that will would them to be successful professionals

  2. Core Competence

    To provide students with sound knowledge in engineering and experimental skills to identify complex software problems in industry and to develop practical solution for them

  3. --- Content provided by FirstRanker.com ---

  4. Breadth

    To provide relevant training and experience to bridge the gap between theory and practice this enables to find solutions for real time problem in industry and organization and to design products requiring interdisciplinary skills

  5. Professionalism skills

    To bestow students with adequate training and provide opportunities to work as team that will build up their communication skills, individual leadership and supportive qualities and to develop them to adapt and work in ever changing technologies

  6. Lifelong Learning

    To develop the ability of students to establish themselves as professionals in Computer Science and Engineering and to create awareness about the need for lifelong learning and pursuing advanced degrees

    --- Content provided by⁠ FirstRanker.com ---

FirstRanker.com

PROGRAMME OUTCOMES (POS)

  1. To apply basic knowledge of Mathematics, Science and engineering fundamentals in Computer Science and Engineering field
  2. To design and conduct experiments as well as to analyze and interpret and apply the same in the career
  3. --- Content provided by​ FirstRanker.com ---

  4. To design and develop innovative and creative software applications
  5. To understand a complex real world problems and develop an efficient practical solutions
  6. To create, select and apply appropriate technique, resources, modern engineering and IT tools
  7. To understand their roles as professionals and give the best to the society
  8. To develop a system that will meet expected need with realistic constraints such as economical, environmental, social, political, ethical, safe and sustainable
  9. --- Content provided by‌ FirstRanker.com ---

  10. To communicate effectively and make others understand exactly what they are trying to convey in both verbal and written forms
  11. To engage lifelong learning and exhibit their technical skills
  12. To develop and manage projects in multidisciplinary environments

FirstRanker.com

EC8381 - FUNDAMENTALS OF DATA STRUCTURES IN C SYLLABUS

--- Content provided by FirstRanker.com ---

COURSE OBJECTIVES

  • To understand and implement basic data structures using C
  • To apply linear and non-linear data structures in problem solving.
  • To learn to implement functions and recursive functions by means of data structures
  • To implement searching and sorting algorithms
  • --- Content provided by‌ FirstRanker.com ---

LIST OF EXPERIMENTS:

  1. Basic C Programs – looping, data manipulations, arrays
  2. Programs using strings – string function implementation
  3. Programs using structures and pointers
  4. Programs involving dynamic memory allocations
  5. --- Content provided by‌ FirstRanker.com ---

  6. Array implementation of stacks and queues
  7. Linked list implementation of stacks and queues
  8. Application of Stacks and Queues
  9. Implementation of Trees, Tree Traversals
  10. Implementation of Binary Search trees
  11. --- Content provided by⁠ FirstRanker.com ---

  12. Implementation of Linear search and binary search
  13. Implementation Insertion sort, Bubble sort, Quick sort and Merge Sort
  14. Implementation Hash functions, collision resolution technique

FirstRanker.com

COURSE OUTCOMES

--- Content provided by‍ FirstRanker.com ---

  • To Write basic and advanced programs in c.
  • To Implement functions and recursive functions in c.
  • To Implement data structures using c.
  • To choose appropriate sorting algorithm for an application and implement it in a modularized way.

FirstRanker.com

--- Content provided by⁠ FirstRanker.com ---

FirstRanker.com

EC8381 - FUNDAMENTALS OF DATA STRUCTURES IN C SYLLABUS

CONTENTS

Sl. No. Name of the Experiment Page No.
1 Basic C Programs – looping, data manipulations, arrays 7
2 Programs using strings – string function implementation 13
3 Programs using structures and pointers 15
4 Programs involving dynamic memory allocations 20
5 Array implementation of stacks and queues 22
6 Linked list implementation of stacks and queues 29
7 Application of Stacks and Queues 35
8 Implementation of Trees, Tree Traversals 39
9 Implementation of Binary Search trees 41
10 Implementation of Linear search and binary search 46
11 Implementation Insertion sort, Bubble sort, Quick sort and Merge Sort 50
12 Implementation Hash functions, collision resolution technique 58

FirstRanker.com

FirstRanker.com

--- Content provided by⁠ FirstRanker.com ---

EXPT. NO. 1a BASIC C PROGRAM – LOOPING

Aim:

To write a C program to calculate the sum of first n natural numbers using for loop statements

Software requirements:

C compiler

--- Content provided by⁠ FirstRanker.com ---

Hardware requirements:

Server with supporting 30 terminals

Algorithm :

  1. Start the program.
  2. Read the variables.
  3. --- Content provided by⁠ FirstRanker.com ---

  4. The initialization statement is executed.
  5. The test expression is evaluated, if it is false for loop is terminated, test expression is true (nonzero), codes inside the body of loop is executed and the update expression is updated.
  6. This process repeats until the test expression is false.
  7. Stop the program.

FirstRanker.com

--- Content provided by FirstRanker.com ---

FirstRanker.com

Output

Enter a positive integer: 10

Sum = 55

Result:

--- Content provided by‍ FirstRanker.com ---

Thus the program to find the sum of n natural numbers was executed successfully.

FirstRanker.com

FirstRanker.com

EXP 1 b. BASIC C PROGRAM – DATA MANIPULATIONS

Aim:

--- Content provided by FirstRanker.com ---

To write a C program for data manipulations using the bitwise operators

Software requirements:

C compiler

Hardware requirements:

Server with supporting 30 terminals

--- Content provided by‍ FirstRanker.com ---

Algorithm :

  1. Start the program.
  2. Declare the variables.
  3. Use the required bitwise operators for the given input.
  4. Display the result.
  5. --- Content provided by‌ FirstRanker.com ---

  6. Stop the program.

FirstRanker.com

FirstRanker.com

Sample Output :

A = 10

--- Content provided by‌ FirstRanker.com ---

B = 25

Bitwise AND operator & = 8

A = 10

B = 25

Bitwise OR operator | = 29

--- Content provided by⁠ FirstRanker.com ---

A= 10

B = 25

Bitwise XOR (exclusive OR) operator ^ = 21

complement = ~35

complement = ~-12

--- Content provided by⁠ FirstRanker.com ---

complement = -36

Output = 11

Shift Operator (>> and <<)

Num = 212

Right Shift by 0: 212

--- Content provided by FirstRanker.com ---

Right Shift by 1: 106

Right Shift by 2: 53

Left Shift by 0: 212

Left Shift by 1: 424

Left Shift by 2: 848

--- Content provided by​ FirstRanker.com ---

Result:

Thus the program for data manipulations using the bitwise operators is executed successfully.

FirstRanker.com

FirstRanker.com

EXP 1 c BASIC C PROGRAM – ARRAYS

--- Content provided by FirstRanker.com ---

Aim:

To write a C program using Arrays

Software requirements:

C compiler

Hardware requirements:

--- Content provided by FirstRanker.com ---

Server with supporting 30 terminals

Algorithm :

  1. Start the program.
  2. Declare the array and the variables required for the program.
  3. Get the values.
  4. --- Content provided by‌ FirstRanker.com ---

  5. Perform the operation based on the program inputs.
  6. Display the output.
  7. Stop the program.

FirstRanker.com

FirstRanker.com

--- Content provided by FirstRanker.com ---

Sample Output :

Enter n: 5

Enter number1: 45

Enter number2: 35

Enter number3: 38

--- Content provided by FirstRanker.com ---

Enter number4: 31

Enter number5: 49

Average = 39

Result:

Thus the program using arrays is executed successfully.

--- Content provided by FirstRanker.com ---

Outcome:

Thus the basic c programs for looping, Data manipulations and arrays is attained.

  • C language is used to creating computer application
  • Used in writing embedded software
  • Firmware for various electronics ,industrial product which uses micro controller
  • --- Content provided by FirstRanker.com ---

  • Developing verifications of software code,simulator.

VIVA - VOCE

  1. What is Decision making and Branching?
  2. What are all the different types of control flow statements?
  3. Mention the different types of looping statements.
  4. --- Content provided by FirstRanker.com ---

  5. What is the difference between while and do while loop statement?
  6. What is an operator?
  7. Mention the bitwise operators.
  8. What is an array ?
  9. What is the use of array?
  10. --- Content provided by‌ FirstRanker.com ---

  11. What is multi dimensional array ?
  12. How to access the elements in the array.

FirstRanker.com

FirstRanker.com

EXP NO 2: PROGRAMS USING STRINGS FUNCTION

--- Content provided by‌ FirstRanker.com ---

AIM:

To write a c program to perform string manipulation function.

Software requirements:

C compiler

Hardware requirements:

--- Content provided by​ FirstRanker.com ---

Server with supporting 30 terminals

Algorithm :

  1. Start the program.
  2. Declare the variables.
  3. Get the string by using gets() function.
  4. --- Content provided by FirstRanker.com ---

  5. Call the required string manipulation function.
  6. Display the results by using the puts() function.

FirstRanker.com

FirstRanker.com

Sample Output :

--- Content provided by⁠ FirstRanker.com ---

Enter string: String

Length of string = 6

Result:

Thus the program for string manipulation is executed successfully.

Outcome:

--- Content provided by​ FirstRanker.com ---

Thus the programs using strings- string function implementation is attained.

Applications:

  • String are used in spell checker, spam filter, intrusion detection

VIVA - VOCE

  1. What is a function ?
  2. --- Content provided by FirstRanker.com ---

  3. Mention the types of function.
  4. What is a character?
  5. What is a string ?
  6. Difference between character and string.
  7. What are the different types of string handling functions are available.
  8. --- Content provided by⁠ FirstRanker.com ---

  9. Which header file is to be included while using the string functions.
  10. How to declare a string and character

FirstRanker.com

FirstRanker.com

EXP NO 3 a: PROGRAMS USING POINTERS

--- Content provided by​ FirstRanker.com ---

Aim:

To write a c program to perform swapping operation using pointers.

Software requirements:

C compiler

Hardware requirements:

--- Content provided by​ FirstRanker.com ---

Server with supporting 30 terminals

Algorithm :

  1. Start the program.
  2. Declare the pointer variables.
  3. Initialise the pointer variable with an appropriate address.
  4. --- Content provided by​ FirstRanker.com ---

  5. If the content of the address stored in the pointer is required, the indirection operator* is used to obtain the value.
  6. Stop the program.

FirstRanker.com

FirstRanker.com

Sample Output :

--- Content provided by FirstRanker.com ---

Before Swapping : A = 10 B = 20

After Swapping: A = 20 B = 10

Result:

Thus the program to swap two numbers using pointers is executed successfully.

FirstRanker.com

--- Content provided by‌ FirstRanker.com ---

FirstRanker.com

EXP NO 3 b: PROGRAMS USING STRUCTURES

Aim:

To write a c program using structures.

Software Requirements:

--- Content provided by‌ FirstRanker.com ---

C compiler

Hardware Requirements:

Server with supporting 30 terminals

Algorithm :

  1. Start the program.
  2. --- Content provided by⁠ FirstRanker.com ---

  3. Declare the structure and mention the structure variables inside the structure.
  4. In the main program access the member of the structure using the dot operator.
  5. Call the required functions inside the main function.
  6. Display the output.
  7. Stop the program.
  8. --- Content provided by​ FirstRanker.com ---

FirstRanker.com

FirstRanker.com

Sample Output :

Enter No. of Employees : 2

Enter Employee Details

--- Content provided by​ FirstRanker.com ---

Enter Employee Id : 436

Enter Employee Name :Gopal

Enter Basic Salary : 10000

Enter Employee Details

Enter Employee Id : 463

--- Content provided by‌ FirstRanker.com ---

Enter Employee Name :Rajesh

Enter Basic Salary : 22000

XYZ & Co. Payroll

Empld Name Basic HRA DA IT Gross Net Pay

436 Gopal 10000 200.00 100.00 500.00 10300.00 9800.00

--- Content provided by​ FirstRanker.com ---

463 Rajesh 22000 440.00 220.00 1100.00 22660.00 21560.00

Result:

Thus the program using structure is executed successfully.

Outcome:

Thus the programs using structures and pointers is attained.

--- Content provided by​ FirstRanker.com ---

Applications:

  • The C pointer are used to track read /write position in files in Linux/Unix OS.

VIVA - VOCE

  1. What is meant by pointers?
  2. What is meant by structure?
  3. --- Content provided by⁠ FirstRanker.com ---

  4. What is the advantage of structure?
  5. What is meant by address operator?

FirstRanker.com

FirstRanker.com

  1. What are the usages of pointers?
  2. --- Content provided by​ FirstRanker.com ---

  3. Why you need pointers in C?
  4. What is meant by referencing operator?
  5. What are the ways to declare the structure?
  6. What is meant by structure operator and arrow operator?
  7. How to pass function to pointers?
  8. --- Content provided by‍ FirstRanker.com ---

FirstRanker.com

FirstRanker.com

Expt. No. 4 PROGRAMS INVOLVING DYNAMIC MEMORY ALLOCATION

Aim:

To write a c program to perform dynamic memory allocation.

--- Content provided by‍ FirstRanker.com ---

Software requirements:

C compiler

Hardware requirements:

Server with supporting 30 terminals

Algorthim:

--- Content provided by‍ FirstRanker.com ---

  1. Start the program.
  2. Include the required header file for using the memory allocation function.
  3. Declare the required variables for the program.
  4. Call the required Dynamic Memory Allocation function depending upon the program.
  5. Display the result.
  6. --- Content provided by FirstRanker.com ---

  7. Stop the program.

FirstRanker.com

FirstRanker.com

Sample Output :

Enter integer value: 100

--- Content provided by‌ FirstRanker.com ---

Enter character value: x

Enter float value: 123.45

Inputted value are: 100, x, 123.45

Result:

Thus the program to perform dynamic memory allocation is executed successfully.

--- Content provided by FirstRanker.com ---

Outcome:

Thus the programs involving dynamic memory allocations are attained.

Applications:

The memory allocation concepts are used in operating systems present in embedded software.

VIVA - VOCE

--- Content provided by FirstRanker.com ---

  1. What is memory allocation?
  2. What is meant by dynamic memory allocation?
  3. Differentiate static memory allocation from dynamic memory allocation?
  4. Give some examples for memory allocation?
  5. What is the syntax for malloc()?
  6. --- Content provided by⁠ FirstRanker.com ---

  7. What is difference between malloc() and realloc()?
  8. What is the function of calloc()?
  9. What is meant by free() and what is the purpose of using free() function?
  10. What is the significance of calloc()?
  11. What is syntax for calloc()?
  12. --- Content provided by⁠ FirstRanker.com ---

FirstRanker.com

FirstRanker.com

Expt. No. 5 a ARRAY IMPLEMENTATION OF STACK

Aim:

To write a C program to perform array implementation of stack.

--- Content provided by​ FirstRanker.com ---

Software Requirements:

C compiler

Hardware Requirements:

Server with supporting 30 terminals

Algorithm:

--- Content provided by⁠ FirstRanker.com ---

  1. Start the program.
  2. Include all the header files which are used in the program and define a constant 'SIZE' with specific value.
  3. Declare all the functions used in stack implementation.
  4. Create a one dimensional array with fixed size (int stack[SIZE])
  5. Define a integer variable 'top' and initialize with '-1'. (int top = -1)
  6. --- Content provided by‍ FirstRanker.com ---

  7. In main method display menu with list of operations and make suitable function calls to perform operation selected by the user on the stack.

PUSH OPERATION

  1. Check whether stack is FULL. (top == SIZE-1)
  2. If it is FULL, then display "Stack is FULL!!! Insertion is not possible!!!" and terminate the function.
  3. If it is NOT FULL, then increment top value by one (top++) and set stack[top] to value (stack[top] = value).
  4. --- Content provided by FirstRanker.com ---

POP OPERATION

FirstRanker.com

FirstRanker.com

  1. Check whether stack is EMPTY. (top == -1)
  2. If it is EMPTY, then display "Stack is EMPTY!!! Deletion is not possible!!!" and terminate the function.
  3. --- Content provided by FirstRanker.com ---

  4. If it is NOT EMPTY, then delete stack[top] and decrement top value by one (top--)

DISPLAY

  1. Check whether stack is EMPTY. (top == -1)
  2. If it is EMPTY, then display "Stack is EMPTY!!!" and terminate the function.
  3. If it is NOT EMPTY, then define a variable 'i' and initialize with top. Display stack[i] value and decrement i value by one (i--).
  4. --- Content provided by⁠ FirstRanker.com ---

  5. Repeat above step until i value becomes '0'.

FirstRanker.com

FirstRanker.com

Sample Output :

STACK OPERATION

--- Content provided by FirstRanker.com ---

1.PUSH 2.POP 3.VIEW 4.QUIT Enter Choice : 1

Enter Stack element: 12

STACK OPERATION

1.PUSH 2.POP 3.VIEW 4.QUIT Enter Choice : 1

Enter Stack element: 23

--- Content provided by‍ FirstRanker.com ---

STACK OPERATION

.PUSH 2.POP 3.VIEW 4.QUIT Enter Choice: 1

Enter Stack element: 34

STACK OPERATION

1.PUSH 2.POP 3.VIEW 4.QUIT

--- Content provided by​ FirstRanker.com ---

Enter Choice: 1

Enter Stack element: 45

STACK OPERATION

1.PUSH 2.POP 3.VIEW 4.QUIT

Enter Choice: 3

--- Content provided by‍ FirstRanker.com ---

Top--> 45 34 23 12

STACK OPERATION

1.PUSH 2.POP 3.VIEW 4.QUIT

Enter Choice: 2

Popped element is 45

--- Content provided by‌ FirstRanker.com ---

STACK OPERATION

1.PUSH 2.POP 3.VIEW 4.QUIT

Enter Choice: 3

Top--> 34 23 12

STACK OPERATION

--- Content provided by‌ FirstRanker.com ---

1.PUSH 2.POP 3.VIEW 4.QUIT

Enter Choice: 4

Result :

Thus the program for array implementation of stack is executed successfully.

FirstRanker.com

--- Content provided by FirstRanker.com ---

FirstRanker.com

Expt. No. 5 b ARRAY IMPLEMENTATION OF QUEUE

Aim:

To write a C program to perform array implementation of queue.

Software Requirements:

--- Content provided by​ FirstRanker.com ---

C compiler

Hardware Requirements:

Server with supporting 30 terminals

Algorithm :

  1. Start the program.
  2. --- Content provided by‍ FirstRanker.com ---

  3. Include all the header files which are used in the program and define a constant 'SIZE' with specific value.
  4. Declare all the user defined functions which are used in queue implementation.
  5. Create a one dimensional array with above defined SIZE (int queue[SIZE])
  6. Define two integer variables 'front' and 'rear' and initialize both with '-1'. (int front = -1, rear = -1)
  7. Then implement main method by displaying menu of operations list and make suitable function calls to perform operation selected by the user on queue.
  8. --- Content provided by‌ FirstRanker.com ---

ENQUEUE OPERATION

  1. Check whether queue is FULL. (rear == SIZE-1)
  2. If it is FULL, then display "Queue is FULL!!! Insertion is not possible!!!" and terminate the function.
  3. If it is NOT FULL, then increment rear value by one (rear++) and set queue[rear] = value.

FirstRanker.com

--- Content provided by​ FirstRanker.com ---

FirstRanker.com

DEQUEUE OPERATION

  1. Check whether queue is EMPTY. (front == rear)
  2. If it is EMPTY, then display "Queue is EMPTY!!! Deletion is not possible!!!" and terminate the function.
  3. If it is NOT EMPTY, then increment the front value by one (front ++). Then display queue[front] as deleted element. Then check whether both front and rear are equal (front == rear), if it TRUE, then set both front and rear to '-1' (front = rear = -1).
  4. --- Content provided by​ FirstRanker.com ---

DISPLAY OPERATION

  1. Check whether queue is EMPTY. (front == rear)
  2. If it is EMPTY, then display "Queue is EMPTY!!!" and terminate the function.
  3. If it is NOT EMPTY, then define an integer variable 'i' and set 'i = front+1'.
  4. Display 'queue[i]' value and increment 'i' value by one (i++). Repeat the same until 'i' value is equal to rear (i <= rear)
  5. --- Content provided by‍ FirstRanker.com ---

FirstRanker.com

FirstRanker.com

Sample Output :

QUEUE OPERATION

1.INSERT 2.DELETE 3.VIEW 4.QUIT Enter Choice : 1

--- Content provided by FirstRanker.com ---

Enter element to be inserted: 12

QUEUE OPERATION

1.INSERT 2.DELETE 3.VIEW 4.QUIT Enter Choice : 1

Enter element to be inserted: 23

<

--- Content provided by​ FirstRanker.com ---

This download link is referred from the post: Anna University B.Tech Lab Manual