Bhavan's Vivekananda College
of Science, Humanities & Commerce
Autonomous College-Affiliated to Osmania University
Re-Accredited with ‘A’ Grade by NAAC
Sainikpuri, Secunderabad-500094
Department of Computer Science
BCA I Year II Semester
Data Structures using C
Name: ________________________________
Roll No: _______________________________
Section: _______________________________
The expert in anything was once a beginner
Unit – I
Introduction to Data Structures and Algorithms:
Basic Terminology: Elementary Data Structure Organization, Classification of Data Structures,
Operations on Data Structures.
Searching and Sorting:
Introduction to Searching, Linear Search, Binary Search, Interpolation Search.
Introduction to Sorting, Bubble Sort, Insertion Sort, Selection Sort, Merge Sort, Quick Sort
Unit – II
Stacks: Introduction to Stacks, Array representation of Stacks, Operations on a Stack: Push, Pop,
Peek operations, Applications of Stacks: Reversing a list, Conversion of an Infix expression into a
Postfix expression, Recursion.
Queues: Introduction to Queues, Array representation of Queues, Types of Queues: Circular
Queues, Priority Queues, Deques, Applications of Queues.
Unit – III
Linked Lists: Introduction, Basic Terminologies, Linked Lists versus Arrays, Singly Linked Lists:
Traversing a Linked List, searching for a value in a Linked List, Inserting a new node in a Linked
List, Deleting a node from a Linked List.
Doubly Linked Lists: Inserting a new node in a Doubly Linked List, Deleting a Node from a
Doubly Linked List.
Circular Linked Lists: Inserting a new Node in a Circular Linked List, Deleting a Node from a
Circular Linked List.
Unit – IV
Trees: Introduction-Basic Terminology, Types of Trees, creating a Binary Tree from a General
Tree, Traversing a Binary Tree: Pre-order, In-order, post-order, Applications of Trees, Binary
Search Trees, Operations on Binary Search Trees: Searching for a Node in a Binary Search Tree,
Inserting a new node in a Binary Search Tree, Deleting a node from a Binary Search Tree.
Unit – V
Graphs: introduction, Graph terminology, Directed Graphs: Terminology of a Directed Graph,
Representation of Graphs: Adjacency Matrix Representation, Adjacency List Representation,
Graph Traversal Algorithms: Breadth-First Search algorithm, Depth-First Search algorithm,
Minimum Spanning Tree, Dijkstra's Algorithm.
References :
1. Data Structures Using C, Reema Thareja, OXFORD University Press, Second Edition,2014.
DATA STRUCTURES USING C LAB
1. Program to demonstrate Linear Search.
2. Program to demonstrate Binary Search.
3. Program to demonstrate Interpolation Search.
4, Program to implement Bubble Sort.
5. Program to implement Selection Sort.
6. Program to implement Insertion Sort.
7. Program to implement Merge Sort.
8. Program to implement Quick Sort.
9. Program to implement PUSH and POP operations on Stack using array method.
10. Program to implement insert and delete operations on Queue using array method.
I l. Program to implement insert and delete operations on Priority Queue.
12. Program to insert, delete and display operations on a Single Linked list.
13. Program to implement PUSH and POP operations on Stack using a Single Linked list.
14. Program to implement insert and delete operations on Queue using a Single Linked list.
15. Program to insert, delete and display operations on a Doubly Linked list.
16. Program to construct Binary Search Tree and implement Tree Traversing Techniques.
17. Program to insert a new node in a Binary Search Tree.
18. Program to delete a leaf node of a Binary Search Tree.
19. Program to search a node in a Binary Search Tree.
20. Program to create a Graph using Adjacency Matrix Representation.
Chapter 1
Introduction to Data Structures and Algorithms
1.1 Basic Terminology:
• Data structures are important for organizing and managing data in computer programs.
They help programs store, access, and modify data efficiently, saving time and memory.
• Common data structures include arrays, linked lists, stacks, queues, binary trees, and
hash tables.
• The right data structure is crucial for handling large amounts of data quickly and
efficiently in fields like operating systems, databases, and artificial intelligence.
Choosing the Right Data Structure
➔ Analyze the problem:
Identify the basic operations needed (e.g., inserting, searching, deleting data).
➔ Consider time and memory limits:
Evaluate the efficiency of these operations in terms of time complexity and memory
usage.
➔ Choose the best data structure:
Select the data structure that best fits the required operations and their efficiency
constraints.
➔ Impact of choosing the right data structure:
Improves program performance, making it faster and more efficient.
1.2 Elementary Data Structure Organization
• Data structures are building blocks of a program, Choosing the appropriate data structure
is crucial for the program to work as expected.
• What is Data?
Data refers to values or sets of values. It can represent a variable’s value or a constant
(e.g., student marks, employee name, customer address, value of pi).
• Elementary vs Group Items:
✓ Elementary Item: A data item with no subordinate items (e.g., roll number).
✓ Group Item: A data item made up of subordinate items (e.g., a student's name
can be divided into first, middle, and last names).
• Records:
A record is a collection of related data items. For example, a student’s record might
include name, address, course, and marks.
• Files:
A file is a collection of related records. For instance, a file might contain records of all
students in a class, all employees in a company, or all customers of a business.
• Primary Key:
✓ Each record in a file can be uniquely identified by a specific data item called a
primary key.
✓ In a student's record, the roll number is a primary key, whereas name, address,
course, and marks cannot serve as primary keys since they may not be unique.
• Hierarchy of Data:
The structure of data is organized hierarchically, starting from elementary items, to
records, to files, and further forming more complex data structures.
1.3 Classification 0f Data Structures:
Data structures are generally categorized into two classes: primitive and non-primitive
data structures
1.3.1 Primitive data structures:
• Primitive data structures are the fundamental data types which are supported by a
programming language.
• Examples:
Integer , Real (Float) , Character , Boolean
• These terms (data type, basic data type, and primitive data type) are often u
• sed interchangeably.
1.3.2 Non-Primitive data structures:
• Non-primitive data structures are those data structures which are created using primitive
data structures.
• Examples:
Linked Lists , Stacks , Trees , Graphs
• Non-primitive data structures can further be classified into two categories: linear and
non-linear data structures
1.3.2.1 Linear data structure and Non-linear data structure
• If a data structure organizes the data in sequential order, then that data structure is called
a Linear Data Structure.
• Linear data structures can be represented in memory in two primary ways.
Sequential Memory Locations: In this method, elements are stored in consecutive
memory locations, creating a linear relationship between the elements.
Linked Representation: In this method, elements are connected through links (pointers),
maintaining a linear relationship but not necessarily in consecutive memory locations.
• Examples:
o Arrays : An array is a collection of similar data elements of the same data type,
stored in consecutive memory locations and are referenced by an index
(also known as the subscript).
o Linked List : A dynamic data structure where elements (nodes) are connected
via pointers. Each node contains data and a pointer to the next node.
o Stack : A linear data structure that follows the Last In, First Out (LIFO) principle.
The last element added is the first to be removed.
o Queue : A linear data structure that follows the First In, First Out (FIFO) principle.
The first element inserted is the first to be removed.
• If a data structure organizes the data in random order, then that data structure is called
as Non-Linear Data Structure.
• Examples:
o Trees : A non-linear data structure where nodes are connected hierarchically. The
top most node is the root, and the remaining nodes are its children.
o Graphs : A non-linear data structure consisting of nodes (vertices) and edges
connecting them. Unlike trees, graphs allow more complex relationships.
1.4 Operations on Data Structures:
Several key operations can be performed on data structures, including:
• Traversing: Access each data item exactly once to process it.
Example: Printing all student names in a class.
• Searching: Find the location of data items that meet a given condition.
Example: Finding students who secured 100 marks in mathematics.
• Inserting: Add new data items to the data structure. Example: Adding details of a new
student.
• Deleting: Remove a specific data item from the collection.
Example: Deleting the name of a student who left the course.
• Sorting: Arrange data items in a specific order (ascending or descending).
Example: Sorting student names alphabetically or ranking participants by scores
in descending order.
• Merging: Combine two sorted lists into one sorted list. Example: Merging two sorted lists
of students into one.
Simultaneous Operations: Often, multiple operations are applied together.
Example: To delete a student's details, the process involves first searching for the student
and then deleting their record if found.
Chapter 2
Searching and Sorting
2.1 Introduction to Searching:
Searching involves finding whether a particular value exists in an array or not.
If the value is found, the search is successful and the index of the value is returned.
If the value is not found, an appropriate message is displayed, and the search is
considered unsuccessful.
2.2 Linear Search Algorithm (Sequential Search Algorithm)
Linear search algorithm finds a given element in a list of elements with O(n) time
complexity where n is total number of elements in the list.
Linear search is implemented using following steps...
• Step 1 - Read the search element from the user.
• Step 2 - Compare the search element with the first element in the list.
• Step 3 - If both are matched, then display "Given element is found!!!" and terminate the
function
• Step 4 - If both are not matched, then compare search element with the next element in
the list.
• Step 5 - Repeat steps 3 and 4 until search element is compared with last element in the
list.
• Step 6 - If last element in the list also doesn't match, then display "Element is not
found!!!" and terminate the function.
Example : Consider the following list of elements and the element to be searched ...
Program to implement Linear Search Algorithm
#include<stdio.h>
void main()
{
int arr[20],size,i,num;
printf("Enter Size of the array");
scanf("%d",&size);
printf("Enter Array Elements");
for(i=0; i<size; i++)
{
scanf("%d",&arr[i]);
}
printf("Enter the number to be search : ");
scanf("%d",&num);
// Linear Search Logic
for(i = 0; i < size; i++)
{
if(num == arr[i])
{
printf("Element is found at %d index",i);
break;
}
}
if(i == size)
printf("Given element is not found in the list");
}
2.2 Binary Search Algorithm
Binary search algorithm finds a given element in a list of elements with O(log n) time complexity
where n is total number of elements in the list. The binary search algorithm can be used with
only a sorted list of elements. That means the binary search is used only with a list of elements
that are already arranged in an order. The binary search can not be used for a list of elements
arranged in random order.
Binary search is implemented using following steps...
• Step 1 - Read the search element from the user.
• Step 2 - Find the middle element in the sorted list.
• Step 3 - Compare the search element with the middle element in the sorted list.
• Step 4 - If both are matched, then display "Given element is found!!!" and terminate the
function.
• Step 5 - If both are not matched, then check whether the search element is smaller or
larger than the middle element.
• Step 6 - If the search element is smaller than middle element, repeat steps 2, 3, 4 and 5
for the left sub list of the middle element.
• Step 7 - If the search element is larger than middle element, repeat steps 2, 3, 4 and 5 for
the right sub list of the middle element.
• Step 8 - Repeat the same process until we find the search element in the list or until sub
list contains only one element.
• Step 9 - If that element also doesn't match with the search element, then display "Element
is not found in the list!!!" and terminate the function.
Example : Consider the following list of elements and the element to be searched ...
Program to implement Binary Search Algorithm
#include<stdio.h>
void main()
{
int low, high, mid, size, i, sElement, list[100];
printf("Enter the size of the list: ");
scanf("%d",&size);
printf("Enter %d integer values in Assending order\n", size);
for (i = 0; i < size; i++)
scanf("%d",&list[i]);
printf("Enter value to be search: ");
scanf("%d", &sElement);
low = 0;
high = size - 1;
mid = (low+high)/2;
while (low <= high)
{
if (list[mid]<sElement)
low = mid + 1;
else if (list[mid] == sElement)
{
printf("Element found at index %d.\n",mid);
break;
}
else
high = mid - 1;
mid= (low + high)/2;
}
if (low > high)
printf("Element Not found in the list.");
}
2.3 Interpolation Search Algorithm
• Interpolation Search (also known as Extrapolation Search) is a searching technique used
to find a specified value in a sorted array.
• The technique estimates the position of the key (target value) based on the value
distribution in the array rather than simply dividing the array in half (as in binary search).
Interpolation search is implemented using following steps...
• Step 1 - Read the search element (key) and the sorted array from the user.
• Step 2 - Initialize the search space by setting low = 0 and high = n - 1, where n is the
length of the array.
• Step 3 - Estimate the position of the search element using the interpolation formula:
(𝑠𝑒𝑙𝑒𝑚𝑒𝑛𝑡 − 𝑎𝑟𝑟[𝑙𝑜𝑤) × (ℎ𝑖𝑔ℎ − 𝑙𝑜𝑤)
𝑚𝑖𝑑 = 𝑙𝑜𝑤 + ( )
𝑎𝑟𝑟[ℎ𝑖𝑔ℎ] − 𝑎𝑟𝑟[𝑙𝑜𝑤]
• Step 4: Check if the estimated position is within the array bounds. If it's valid, proceed;
otherwise, stop the search.
• Step 5: Compare the element at the estimated position (arr[pos]) with the target value
(key):
✓ If they match, return the position.
✓ If the target is larger, update low to search the upper half of the array.
✓ If the target is smaller, update high to search the lower half.
• Step 6: Repeat steps 2–5 until the element is found or the search space is invalid
(i.e., low > high).
• Step 6: If the target is found, return the position; otherwise, return "Element not
found".
Example : Given a list of numbers a[] = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21}. Search for value 19
using interpolation search technique.
Solution : Low = 0, High = 10, selement = 19, a[Low] = 1, a[High] = 21
(𝑠𝑒𝑙𝑒𝑚𝑒𝑛𝑡−𝑎𝑟𝑟[𝑙𝑜𝑤)×(ℎ𝑖𝑔ℎ−𝑙𝑜𝑤)
𝑚𝑖𝑑 = 𝑙𝑜𝑤 + ( )
𝑎𝑟𝑟[ℎ𝑖𝑔ℎ]−𝑎𝑟𝑟[𝑙𝑜𝑤]
(19−1)×(10−0)
𝑚𝑖𝑑 = 0 + ( )
21−1
18×10 180
𝑚𝑖𝑑 = 0 + ( ) => 𝑚𝑖𝑑 = 0 + ( )
20 20
𝑚𝑖𝑑 = 9 => a[mid]=a[9]=19
which is equal to value to be searched
Program to implement Interpolation Search Algorithm
#include <stdio.h>
int main()
{
int size, selement, low, high, pos,i;
printf("Enter the number of elements: ");
scanf("%d",&size);
int arr[size];
printf("Enter the elements (sorted):\n");
for (i=0;i<size;i++)
{
scanf("%d",&arr[i]);
}
printf("Enter the key to search: ");
scanf("%d",&selement);
low = 0;
high = size-1;
while (low<=high&&selement>=arr[low]&&selement<=arr[high])
{
pos = low +((selement-arr[low])*(high - low))/(arr[high]-arr[low]);
if (arr[pos] == selement)
{
printf("Element found at index %d.\n", pos);
return 0;
}
if (arr[pos] > selement)
{
high = pos - 1;
}
else
{
low = pos + 1;
}
}
printf("Element not found.\n");
return 0;
}
2.4 Introduction to Sorting:
• Sorting is the process of arranging elements in a specific order, typically in ascending or
descending order.
✓ In ascending order, elements are sorted from the smallest to the largest value,
and in descending order, from largest to smallest
• Sorting can be broadly categorized into two types: internal sorting and external sorting.
✓ Internal sorting refers to sorting algorithms that operate on data stored in the
computer's main memory (RAM), typically used when the data size is manageable
✓ External sorting, on the other hand, is applied when the data is too large to fit into
memory and is stored on external devices like hard drives or SSDs.
2.4.1 Bubble Sort
In this sorting technique, compare the first element of the array with the immediately next
element. While comparing arrange the values of elements into specific order say ascending
order and then compare the second element with the third element and arrange the values
into order between elements.
Bubble sort is performed using following steps...
• Step 1: Select the very first two elements of the list.
• Step 2: Compare them to check which one is greater.
• Step 3: In every comparison, if 2nd element is found smaller than the 1st element (for
Ascending order), then those two elements are swapped.
• Step 4: Repeat the same procedure with the next two elements in the list till the entire
list is sorted.
Program to implement Bubble Sort Algorithm
#include <stdio.h>
int main()
{
int a[20], i, j, temp, n;
printf("Enter how many elements you want to input: ");
scanf("%d", &n);
printf("Enter the elements:\n");
for (i = 0; i < n; i++)
{
scanf("%d", &a[i]);
}
// Bubble sort logic
for (i = 0; i < n - 1; i++)
{
for (j = 0; j < n - 1 - i; j++)
{
if (a[j] > a[j + 1])
{
temp = a[j];
a[j] = a[j + 1];
a[j + 1] = temp;
}
}
}
printf("Values after sorting:\n");
for (i = 0; i < n; i++)
{
printf("%d\t", a[i]);
}
return 0;
}
2.4.2 Insertion Sort
Insertion sort algorithm arranges a list of elements in a particular order. In insertion sort
algorithm, every iteration moves an element from unsorted portion to sorted portion until all
the elements are sorted in the list.
Insertion sort is performed using following steps...
• Step 1 - Assume that first element in the list is in sorted portion and all the remaining
elements are in unsorted portion.
• Step 2: Take first element from the unsorted portion and insert that element into the
sorted portion in the order specified.
• Step 3: Repeat the above process until all the elements from the unsorted portion are
moved into the sorted portion.
Program to implement Insertion Sort Algorithm
#include <stdio.h>
int main()
{
int i, j, n, temp, a[30];
printf("Enter the number of elements: ");
scanf("%d", &n);
printf("\nEnter the elements:\n");
for(i = 0; i < n; i++)
{
scanf("%d", &a[i]);
}
// Insertion sort logic
for(i = 1; i < n; i++)
{
temp = a[i];
j = i - 1;
while((temp < a[j]) && (j >= 0)) {
a[j + 1] = a[j];
j = j - 1;
}
a[j + 1] = temp;
}
printf("\nSorted list is as follows:\n");
for(i = 0; i < n; i++) {
printf("%d ", a[i]);
}
return 0;
}
2.4.3 Selection Sort
• Selection Sort algorithm is used to arrange a list of elements in a particular order
(Ascending or Descending). In selection sort, the first element in the list is selected and it
is compared repeatedly with all the remaining elements in the list.
• If any element is smaller than the selected element (for Ascending order), then both are
swapped so that first position is filled with the smallest element in the sorted order. Next,
we select the element at a second position in the list and it is compared with all the
remaining elements in the list.
• If any element is smaller than the selected element, then both are swapped. This
procedure is repeated until the entire list is sorted.
The selection sort algorithm is performed using following steps...
• Step 1 - Select the first element of the list (i.e., Element at first position in the list).
• Step 2: Compare the selected element with all the other elements in the list.
• Step 3: In every comparison, if any element is found smaller than the selected element
(for Ascending order), then both are swapped.
• Step 4: Repeat the same procedure with element in the next position in the list till the
entire list is sorted.
Program to implement Selection Sort Algorithm
#include <stdio.h>
void main()
{
int size, i, j, temp, list[100];
printf("Enter the size of the List: ");
scanf("%d", &size);
printf("Enter %d integer values: ", size);
for(i = 0; i < size; i++)
{
scanf("%d", &list[i]);
}
// Selection sort logic
for(i=0; i<size-1;i++)
{
for(j=i+1;j<size;j++)
{
if(list[i]>list[j])
{
temp=list[i];
list[i]=list[j];
list[j]=temp;
}
}
}
printf("List after sorting is: ");
for(i = 0; i < size; i++)
{
printf("%d\t", list[i]);
}
}
2.4.4 Merge Sort
• Merge Sort is a sorting algorithm that follows the divide and conquer paradigm. The
process involves three main steps: divide, conquer, and combine.
• First step is divide, the array is divided into two sub-arrays. If the array has 0 or 1 element,
it is already sorted. If there are more elements, the array is recursively split into smaller
sub-arrays.
• The next step is conquer, where each sub-array is sorted using the Merge Sort algorithm
itself.
• Finally, the combine step merges the two sorted sub-arrays back into a single sorted
array.
The Merge Sort algorithm improves performance through two main concepts:
1. Dividing into Smaller Lists: Sorting smaller sub-lists takes less time than sorting a large
list.
2. Efficient Merging: Merging two sorted lists is faster than merging unsorted lists.
The basic steps of a merge sort algorithm are as follows:
• If the array is of length 0 or 1, then it is already sorted.
• Otherwise, divide the unsorted array into two sub-arrays of about half the size.
• Use merge sort algorithm recursively to sort each sub-array.
• Merge the two sub-arrays to form a single sorted list.
Program to implement Insertion Sort Algorithm
#include <stdio.h>
int size;
void merge(int arr[], int beg, int mid, int end);
void merge_sort(int arr[], int beg, int end);
int main()
{
printf("\nEnter the number of elements in the array: ");
scanf("%d", &size);
int arr[size], i;
printf("\nEnter the elements of the array: ");
for(i = 0; i < size; i++)
{
scanf("%d", &arr[i]);
}
merge_sort(arr, 0, size - 1); //Calling merge_sort to sort the array
printf("\nThe sorted array is: \n");
for(i = 0; i < size; i++)
{
printf("%d\t", arr[i]);
}
return 0;
}
// Merge function: Merges two sorted halves into one sorted array
void merge(int arr[], int beg, int mid, int end)
{
int i = beg, j = mid + 1, index = beg, temp[size], k;
// Merge the two subarrays into temp[]
while(i <= mid && j <= end)
{
if(arr[i] < arr[j])
{
temp[index] = arr[i];
i++;
}
else
{
temp[index] = arr[j];
j++;
}
index++;
}
// If there are remaining elements in the left subarray, add them
if(i > mid)
{
while(j <= end)
{
temp[index] = arr[j];
j++;
index++;
}
}
// If there are remaining elements in the right subarray, add them
else
{
while(i <= mid)
{
temp[index] = arr[i];
i++;
index++;
}
}
// Copy the merged elements back into the original array
for(k = beg; k < index; k++)
{
arr[k] = temp[k];
}
}
// MergeSortfunction: Recursively divides the array and calls merge to
sort it
void merge_sort(int arr[], int beg, int end)
{
if(beg < end)
{
int mid = (beg + end) / 2;
merge_sort(arr, beg, mid); // Sort the first half
merge_sort(arr, mid + 1, end); // Sort the second half
merge(arr, beg, mid, end); // Merge the two sorted halves
}
}
2.4.5 Quick Sort
• Quick sort is a fast sorting algorithm used to sort a list of elements. Quick sort algorithm
is invented by C. A. R. Hoare.
• The quick sort algorithm attempts to separate the list of elements into two parts and then
sort each part recursively. That means it use divide and conquer strategy.
• In quick sort, the partition of the list is performed based on the element called pivot. Here
pivot element is one of the elements in the list.
• The list is divided into two partitions such that "all elements to the left of pivot are
smaller than the pivot and all elements to the right of pivot are greater than or equal
to the pivot".
Step by Step Process
In Quick sort algorithm, partitioning of the list is performed using following steps...
• Step 1 - Consider the first element of the list as pivot (i.e., Element at first position in the
list).
• Step 2 - Define two variables i and j. Set i and j to first and last elements of the list
respectively.
• Step 3 - Increment i until list[i] > pivot then stop.
• Step 4 - Decrement j until list[j] < pivot then stop.
• Step 5 - If i < j then exchange list[i] and list[j].
• Step 6 - Repeat steps 3,4 & 5 until i > j.
• Step 7 - Exchange the pivot element with list[j] element.
Program to implement Quick Sort Algorithm
#include <stdio.h>
void quickSort(int list[], int first, int last);
int main()
{
int list[20], size, i;
// Input size and elements
printf("Enter size of the list: ");
scanf("%d", &size);
printf("Enter %d integer values: ", size);
for (i = 0; i < size; i++)
{
scanf("%d", &list[i]);
}
// Call quickSort
quickSort(list, 0, size - 1);
// Output the sorted list
printf("List after sorting is: ");
for (i = 0; i < size; i++)
{
printf("%d\t", list[i]);
}
return 0;
}
// Function to implement Quick Sort
void quickSort(int list[], int first, int last)
{
int pivot, i, j, temp;
if (first < last)
{
pivot = first;
i = first;
j = last;
// Partitioning step
while (i < j)
{
// Find element greater than pivot
while (list[i] <= list[pivot] && i < last)
i++;
// Find element smaller than pivot
while (list[j] > list[pivot])
j--;
// Swap elements if i < j
if (i < j)
{
temp = list[i];
list[i] = list[j];
list[j] = temp;
}
}
// Swap pivot to its correct position
temp = list[pivot];
list[pivot] = list[j];
list[j] = temp;
// Recursively apply quickSort to the sub-arrays
quickSort(list, first, j - 1);
quickSort(list, j + 1, last);
}
}
Unit-I Questions
1. Define a data structure. Explain its importance in computer science and provide examples
of different types of data structures. (Classifications of Data Structure)
2. Operations on Data Structure? Why is it important to choose the right data structure for
an algorithm?
3. What is Searching ? Explain about Binary search with an example and program?
4. Explain about Linear search with an example and program?
5. Define Sorting? Explain about Selection Sort with an example program?
6. Explain bubble sort with an example program?
7. Explain about merge sort with an example program?
8. Explain quick sort with an example program?
9. Explain about Insertion sort with an example program?