SlideShare a Scribd company logo
GOVERNMENT COLLEGE OF
ENGINEERING AND TEXTILE
TECHNOLOGY, SERAMPORE
Continuous Assessment : 1
NAME OF THE TOPIC : VARIOUS
OPERATION OF ARRAY
Name : Atirath Pal
University Registration No :
231100110042(2023-24)
University Roll No : 11000123007
Department : Computer
Science and Engineering
Year : 2nd
Year Semester : 3rd
Sem
Paper Name : Data Structure And
Algorithm
Paper Code : PCC-CS301
Topics Discussed
1. Introduction to Array
2. Array Initialisation
3. Accessing Array Elements
4. Updating Array elements
5. Array Traversal
6. Searching An Array Element
7. Insertion and Deletion of an Array Element
8. Sorting an Array
9. Multi-Dimentional Array
10.Conclution
Array
 What is an array ?
An array is a fixed-size collection of similar data items stored in
contiguous memory locations. It can be used to store the collection of
primitive data types such as int, char, float, etc., and also derived and user-
defined data types such as pointers, structures etc.
 Array Declaration
In C and other programming
languages, we have to
declare the array like any
other variable before using it.
We can declare an array by
specifying its name, the type
of its elements, and the size
of its dimensions. When we
declare an array in C, the
compiler allocates the
memory block of the specified
size to the array name.
Syntax:
Data_type array_name [size]
Page Number 1
 Array Initialization
Initialization is the process to assign some initial value to the variable. When
the array is declared or allocated memory, the elements of the array contain
some garbage value. So, we need to initialize the array to some meaningful value.
There are multiple ways in which we can initialize an array in C.
1. Array Initialization with Declaration
In this method, we initialize the array
along with its declaration. An initializer
list is the list of values enclosed within
braces { } separated b a comma.
Syntax :
datatype arrayname [size] = {value1, value2, ... valueN}
2. Array Initialization with Declaration without Size
If we initialize an array using an initializer list, we can
skip declaring the size of the array as the compiler can
automatically deduce the size of the array in these
cases. Syntax :
data_type array_name[ ] = {1,2,3,4,5}; // array size is 5.
3. Array Initialization after Declaration (using loops)
We can use for loop, while loop, or do-while loop to
assign the value to each element of the array after
declaration.
int n =5;
int arr[n];
for (int i = 0 ; i < n ; i+
+)
{
scanf("%d", &arr[i]);
}
Page Number 2
 Access Array Elements
We can access any element of an array using the array subscript operator [ ]
and the index value i of the element. One thing to note is that the indexing in
the array always starts with 0, i.e., the first element is at index 0 and the last
element is at N – 1 where N is the number of elements in the array.
 Update Array Element
We can change the value of any
element by using their index .
Syntax :
array_name[index] = updated value;
 Array Traversal
Traversal is the process in which we visit every
element of the data structure. For this ,we use
loops(for loop or while loop) to iterate
through each element of the array.
Syntax : using for loop
for (int i = 0; i < N; i++)
{
array_name[i];
}
Page Number 3
 Searching in Array
Searching for an element in an array involves checking whether a specific value
exists in the array and finding its position if it does. If the element does not exist then
we usually return false; There are two common techniques for searching in an array .
1. Binary Search 2. Linear search
Searching Algorithm Time Complexity Auxiliary Space
Binary Search O(log 2 N) O(1)
Linear Search O(N) for worst case O(1)
Binary Search : Works on sorted
arrays, repeatedly dividing the
search interval in half. This is
usefull when the array is sorted.
Linear search : Sequentially
checks each element until a match is
found. This is usefull when the
array is Unsorted.
Page Number 4
Insert operation in an array at any position can be performed by shifting
elements to the right, which are on the right side of the required
position.
 Insertion & Deletion of elements from an Array
