SlideShare a Scribd company logo
1 of 22
Download to read offline
Algorithm and
Data Structure
Andi Nurkholis, S.Kom, M.Kom
Study Program of Informatics
Faculty of Engineering and Computer Science
SY. 2020-2021
February 22, 2021
2
2 Array and Struct
3
What is Array?
Array also known as “larik”. Array is data collections
with each data element using same name and type
Each component/element of array can be accessed
and distinguished through index
4
Type of Array 1) One-Dimensional Array
2) Multi-Dimensional Array
5
One-Dimensional Array
A collection of identical elements arranged in a row. These
elements have the same data type, but content of those elements
may be different
6
Example
2 4 8 16 32 64 128 256 512 1024
0 1 2 3 4 5 6 7 8 9
Index
Data
dataType ArrayName[ElementNumber]={<Initialization>};
ArrayName [index];
Declaration
Access
7
Multi-Dimensional Array
Multi-dimensional array is data collections consisting of rows
and columns of elements of the same type
8
Example
(0,0) (0,1) (0,2)
(1,0) (1,1) (1,2)
(2,0) (2,1) (2,2)
(3,0) (3,1) (3,2)
(4,0) (4,1) (4,2)
(0,0) (0,1) (0,2) (0,3)
(1,0) (1,1) (1,2) (1,3)
(2,0) (2,1) (2,2) (2,3)
(3,0) (3,1) (3,2) (3,3)
(0,0) (0,1) (0,2) (0,3) (0,4) (0,5)
(1,0) (1,1) (1,2) (1,3) (1,4) (1,5)
(2,0) (2,1) (2,2) (2,3) (2,4) (2,5)
(3,0) (3,1) (3,2) (3,3) (3,4) (3,5)
(4,0) (4,1) (4,2) (4,3) (4,4) (4,5)
2-D Array 5x3
2-D Array 4x4
2-D Array 5x6
9
Example (Cont.)
dataType ArrayName [Row][Column] =
{
{<RowInitialization1>},{< RowInitialization2>},{<RowInitializationN>}
{<RowInitialization1>},{< RowInitialization2>},{<RowInitializationN>}
};
ArrayName [Row][Column];
Declaration
Access
10
Record / Struct
Record is data collections that is not similar or
varied. In C, record also known as struct
The difference between record and array is that
record can be filled with data that have different data
type
11
Example
struct nama_type_record {tipe_data1 nm_var1; tipe_data2 nm_var2;
tipe_dataN nm_varN;} var_record;
General form of record
12
Example (Cont.)
struct mahasiswa { char nama[20]; char npm[10], int nilai;
} nilaiMhs;
nilaiMhs.nama;
nilaiMhs.npm;
nilaiMhs.nilai;
Declaration
Access
13
Record in Array
Record in array make it possible to store record data in an array
index.
That is, using this technique can store some data that has different
data types in an array
For example, some students can have a name and value.
14
Example
struct nama_type_record {tipe_data1 nm_var1; tipe_data2 nm_var2;
tipe_dataN nm_varN;} var_record[ArrayElement];
General form of record in array
15
Example (Cont.)
struct mahasiswa { char nama[20]; int nilai;
} nilaiMhs[3];
nilaiMhs[0].nama;
nilaiMhs[0].nilai;
Declaration
Access
16
Array in Record
Arrays in a record make it possible to store array data in a record.
That is, using this technique can store multiple indexes of array
data into a record that has a different data type.
For example, a student can have a name and several grades.
17
Example
struct nama_type_record {tipe_data1 nm_var1[ArrayElement];
tipe_data2 nm_var2[ArrayElement];
tipe_dataN nm_varN;[ArrayElement]}
var_record;
General form of array in record
18
Example (Cont.)
struct mahasiswa { char nama[20][3]; int nilai[3];
} nilaiMhs;
nilaiMhs.nama[0];
nilaiMhs.nilai[0];
Declaration
Access
19
Array in Array Record
Arrays in a array record make it possible to store array data in a
array record.
That is, using this technique can store multiple indexes of array
data into multiple record that has a different data type.
For example, each of student can have a name and several grades.
20
Example
General form of array in record array
struct nama_type_record {tipe_data1 nm_var1[ArrayElement];
tipe_data2 nm_var2[ArrayElement];
tipe_dataN nm_varN;[ArrayElement]}
var_record[ArrayElement];
21
Example (Cont.)
struct mahasiswa { char nama[20][3]; int nilai[3];
} nilaiMhs[3];
nilaiMhs[1].nama[0];
nilaiMhs[1].nilai[0];
Declaration
Access
Thank You, Next …
Modular Programming
February 22, 2021
Andi Nurkholis, S.Kom, M.Kom
Study Program of Informatics
Faculty of Engineering and Computer Science
SY. 2020-2021

