0% found this document useful (0 votes)
1K views18 pages

Applications of Array

1. Arrays allow storing of multiple values under a single name and enable easy and quick processing and sorting of large amounts of data. 2. There are two main techniques for searching elements in an array: linear search and binary search, with binary search being faster but only applicable to sorted arrays. 3. Arrays can be sorted in ascending or descending order using techniques like selection sort, bubble sort, and insertion sort. Selection sort finds the minimum value and swaps it into place, while bubble sort compares and swaps adjacent elements until sorted.

Uploaded by

Phadtare Tejas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views18 pages

Applications of Array

1. Arrays allow storing of multiple values under a single name and enable easy and quick processing and sorting of large amounts of data. 2. There are two main techniques for searching elements in an array: linear search and binary search, with binary search being faster but only applicable to sorted arrays. 3. Arrays can be sorted in ascending or descending order using techniques like selection sort, bubble sort, and insertion sort. Selection sort finds the minimum value and swaps it into place, while bubble sort compares and swaps adjacent elements until sorted.

Uploaded by

Phadtare Tejas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Applications Of Array

By: Tejas Phadtare


Div : O , Roll No.: 32
What is Array ?
An array is a collection of data items, all of the same type,
accessed using a common name. A one-dimensional array is like
a list; A two dimensional array is like a table; The C language
places no limits on the number of dimensions in an array, though
specific implementations may.

Ex: It is used to store 100 integers , We can store data of peoples


working in a company.
Applications Of Arrays :
1. Arrays can store a large number of value with single name.
2. Arrays can be used to process many value easily and quickly.
3. The values stored in an array can be sorted easily.
4. The search can be applied on arrays easilt.
Searching In Arrays:
Searching is a process of finding the required data in the array.
Searching becomes more important when the length of the array is
very large.
The are two technique’s to searching elements in arrays as follows:
1. Linear Search
2. Binary Search
Linear Search:
Linear Search is also known as sequential search or serial search. It follows
the following step to search a value in array.

1. Visit the first element of array and compare its value with required
value.
2. If the value of array matches with the desired value, the search is
complete.
3. If the value of array does not match , move to next element an repeat
same process.
Binary Search:
Binary Search Binary search is a quicker method of searching for value in the
array. Binary search is very quick but it can only search an sorted array. It cannot
be applied on an unsorted array. 
1. It locates the middle element of array and compare with desired number.
2. If they are equal, search is successful and the index of middle element is
returned.
3. If they are not equal, it reduces the search to half of the array.
4. If the search number is less than the middle element, it searches the first half of
array.
Otherwise it searches the second half of the array. The process continues until the
required number is found or loop completes without successful search.
Sorting Arrays:
Sorting Arrays Sorting is a process of arranging the value of array in a
particular order. An array can be sorted in two order.

1. Ascending Order : 12, 25, 33, 37, 48.


2. Descending Order: 48, 37, 33, 25, 12.
Techniques Of Sorting:
There are three types of sorting array :
1. Selection Sort
2. Bubble Sort
3. Insertion Sort
Selection Sort:
Selection sort is a technique that sort an array. It selects an element in
the array and moves it to its proper position. Selection sort works as
follows:
1. Find the minimum value in the list.
2. Swap it with value in the first position.
3. Sort the remainder of the list excluding the first value.
Selection Sort:
Example

Step 1

After Step 1

Step 2 (Repeating step 1


process0

After Step 2
Selection Sort:

And after doing this


steps multiple times ,
till we get this last
series the first step
will repeat itself

This is final result


Bubble Sort:
Bubble Sort is also known as exchange sort. It repeatedly visits the array
and compares two items at a time. It works as follows:
1. Compare adjacent element. If the first is greater than the second, swap
them.
2. Repeat this for each pair of adjacent element, starting with the first
two and ending with the last two. (at this point last element should be
greatest).
3. Repeat the step for all elements except the last one.
4. Keep repeating for one fewer element each time until there are no
pairs to compare.
Bubble Sort
Step 1
Step 2
Bubble Sort:
Step 3 Step 4
Insertion Sort:
Insertion sort is a sorting algorithm that places an unsorted element at its
suitable place in each iteration.
1. The first element in array is assumed to be sorted . Take the second element
and store it separately in key
2. Compare key with the element. If the element is greater then key, then key
is placed in front of the first element.
3. Take third element and compare it with the elements on the left of it.
Placed it just behind the elements smaller than it. If there is no element
smaller than it , then place it at beginning of the array.
4. Similarly , place every unsorted element at its correct position.
Insertion Sort:
Insertion Sort:
Thank You

You might also like