To Delete an element from
an Array , We need its
Specific Index .
After Deleting the element
all the right side element
will shift one box towards
left.
// Inserting an element.
void insertElement(int arr[],
int n, int x, int pos)
{
for (int i = n - 1; i >= pos;
i--)
arr[i + 1] = arr[i];
arr[pos] = x;
}
Page Number 5
 Sorting An Array
Sorting an array in ascending order means arranging the elements from smallest
element to largest element. There are many ways by which the array can be sorted.
1. Selection Sort 2. Bubble Sort 3. Insertion Sort
4. Merge Sort 5. Quick Sort
1. Selection Sort : Finds the minimum element from the
unsorted part of the array and places it at the beginning
of the sorted part of the array .
2. Bubble Sort : Repeatedly compares adjacent elements
and swaps them if they are in the wrong order.
3. Insertion Sort : Builds a sorted subarray by inserting
elements into their correct positions.
4. Merge Sort : Divides the array into subarrays, sorts
them recursively, and then merges the sorted subarrays.
5. Quick Sort : QuickSort is a sorting algorithm based on
the Divide and Conquer algorithm that picks an element as
a pivot and partitions the given array around the picked
pivot.
Sorting Algorithm Time Complexity Auxiliary Space
1. Selection Sort
2. Bubble Sort
3. Insertion Sort
4. Merge Sort
5. Quick Sort
Page Number 6
Page Number 7
Multi-Dimentional Array
A multi-dimensional array is an
array with more than one level
or dimension. For example, a 2D
array, or two-dimensional array,
is an array of arrays, meaning it is
a matrix of rows and columns
(think of a table).
Syntax :
data_type array_name[size1][size2]....
[sizeN];
data_type: Type of data to be stored in
the array.
array_name: Name of the array.
size1, size2,…, sizeN: Size of each
dimension.
int x[3][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 } };
// output each array element's
value
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 2; j++) {
printf("Element at x[%i][%i]: ", i, j);
printf("%dn", x[i][j]);
}
}
Page Number 8
ConClution
Arrays are fundamental data structure in programming. Arrays
provide a powerful and efficient way to store and manipulate
collections of data.
 Initialization and Declaration: How to create and define arrays.
 Accessing and Modifying Elements: Techniques to retrieve and
update array elements.
 Array Traversal: Methods to iterate through arrays, including loops
and built-in functions.
 Array Manipulations: Operations such as insertion, deletion,
sorting, and searching within arrays.
 Multidimensional Arrays: Understanding arrays with multiple
dimensions and their use cases.
 Advanced Operations: Exploring functions like merging, splitting,
and applying mathematical operations across array elements.
Reference
https://www.geeksforgeeks.org/multidimensional-arrays-in-c/
Data Structure And Algorithm by Ronald Rivest
https://www.geeksforgeeks.org/c-arrays/
https://www.programiz.com/c-programming/c-arrays
Various Operations Of Array(Data Structure Algorithm).pptx
Ad

More Related Content

Similar to Various Operations Of Array(Data Structure Algorithm).pptx (20)

Unit4pptx__2024_11_ 11_10_16_09.pptx
Unit4pptx__2024_11_      11_10_16_09.pptxUnit4pptx__2024_11_      11_10_16_09.pptx
Unit4pptx__2024_11_ 11_10_16_09.pptx
GImpact
 
Arrays
ArraysArrays
Arrays
Trupti Agrawal
 
Java R20 - UNIT-3.pdf Java R20 - UNIT-3.pdf
Java R20 - UNIT-3.pdf Java R20 - UNIT-3.pdfJava R20 - UNIT-3.pdf Java R20 - UNIT-3.pdf
Java R20 - UNIT-3.pdf Java R20 - UNIT-3.pdf
kamalabhushanamnokki
 
numpy.pdf
numpy.pdfnumpy.pdf
numpy.pdf
DrSudheerHanumanthak
 
Array.pdf
Array.pdfArray.pdf
Array.pdf
DEEPAK948083
 
Array ppt
Array pptArray ppt
Array ppt
Kaushal Mehta
 
Data structures in c#
Data structures in c#Data structures in c#
Data structures in c#
SivaSankar Gorantla
 