More Related Content

What's hot (20)

Dynamic memory allocation and linked lists
Dynamic memory allocation and linked listsDynamic memory allocation and linked lists
Dynamic memory allocation and linked lists
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
Matlab Organizing Data
Matlab Organizing DataMatlab Organizing Data
Matlab Organizing Data
 
collections
 collections collections
collections
 
Elementary data organisation
Elementary data organisationElementary data organisation
Elementary data organisation
 
2 d array
2 d array2 d array
2 d array
 
Lecture1 data structure(introduction)
Lecture1 data structure(introduction)Lecture1 data structure(introduction)
Lecture1 data structure(introduction)
 
introduction to Data Structure and classification
 introduction to Data Structure and classification introduction to Data Structure and classification
introduction to Data Structure and classification
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
concept of data structure
concept of data structureconcept of data structure
concept of data structure
 
Introduction to arrays
Introduction to arraysIntroduction to arrays
Introduction to arrays
 
Basic terminologies
Basic terminologiesBasic terminologies
Basic terminologies
 
Mca ii dfs u-1 introduction to data structure
Mca ii dfs u-1 introduction to data structureMca ii dfs u-1 introduction to data structure
Mca ii dfs u-1 introduction to data structure
 
Introduction linked list
Introduction linked listIntroduction linked list
Introduction linked list
 
12. arrays
12. arrays12. arrays
12. arrays
 
Arrays in C
Arrays in CArrays in C
Arrays in C
 
Arrays declartion and initialization
Arrays declartion and initializationArrays declartion and initialization
Arrays declartion and initialization
 
Data structures
Data structures Data structures
Data structures
 
Using xml in a data set (ado.net)
Using xml in a data set (ado.net)Using xml in a data set (ado.net)
Using xml in a data set (ado.net)
 
Abstract data types (adt) intro to data structure part 2
Abstract data types (adt)   intro to data structure part 2Abstract data types (adt)   intro to data structure part 2
Abstract data types (adt) intro to data structure part 2
 

Similar to Algorithm and Data Structure - Array and Struct

Presentation on array
Presentation on array Presentation on array
Presentation on array topu93
 
Array Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional arrayArray Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional arrayimtiazalijoono
 
array-191103180006.pdf
array-191103180006.pdfarray-191103180006.pdf
array-191103180006.pdfHEMAHEMS5
 
Arrays accessing using for loops
Arrays accessing using for loopsArrays accessing using for loops
Arrays accessing using for loopssangrampatil81
 
Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm KristinaBorooah
 
Chapter 4 (Part I) - Array and Strings.pdf
Chapter 4 (Part I) - Array and Strings.pdfChapter 4 (Part I) - Array and Strings.pdf
Chapter 4 (Part I) - Array and Strings.pdfKirubelWondwoson1
 
concept of Array, 1D & 2D array
concept of Array, 1D & 2D arrayconcept of Array, 1D & 2D array
concept of Array, 1D & 2D arraySangani Ankur
 
Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT
Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT
Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT LATHA LAKSHMI
 
BHARGAVIARRAY.PPT.pptx
BHARGAVIARRAY.PPT.pptxBHARGAVIARRAY.PPT.pptx
BHARGAVIARRAY.PPT.pptxSasideepa
 

Similar to Algorithm and Data Structure - Array and Struct (20)

arrays.docx
arrays.docxarrays.docx
arrays.docx
 
Array
ArrayArray
Array
 
Presentation on array
Presentation on array Presentation on array
Presentation on array
 
Array lecture
Array lectureArray lecture
Array lecture
 
