Module 1 - Arrays
Module 1 - Arrays
Introduction
Definition of Array
https://www.youtube.com/watch?v=55l-aZ7_F24
Types of Indexing
1. Zero-based Indexing: The index of the array starts from 0. This type of indexing is the
most common type and seen in languages such as Java, C, C++, etc.
2. One-based Indexing: The index of the array starts from 1. This type of indexing is seen
in languages such as R, MATLAB.
3. n-based Indexing: The indices in such languages can start and end at any integer value.
This type of indexing is seen in languages such as Ada.
Traversing
• In the above algorithm, N is the length of the array. Most languages will provide an
interface to get the length of an array. For example, in Java, array.length (length property
of the array class) will give you the length. In python, the len(list) function will give you
the length of the list.
• Note: Python lists are not pure arrays because they allow heterogeneous data types in
them and don't always store elements in contiguous locations
In order to delete or update an element, we need to look at how to search in an array. We will
cover that in a future module. For now, think of "search" as a function you can call in your
update/delete routine.
Multidimensional Arrays