arrayppt.pptx
arrayppt.pptxarrayppt.pptx
arrayppt.pptx
shivas379526
 
Arrays
ArraysArrays
Arrays
Manthan Dhavne
 
Arrays
ArraysArrays
Arrays
sana younas
 
10 arrays and pointers.pptx for array and pointer
10 arrays and pointers.pptx for array and pointer10 arrays and pointers.pptx for array and pointer
10 arrays and pointers.pptx for array and pointer
divyamth2019
 
ARRAYS.pptx
ARRAYS.pptxARRAYS.pptx
ARRAYS.pptx
MamataAnilgod
 
arrays.pptx
arrays.pptxarrays.pptx
arrays.pptx
HarmanShergill5
 
ppt on arrays in c programming language.pptx
ppt on arrays in c programming language.pptxppt on arrays in c programming language.pptx
ppt on arrays in c programming language.pptx
AmanRai352102
 
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada ReddyDatastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
Malikireddy Bramhananda Reddy
 
Java R20 - UNIT-3.docx
Java R20 - UNIT-3.docxJava R20 - UNIT-3.docx
Java R20 - UNIT-3.docx
Pamarthi Kumar
 
Arrays In C++
Arrays In C++Arrays In C++
Arrays In C++
Awais Alam
 
M v bramhananda reddy dsa complete notes
M v bramhananda reddy dsa complete notesM v bramhananda reddy dsa complete notes
M v bramhananda reddy dsa complete notes
Malikireddy Bramhananda Reddy
 
UNIT-5_Array in c_part1.pptx
UNIT-5_Array in c_part1.pptxUNIT-5_Array in c_part1.pptx
UNIT-5_Array in c_part1.pptx
sangeeta borde
 
cluod.pdf
cluod.pdfcluod.pdf
cluod.pdf
ssuser92d367
 

Recently uploaded (20)

DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design ThinkingDT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DhruvChotaliya2
 
Oil-gas_Unconventional oil and gass_reseviours.pdf
Oil-gas_Unconventional oil and gass_reseviours.pdfOil-gas_Unconventional oil and gass_reseviours.pdf
Oil-gas_Unconventional oil and gass_reseviours.pdf
M7md3li2
 
Metal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistryMetal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistry
mee23nu
 
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptxExplainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
MahaveerVPandit
 
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E..."Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
Infopitaara
 
some basics electrical and electronics knowledge
some basics electrical and electronics knowledgesome basics electrical and electronics knowledge
some basics electrical and electronics knowledge
nguyentrungdo88
 
lecture5.pptxJHKGJFHDGTFGYIUOIUIPIOIPUOHIYGUYFGIH
lecture5.pptxJHKGJFHDGTFGYIUOIUIPIOIPUOHIYGUYFGIHlecture5.pptxJHKGJFHDGTFGYIUOIUIPIOIPUOHIYGUYFGIH
lecture5.pptxJHKGJFHDGTFGYIUOIUIPIOIPUOHIYGUYFGIH
Abodahab
 
Structural Response of Reinforced Self-Compacting Concrete Deep Beam Using Fi...
Structural Response of Reinforced Self-Compacting Concrete Deep Beam Using Fi...Structural Response of Reinforced Self-Compacting Concrete Deep Beam Using Fi...
Structural Response of Reinforced Self-Compacting Concrete Deep Beam Using Fi...
Journal of Soft Computing in Civil Engineering
 
Degree_of_Automation.pdf for Instrumentation and industrial specialist
Degree_of_Automation.pdf for  Instrumentation  and industrial specialistDegree_of_Automation.pdf for  Instrumentation  and industrial specialist
Degree_of_Automation.pdf for Instrumentation and industrial specialist
shreyabhosale19
 
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
inmishra17121973
 
15th International Conference on Computer Science, Engineering and Applicatio...
15th International Conference on Computer Science, Engineering and Applicatio...15th International Conference on Computer Science, Engineering and Applicatio...
15th International Conference on Computer Science, Engineering and Applicatio...
IJCSES Journal
 
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxbMain cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
SunilSingh610661
 