Arrays
ArraysArrays
Arrays
 
Array Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional arrayArray Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional array
 
array-191103180006.pdf
array-191103180006.pdfarray-191103180006.pdf
array-191103180006.pdf
 
DSA-Lecture-05
DSA-Lecture-05DSA-Lecture-05
DSA-Lecture-05
 
Arrays accessing using for loops
Arrays accessing using for loopsArrays accessing using for loops
Arrays accessing using for loops
 
Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm
 
Chapter 4 (Part I) - Array and Strings.pdf
Chapter 4 (Part I) - Array and Strings.pdfChapter 4 (Part I) - Array and Strings.pdf
Chapter 4 (Part I) - Array and Strings.pdf
 
Arrays in c
Arrays in cArrays in c
Arrays in c
 
concept of Array, 1D & 2D array
concept of Array, 1D & 2D arrayconcept of Array, 1D & 2D array
concept of Array, 1D & 2D array
 
Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT
Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT
Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT
 
Array in C
Array in CArray in C
Array in C
 
BHARGAVIARRAY.PPT.pptx
BHARGAVIARRAY.PPT.pptxBHARGAVIARRAY.PPT.pptx
BHARGAVIARRAY.PPT.pptx
 
Arrays.pptx
Arrays.pptxArrays.pptx
Arrays.pptx
 
DS_PPT.pptx
DS_PPT.pptxDS_PPT.pptx
DS_PPT.pptx
 
Array
ArrayArray
Array
 
Lecture 2a arrays
Lecture 2a arraysLecture 2a arrays
Lecture 2a arrays
 

More from AndiNurkholis1

Mobile Programming - 10 Firebase
Mobile Programming - 10 FirebaseMobile Programming - 10 Firebase
Mobile Programming - 10 FirebaseAndiNurkholis1
 
Mobile Programming - 9 Profile UI, Navigation Basic and Splash Screen
Mobile Programming - 9 Profile UI, Navigation Basic and Splash ScreenMobile Programming - 9 Profile UI, Navigation Basic and Splash Screen
Mobile Programming - 9 Profile UI, Navigation Basic and Splash ScreenAndiNurkholis1
 
Mobile Programming - 8 Progress Bar, Draggable Music Knob, Timer
Mobile Programming - 8 Progress Bar, Draggable Music Knob, TimerMobile Programming - 8 Progress Bar, Draggable Music Knob, Timer
Mobile Programming - 8 Progress Bar, Draggable Music Knob, TimerAndiNurkholis1
 
Mobile Programming - 7 Side Effects, Effect Handlers, and Simple Animations
Mobile Programming - 7 Side Effects, Effect Handlers, and Simple AnimationsMobile Programming - 7 Side Effects, Effect Handlers, and Simple Animations
Mobile Programming - 7 Side Effects, Effect Handlers, and Simple AnimationsAndiNurkholis1
 
Mobile Programming - 6 Textfields, Button, Showing Snackbars and Lists
Mobile Programming - 6 Textfields, Button, Showing Snackbars and ListsMobile Programming - 6 Textfields, Button, Showing Snackbars and Lists
Mobile Programming - 6 Textfields, Button, Showing Snackbars and ListsAndiNurkholis1
 
Mobile Programming - 5 Stylling Text and State
Mobile Programming - 5 Stylling Text and StateMobile Programming - 5 Stylling Text and State
Mobile Programming - 5 Stylling Text and StateAndiNurkholis1
 
Mobile Programming - 4 Modifiers and Image Card
Mobile Programming - 4 Modifiers and Image CardMobile Programming - 4 Modifiers and Image Card
Mobile Programming - 4 Modifiers and Image CardAndiNurkholis1
 
Mobile Programming - 3 Rows, Column and Basic Sizing
Mobile Programming - 3 Rows, Column and Basic SizingMobile Programming - 3 Rows, Column and Basic Sizing
Mobile Programming - 3 Rows, Column and Basic SizingAndiNurkholis1
 
Algoritma dan Struktur Data (Python) - Struktur Data
Algoritma dan Struktur Data (Python) - Struktur DataAlgoritma dan Struktur Data (Python) - Struktur Data
Algoritma dan Struktur Data (Python) - Struktur DataAndiNurkholis1
 
