CSC 301
DATA STRUCTURES
Friday, 07/02/25
Uchenna-Declan
Mba
Objectives
Understanding the need for Data
Structure in programming.
Common operations
Advantages and Similarities
Classification and Characteristics
Implementing Data Structures in
Java
Data Structure
Is a specialized format for
organizing, storing, and accessing
data within a computer’s memory.
Is algorithms that can be used in
any programming language to
organize the data in the memory
for efficient updates.
Need for Data Structure
(Fundamental )
Performance: Choosing the right data structure
significantly impacts how quickly your program can
access and process information. For example,
searching an unsorted list takes much longer than
searching a sorted array.
Memory Management: Data structures help
optimize memory usage, preventing wasted space
and improving program efficiency (memory trade-
off).
Code Reusability: Well-defined data structures can
be reused across different parts of your program or
even other programs, saving development time and
promoting consistency.
Need for Data Structure
(Essential )
Data structure modification is
easy.
It requires less time (time trade-
off).
Data representation is easy.
Easy access to the large database.
Data Type VS Data
Structure
Data Structure VS
Data Type
Advantages
Data structures allow storing the information on hard
disks.
An appropriate choice of ADT (Abstract Data Type)
makes the program more efficient.
Data Structures are necessary for designing efficient
algorithms.
It provides reusability and abstraction.
Using appropriate data structures can help
programmers save a good amount of time while
performing operations such as storage, retrieval, or
processing of data.
Manipulation of large amounts of data is easier.
This is a conceptual model that defines a set of
operations and behaviors for a data structure, without
specifying how these operations are implemented and
organized in the memory.
Only what operations are to be performed but not how
these operations will be implemented.
Classification of Data
Structure
Linear Vs Non-linear
Linear data structure: Data structure in
which data elements are arranged
sequentially or linearly, where each element
is attached to its previous and next adjacent
elements, is called a linear data structure.
Non-linear data structure: Data structures
where data elements are not placed
sequentially or linearly are called non-linear
data structures. In a non-linear data structure,
we can’t traverse all the elements in a single
run only.
Static Vs Dynamic
Static data structure has a fixed memory
size. It is easier to access the elements in
a static data structure. E.g, Array
In dynamic data structure, the size is not
fixed. It can be randomly updated during
the runtime which may be considered
efficient concerning the memory (space)
complexity of the code.
E.g, queue, stack, etc.
Arrays
An array is a linear data structure and it is a
collection of items stored at contiguous
memory locations. The idea is to store
multiple items of the same type together in
one place. It allows the processing of a large
amount of data in a relatively short period.
The first element of the array is indexed by a
subscript of 0.
Arrays
Characteristics of an
Array
Arrays use an index-based data structure which
helps to identify each of the elements in an
array easily using the index.
If a user wants to store multiple values of the
same data type, then the array can be utilized
efficiently.
An array can also handle complex data
structures by storing data in a two-dimensional
array.
An array is also used to implement other data
structures like Stacks, Queues, Heaps, Hash
tables, etc.
Operations performed
on Array
Initialization: An array can be initialized with values at the
time of declaration or later using an assignment statement.
Accessing elements: Elements in an array can be
accessed by their index, which starts from 0 and goes up to
the size of the array minus one.
Searching for elements: Arrays can be searched for a
specific element using linear search or binary search
algorithms.
Sorting elements: Elements in an array can be sorted in
ascending or descending order using algorithms like bubble
sort, insertion sort, or quick sort.
Operations performed
on Array
Inserting elements: Elements can be inserted into an array at
a specific location, but this operation can be time-consuming
because it requires shifting existing elements in the array.
Deleting elements: Elements can be deleted from an array by
shifting the elements that come after it to fill the gap.
Updating elements: Elements in an array can be updated or
modified by assigning a new value to a specific index.
Traversing elements: The elements in an array can be
traversed in order, visiting each element once.
Applications of Arrays
Used in solving matrix problems.
Database records are also implemented by an array.
It helps in implementing a sorting algorithm.
Used for CPU scheduling.
Can be applied as a lookup table in computers.
Used in speech processing where every speech signal is
an array.
The screen of the computer is also displayed by an
array. Here we use a multidimensional array.
The array is used in many management systems like a
library, students, parliament, etc.
The array is used in the online ticket booking system.
Contacts on a cell phone are displayed by this array.
Applications of Arrays
In games like online chess, where the player can store
his past moves as well as current moves. It indicates a
hint of position.
To save images in a specific dimension in the android
Like 360*1200
Real-Life Applications of Array:
An array is frequently used to store data for
mathematical computations.
It is used in image processing.
It is also used in record management.
Book pages are also real-life examples of an array.
Announcement
Next class on Tuesday (11/02/25),
10am-12pm.
Reason: Departmental burial