introduction to machine learining for beginers
introduction to machine learining for beginersintroduction to machine learining for beginers
introduction to machine learining for beginers
JoydebSheet
 
Introduction to FLUID MECHANICS & KINEMATICS
Introduction to FLUID MECHANICS &  KINEMATICSIntroduction to FLUID MECHANICS &  KINEMATICS
Introduction to FLUID MECHANICS & KINEMATICS
narayanaswamygdas
 
Mathematical foundation machine learning.pdf
Mathematical foundation machine learning.pdfMathematical foundation machine learning.pdf
Mathematical foundation machine learning.pdf
TalhaShahid49
 
Raish Khanji GTU 8th sem Internship Report.pdf
Raish Khanji GTU 8th sem Internship Report.pdfRaish Khanji GTU 8th sem Internship Report.pdf
Raish Khanji GTU 8th sem Internship Report.pdf
RaishKhanji
 
Data Structures_Linear data structures Linked Lists.pptx
Data Structures_Linear data structures Linked Lists.pptxData Structures_Linear data structures Linked Lists.pptx
Data Structures_Linear data structures Linked Lists.pptx
RushaliDeshmukh2
 
Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...
Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...
Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...
Journal of Soft Computing in Civil Engineering
 
The Gaussian Process Modeling Module in UQLab
The Gaussian Process Modeling Module in UQLabThe Gaussian Process Modeling Module in UQLab
The Gaussian Process Modeling Module in UQLab
Journal of Soft Computing in Civil Engineering
 
LECTURE-16 EARTHEN DAM - II.pptx it's uses
LECTURE-16 EARTHEN DAM - II.pptx it's usesLECTURE-16 EARTHEN DAM - II.pptx it's uses
LECTURE-16 EARTHEN DAM - II.pptx it's uses
CLokeshBehera123
 
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design ThinkingDT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DhruvChotaliya2
 
Oil-gas_Unconventional oil and gass_reseviours.pdf
Oil-gas_Unconventional oil and gass_reseviours.pdfOil-gas_Unconventional oil and gass_reseviours.pdf
Oil-gas_Unconventional oil and gass_reseviours.pdf
M7md3li2
 
Metal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistryMetal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistry
mee23nu
 
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptxExplainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
MahaveerVPandit
 
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E..."Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
Infopitaara
 
some basics electrical and electronics knowledge
some basics electrical and electronics knowledgesome basics electrical and electronics knowledge
some basics electrical and electronics knowledge
nguyentrungdo88
 
lecture5.pptxJHKGJFHDGTFGYIUOIUIPIOIPUOHIYGUYFGIH
lecture5.pptxJHKGJFHDGTFGYIUOIUIPIOIPUOHIYGUYFGIHlecture5.pptxJHKGJFHDGTFGYIUOIUIPIOIPUOHIYGUYFGIH
lecture5.pptxJHKGJFHDGTFGYIUOIUIPIOIPUOHIYGUYFGIH
Abodahab
 
Degree_of_Automation.pdf for Instrumentation and industrial specialist
Degree_of_Automation.pdf for  Instrumentation  and industrial specialistDegree_of_Automation.pdf for  Instrumentation  and industrial specialist
Degree_of_Automation.pdf for Instrumentation and industrial specialist
shreyabhosale19
 
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
inmishra17121973
 
15th International Conference on Computer Science, Engineering and Applicatio...
15th International Conference on Computer Science, Engineering and Applicatio...15th International Conference on Computer Science, Engineering and Applicatio...
15th International Conference on Computer Science, Engineering and Applicatio...
IJCSES Journal
 
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxbMain cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
Main cotrol jdbjbdcnxbjbjzjjjcjicbjxbcjcxbjcxb
SunilSingh610661
 
introduction to machine learining for beginers
introduction to machine learining for beginersintroduction to machine learining for beginers
introduction to machine learining for beginers
JoydebSheet
 