Mobile Programming - 2 Jetpack Compose
Mobile Programming - 2 Jetpack ComposeMobile Programming - 2 Jetpack Compose
Mobile Programming - 2 Jetpack ComposeAndiNurkholis1
 
Mobile Programming - 1 Introduction
Mobile Programming - 1 IntroductionMobile Programming - 1 Introduction
Mobile Programming - 1 IntroductionAndiNurkholis1
 
Algoritma dan Struktur Data (Python) - Perulangan
Algoritma dan Struktur Data (Python) - PerulanganAlgoritma dan Struktur Data (Python) - Perulangan
Algoritma dan Struktur Data (Python) - PerulanganAndiNurkholis1
 
Algoritma dan Struktur Data (Python) - Percabangan
Algoritma dan Struktur Data (Python) - PercabanganAlgoritma dan Struktur Data (Python) - Percabangan
Algoritma dan Struktur Data (Python) - PercabanganAndiNurkholis1
 
Algoritma dan Struktur Data (Python) - Struktur I/O
Algoritma dan Struktur Data (Python) - Struktur I/OAlgoritma dan Struktur Data (Python) - Struktur I/O
Algoritma dan Struktur Data (Python) - Struktur I/OAndiNurkholis1
 
Algoritma dan Struktur Data (Python) - Notasi Algoritmik
Algoritma dan Struktur Data (Python) - Notasi AlgoritmikAlgoritma dan Struktur Data (Python) - Notasi Algoritmik
Algoritma dan Struktur Data (Python) - Notasi AlgoritmikAndiNurkholis1
 
Algoritma dan Struktur Data (Python) - Pengantar Algoritma
Algoritma dan Struktur Data (Python) - Pengantar AlgoritmaAlgoritma dan Struktur Data (Python) - Pengantar Algoritma
Algoritma dan Struktur Data (Python) - Pengantar AlgoritmaAndiNurkholis1
 
Algorithm and Data Structure - Binary Search
Algorithm and Data Structure - Binary SearchAlgorithm and Data Structure - Binary Search
Algorithm and Data Structure - Binary SearchAndiNurkholis1
 
Algorithm and Data Structure - Linear Search
Algorithm and Data Structure - Linear SearchAlgorithm and Data Structure - Linear Search
Algorithm and Data Structure - Linear SearchAndiNurkholis1
 
Algorithm and Data Structure - Queue
Algorithm and Data Structure - QueueAlgorithm and Data Structure - Queue
Algorithm and Data Structure - QueueAndiNurkholis1
 
Algorithm and Data Structure - Stack
Algorithm and Data Structure - StackAlgorithm and Data Structure - Stack
Algorithm and Data Structure - StackAndiNurkholis1
 

More from AndiNurkholis1 (20)

Mobile Programming - 10 Firebase
Mobile Programming - 10 FirebaseMobile Programming - 10 Firebase
Mobile Programming - 10 Firebase
 
Mobile Programming - 9 Profile UI, Navigation Basic and Splash Screen
Mobile Programming - 9 Profile UI, Navigation Basic and Splash ScreenMobile Programming - 9 Profile UI, Navigation Basic and Splash Screen
Mobile Programming - 9 Profile UI, Navigation Basic and Splash Screen
 
Mobile Programming - 8 Progress Bar, Draggable Music Knob, Timer
Mobile Programming - 8 Progress Bar, Draggable Music Knob, TimerMobile Programming - 8 Progress Bar, Draggable Music Knob, Timer
Mobile Programming - 8 Progress Bar, Draggable Music Knob, Timer
 
Mobile Programming - 7 Side Effects, Effect Handlers, and Simple Animations
Mobile Programming - 7 Side Effects, Effect Handlers, and Simple AnimationsMobile Programming - 7 Side Effects, Effect Handlers, and Simple Animations
Mobile Programming - 7 Side Effects, Effect Handlers, and Simple Animations
 
Mobile Programming - 6 Textfields, Button, Showing Snackbars and Lists
Mobile Programming - 6 Textfields, Button, Showing Snackbars and ListsMobile Programming - 6 Textfields, Button, Showing Snackbars and Lists
Mobile Programming - 6 Textfields, Button, Showing Snackbars and Lists
 
