02. Array
02. Array
2
Questions
4
Types of Data Structure
5
https://simplerize.com/data-structures/data-structure-introduction
Linear Data Structure vs Non-Linear Data Structure
7
https://simplerize.com/data-structures/data-structure-introduction
Linear Data Structure
8
Types of Linear Data Structures
9
Types of Data Structure
10
https://simplerize.com/data-structures/data-structure-introduction
Array
11
Characteristics of Arrays in Data Structures
❖ Fixed Size: Once an array is declared, its size cannot be changed. You
need to know the number of elements you will store in the array
beforehand.
❖ Homogeneous Elements: All elements in an array must be of the same
data type, such as all integers, all floats, or all characters.
12
Characteristics of Arrays in Data Structures
13
Types of Arrays based on Dimensions
❏ One-Dimensional Arrays
❏ Two-Dimensional Array
❏ Multi-Dimensional Array
14
Types of Arrays based on Dimensions-One-
Dimensional Array
15
Types of Arrays based on Dimensions-One-
Dimensional Array
❖ Example: A small shop could use a 1D array to keep track of the quantity
of each product in stock. Each index in the array represents a different
product, and the value at that index represents the current stock level.
16
Types of Arrays based on Dimensions - Two-
Dimensional Array
17
Types of Arrays based on Dimensions - Multi-
Dimensional Array
18
Types of Arrays based on Dimensions: Summary
19
Types of Arrays based on Dimensions
20
Basics of Array in Data Structures
❖ Static Arrays
❖ Dynamic Arrays
21
Basics of Array in Data Structures
Static Arrays
❖ A static array has a fixed size, which means the number of elements it
can hold is defined when the array is declared and cannot be
Dynamic Arrays
organization of data
memory of a computer
https://blog.bytebytego.com/p/storage-systems-overview
25
Storage Structure Or Memory Representation
26
Memory Representation in Different Languages
● The amount of memory that an array uses depends on the data type used
to create the array.
29
In Java, memory allocation for arrays
● The amount of memory that an array uses depends on the data type used
to create the array.
30
Why not mixed types
31
Why not mixed types
32
Why not mixed types
33
Why not mixed types
34
Why not mixed types
35
Why not mixed types
36
Why not mixed types
37
Why Java script, Python, .. does not have any problem?
38
Why Java script, Python, .. does not have any problem?
39
Why Java script, Python, .. does not have any problem?
40
Why Java script, Python, .. does not have any problem?
41
JavaScript for mixed type
42
JavaScript for mixed type
43
JavaScript for mixed type
44
JavaScript for mixed type
45
Operations on Array
47
Insertion in Arrays
Types of Insertion
48
Deletion in Array
Types of Deletion
● At the Beginning: Remove
the first element of the array.
● At the End: Remove the last
element of the array.
● At a Specific Position:
Remove an element from a
given index in the array.
49
Sorting an array
❖ Counting Sort
❖ Insertion Sort
❖ Bubble Sort
❖ Selection Sort
❖ Merge Sort
❖ Quick Sort
50
THANKS!
59
60