Introduction to FLUID MECHANICS & KINEMATICS
Introduction to FLUID MECHANICS &  KINEMATICSIntroduction to FLUID MECHANICS &  KINEMATICS
Introduction to FLUID MECHANICS & KINEMATICS
narayanaswamygdas
 
Mathematical foundation machine learning.pdf
Mathematical foundation machine learning.pdfMathematical foundation machine learning.pdf
Mathematical foundation machine learning.pdf
TalhaShahid49
 
Raish Khanji GTU 8th sem Internship Report.pdf
Raish Khanji GTU 8th sem Internship Report.pdfRaish Khanji GTU 8th sem Internship Report.pdf
Raish Khanji GTU 8th sem Internship Report.pdf
RaishKhanji
 
Data Structures_Linear data structures Linked Lists.pptx
Data Structures_Linear data structures Linked Lists.pptxData Structures_Linear data structures Linked Lists.pptx
Data Structures_Linear data structures Linked Lists.pptx
RushaliDeshmukh2
 
LECTURE-16 EARTHEN DAM - II.pptx it's uses
LECTURE-16 EARTHEN DAM - II.pptx it's usesLECTURE-16 EARTHEN DAM - II.pptx it's uses
LECTURE-16 EARTHEN DAM - II.pptx it's uses
CLokeshBehera123
 
Ad