Mobile Programming - 5 Stylling Text and State
Mobile Programming - 5 Stylling Text and StateMobile Programming - 5 Stylling Text and State
Mobile Programming - 5 Stylling Text and State
 
Mobile Programming - 4 Modifiers and Image Card
Mobile Programming - 4 Modifiers and Image CardMobile Programming - 4 Modifiers and Image Card
Mobile Programming - 4 Modifiers and Image Card
 
Mobile Programming - 3 Rows, Column and Basic Sizing
Mobile Programming - 3 Rows, Column and Basic SizingMobile Programming - 3 Rows, Column and Basic Sizing
Mobile Programming - 3 Rows, Column and Basic Sizing
 
Algoritma dan Struktur Data (Python) - Struktur Data
Algoritma dan Struktur Data (Python) - Struktur DataAlgoritma dan Struktur Data (Python) - Struktur Data
Algoritma dan Struktur Data (Python) - Struktur Data
 
Mobile Programming - 2 Jetpack Compose
Mobile Programming - 2 Jetpack ComposeMobile Programming - 2 Jetpack Compose
Mobile Programming - 2 Jetpack Compose
 
Mobile Programming - 1 Introduction
Mobile Programming - 1 IntroductionMobile Programming - 1 Introduction
Mobile Programming - 1 Introduction
 
Algoritma dan Struktur Data (Python) - Perulangan
Algoritma dan Struktur Data (Python) - PerulanganAlgoritma dan Struktur Data (Python) - Perulangan
Algoritma dan Struktur Data (Python) - Perulangan
 
Algoritma dan Struktur Data (Python) - Percabangan
Algoritma dan Struktur Data (Python) - PercabanganAlgoritma dan Struktur Data (Python) - Percabangan
Algoritma dan Struktur Data (Python) - Percabangan
 
Algoritma dan Struktur Data (Python) - Struktur I/O
Algoritma dan Struktur Data (Python) - Struktur I/OAlgoritma dan Struktur Data (Python) - Struktur I/O
Algoritma dan Struktur Data (Python) - Struktur I/O
 
Algoritma dan Struktur Data (Python) - Notasi Algoritmik
Algoritma dan Struktur Data (Python) - Notasi AlgoritmikAlgoritma dan Struktur Data (Python) - Notasi Algoritmik
Algoritma dan Struktur Data (Python) - Notasi Algoritmik
 
Algoritma dan Struktur Data (Python) - Pengantar Algoritma
Algoritma dan Struktur Data (Python) - Pengantar AlgoritmaAlgoritma dan Struktur Data (Python) - Pengantar Algoritma
Algoritma dan Struktur Data (Python) - Pengantar Algoritma
 
Algorithm and Data Structure - Binary Search
Algorithm and Data Structure - Binary SearchAlgorithm and Data Structure - Binary Search
Algorithm and Data Structure - Binary Search
 
Algorithm and Data Structure - Linear Search
Algorithm and Data Structure - Linear SearchAlgorithm and Data Structure - Linear Search
Algorithm and Data Structure - Linear Search
 
Algorithm and Data Structure - Queue
Algorithm and Data Structure - QueueAlgorithm and Data Structure - Queue
Algorithm and Data Structure - Queue
 
Algorithm and Data Structure - Stack
Algorithm and Data Structure - StackAlgorithm and Data Structure - Stack
Algorithm and Data Structure - Stack
 

Recently uploaded

"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 

Algorithm and Data Structure - Array and Struct

  • 1. Algorithm and Data Structure Andi Nurkholis, S.Kom, M.Kom Study Program of Informatics Faculty of Engineering and Computer Science SY. 2020-2021 February 22, 2021
  • 2. 2 2 Array and Struct
  • 3. 3 What is Array? Array also known as “larik”. Array is data collections with each data element using same name and type Each component/element of array can be accessed and distinguished through index
  • 4. 4 Type of Array 1) One-Dimensional Array 2) Multi-Dimensional Array
  • 5. 5 One-Dimensional Array A collection of identical elements arranged in a row. These elements have the same data type, but content of those elements may be different
  • 6. 6 Example 2 4 8 16 32 64 128 256 512 1024 0 1 2 3 4 5 6 7 8 9 Index Data dataType ArrayName[ElementNumber]={<Initialization>}; ArrayName [index]; Declaration Access
  • 7. 7 Multi-Dimensional Array Multi-dimensional array is data collections consisting of rows and columns of elements of the same type
  • 8. 8 Example (0,0) (0,1) (0,2) (1,0) (1,1) (1,2) (2,0) (2,1) (2,2) (3,0) (3,1) (3,2) (4,0) (4,1) (4,2) (0,0) (0,1) (0,2) (0,3) (1,0) (1,1) (1,2) (1,3) (2,0) (2,1) (2,2) (2,3) (3,0) (3,1) (3,2) (3,3) (0,0) (0,1) (0,2) (0,3) (0,4) (0,5) (1,0) (1,1) (1,2) (1,3) (1,4) (1,5) (2,0) (2,1) (2,2) (2,3) (2,4) (2,5) (3,0) (3,1) (3,2) (3,3) (3,4) (3,5) (4,0) (4,1) (4,2) (4,3) (4,4) (4,5) 2-D Array 5x3 2-D Array 4x4 2-D Array 5x6
  • 9. 9 Example (Cont.) dataType ArrayName [Row][Column] = { {<RowInitialization1>},{< RowInitialization2>},{<RowInitializationN>} {<RowInitialization1>},{< RowInitialization2>},{<RowInitializationN>} }; ArrayName [Row][Column]; Declaration Access
  • 10. 10 Record / Struct Record is data collections that is not similar or varied. In C, record also known as struct The difference between record and array is that record can be filled with data that have different data type
  • 11. 11 Example struct nama_type_record {tipe_data1 nm_var1; tipe_data2 nm_var2; tipe_dataN nm_varN;} var_record; General form of record
  • 12. 12 Example (Cont.) struct mahasiswa { char nama[20]; char npm[10], int nilai; } nilaiMhs; nilaiMhs.nama; nilaiMhs.npm; nilaiMhs.nilai; Declaration Access
  • 13. 13 Record in Array Record in array make it possible to store record data in an array index. That is, using this technique can store some data that has different data types in an array For example, some students can have a name and value.
  • 14. 14 Example struct nama_type_record {tipe_data1 nm_var1; tipe_data2 nm_var2; tipe_dataN nm_varN;} var_record[ArrayElement]; General form of record in array
  • 15. 15 Example (Cont.) struct mahasiswa { char nama[20]; int nilai; } nilaiMhs[3]; nilaiMhs[0].nama; nilaiMhs[0].nilai; Declaration Access
  • 16. 16 Array in Record Arrays in a record make it possible to store array data in a record. That is, using this technique can store multiple indexes of array data into a record that has a different data type. For example, a student can have a name and several grades.
  • 17. 17 Example struct nama_type_record {tipe_data1 nm_var1[ArrayElement]; tipe_data2 nm_var2[ArrayElement]; tipe_dataN nm_varN;[ArrayElement]} var_record; General form of array in record
  • 18. 18 Example (Cont.) struct mahasiswa { char nama[20][3]; int nilai[3]; } nilaiMhs; nilaiMhs.nama[0]; nilaiMhs.nilai[0]; Declaration Access
  • 19. 19 Array in Array Record Arrays in a array record make it possible to store array data in a array record. That is, using this technique can store multiple indexes of array data into multiple record that has a different data type. For example, each of student can have a name and several grades.
  • 20. 20 Example General form of array in record array struct nama_type_record {tipe_data1 nm_var1[ArrayElement]; tipe_data2 nm_var2[ArrayElement]; tipe_dataN nm_varN;[ArrayElement]} var_record[ArrayElement];
  • 21. 21 Example (Cont.) struct mahasiswa { char nama[20][3]; int nilai[3]; } nilaiMhs[3]; nilaiMhs[1].nama[0]; nilaiMhs[1].nilai[0]; Declaration Access
  • 22. Thank You, Next … Modular Programming February 22, 2021 Andi Nurkholis, S.Kom, M.Kom Study Program of Informatics Faculty of Engineering and Computer Science SY. 2020-2021