Various Operations Of Array(Data Structure Algorithm).pptx

  • 1. GOVERNMENT COLLEGE OF ENGINEERING AND TEXTILE TECHNOLOGY, SERAMPORE Continuous Assessment : 1 NAME OF THE TOPIC : VARIOUS OPERATION OF ARRAY Name : Atirath Pal University Registration No : 231100110042(2023-24) University Roll No : 11000123007 Department : Computer Science and Engineering Year : 2nd Year Semester : 3rd Sem Paper Name : Data Structure And Algorithm Paper Code : PCC-CS301
  • 2. Topics Discussed 1. Introduction to Array 2. Array Initialisation 3. Accessing Array Elements 4. Updating Array elements 5. Array Traversal 6. Searching An Array Element 7. Insertion and Deletion of an Array Element 8. Sorting an Array 9. Multi-Dimentional Array 10.Conclution
  • 3. Array  What is an array ? An array is a fixed-size collection of similar data items stored in contiguous memory locations. It can be used to store the collection of primitive data types such as int, char, float, etc., and also derived and user- defined data types such as pointers, structures etc.  Array Declaration In C and other programming languages, we have to declare the array like any other variable before using it. We can declare an array by specifying its name, the type of its elements, and the size of its dimensions. When we declare an array in C, the compiler allocates the memory block of the specified size to the array name. Syntax: Data_type array_name [size] Page Number 1
  • 4.  Array Initialization Initialization is the process to assign some initial value to the variable. When the array is declared or allocated memory, the elements of the array contain some garbage value. So, we need to initialize the array to some meaningful value. There are multiple ways in which we can initialize an array in C. 1. Array Initialization with Declaration In this method, we initialize the array along with its declaration. An initializer list is the list of values enclosed within braces { } separated b a comma. Syntax : datatype arrayname [size] = {value1, value2, ... valueN} 2. Array Initialization with Declaration without Size If we initialize an array using an initializer list, we can skip declaring the size of the array as the compiler can automatically deduce the size of the array in these cases. Syntax : data_type array_name[ ] = {1,2,3,4,5}; // array size is 5. 3. Array Initialization after Declaration (using loops) We can use for loop, while loop, or do-while loop to assign the value to each element of the array after declaration. int n =5; int arr[n]; for (int i = 0 ; i < n ; i+ +) { scanf("%d", &arr[i]); } Page Number 2
  • 5.  Access Array Elements We can access any element of an array using the array subscript operator [ ] and the index value i of the element. One thing to note is that the indexing in the array always starts with 0, i.e., the first element is at index 0 and the last element is at N – 1 where N is the number of elements in the array.  Update Array Element We can change the value of any element by using their index . Syntax : array_name[index] = updated value;  Array Traversal Traversal is the process in which we visit every element of the data structure. For this ,we use loops(for loop or while loop) to iterate through each element of the array. Syntax : using for loop for (int i = 0; i < N; i++) { array_name[i]; } Page Number 3
  • 6.  Searching in Array Searching for an element in an array involves checking whether a specific value exists in the array and finding its position if it does. If the element does not exist then we usually return false; There are two common techniques for searching in an array . 1. Binary Search 2. Linear search Searching Algorithm Time Complexity Auxiliary Space Binary Search O(log 2 N) O(1) Linear Search O(N) for worst case O(1) Binary Search : Works on sorted arrays, repeatedly dividing the search interval in half. This is usefull when the array is sorted. Linear search : Sequentially checks each element until a match is found. This is usefull when the array is Unsorted. Page Number 4
  • 7. Insert operation in an array at any position can be performed by shifting elements to the right, which are on the right side of the required position.  Insertion & Deletion of elements from an Array To Delete an element from an Array , We need its Specific Index . After Deleting the element all the right side element will shift one box towards left. // Inserting an element. void insertElement(int arr[], int n, int x, int pos) { for (int i = n - 1; i >= pos; i--) arr[i + 1] = arr[i]; arr[pos] = x; } Page Number 5
  • 8.  Sorting An Array Sorting an array in ascending order means arranging the elements from smallest element to largest element. There are many ways by which the array can be sorted. 1. Selection Sort 2. Bubble Sort 3. Insertion Sort 4. Merge Sort 5. Quick Sort 1. Selection Sort : Finds the minimum element from the unsorted part of the array and places it at the beginning of the sorted part of the array . 2. Bubble Sort : Repeatedly compares adjacent elements and swaps them if they are in the wrong order. 3. Insertion Sort : Builds a sorted subarray by inserting elements into their correct positions. 4. Merge Sort : Divides the array into subarrays, sorts them recursively, and then merges the sorted subarrays. 5. Quick Sort : QuickSort is a sorting algorithm based on the Divide and Conquer algorithm that picks an element as a pivot and partitions the given array around the picked pivot. Sorting Algorithm Time Complexity Auxiliary Space 1. Selection Sort 2. Bubble Sort 3. Insertion Sort 4. Merge Sort 5. Quick Sort Page Number 6
  • 9. Page Number 7 Multi-Dimentional Array A multi-dimensional array is an array with more than one level or dimension. For example, a 2D array, or two-dimensional array, is an array of arrays, meaning it is a matrix of rows and columns (think of a table). Syntax : data_type array_name[size1][size2].... [sizeN]; data_type: Type of data to be stored in the array. array_name: Name of the array. size1, size2,…, sizeN: Size of each dimension. int x[3][2] = { { 0, 1 }, { 2, 3 }, { 4, 5 } }; // output each array element's value for (int i = 0; i < 3; i++) { for (int j = 0; j < 2; j++) { printf("Element at x[%i][%i]: ", i, j); printf("%dn", x[i][j]); } }
  • 10. Page Number 8 ConClution Arrays are fundamental data structure in programming. Arrays provide a powerful and efficient way to store and manipulate collections of data.  Initialization and Declaration: How to create and define arrays.  Accessing and Modifying Elements: Techniques to retrieve and update array elements.  Array Traversal: Methods to iterate through arrays, including loops and built-in functions.  Array Manipulations: Operations such as insertion, deletion, sorting, and searching within arrays.  Multidimensional Arrays: Understanding arrays with multiple dimensions and their use cases.  Advanced Operations: Exploring functions like merging, splitting, and applying mathematical operations across array elements. Reference https://www.geeksforgeeks.org/multidimensional-arrays-in-c/ Data Structure And Algorithm by Ronald Rivest https://www.geeksforgeeks.org/c-arrays/ https://www.programiz.com/c-programming/c-arrays