Module 1 Introduction to Data Structures
Module 1 Introduction to Data Structures
INTRODUCTION TO
DATA STRUCTURES
LEARNING OBJECTIVES
LET’S PROCESS
Algorithm
Features of algorithm
1. Pseudocode
Pseudocode is a compact and informal high-level description of a
computer programming algorithm that uses the structural conventions of
some programming language, but is intended for human reading rather
than machine reading. It is the English-like representation of logic.
Pseudocode can become comments and can be applied to any program.
There is an easy translation from pseudocode into program.
2. Flowcharts
Flowcharts are visual representation of logic flow showing required
operations. It emphasizes flow of events. Flowcharts are easier to review
by peers because it is appropriate for designs that follow logical sequence
of events.
Data Structure
Source: https://www.geeksforgeeks.org/difference-between-linear-and-non-linear-data-structures/
Figure 1.1. Types and examples of data structures.
1. Data Organization
We need a proper way of organizing the data so that it can be
accessed efficiently when we need that particular data. Data structure
provides different ways of data organization so we have options to store
the data in different data structures based on the requirement.
2. Efficiency
The main reason we organize the data is to improve the efficiency.
We can store the data in arrays then why do we need linked lists and
other data structures? Because when we need to perform several
operations such as add, delete, update and search on arrays, it takes
more time in arrays than some of the other data structures. So the fact
that we are interested in other data structures is because of the
efficiency.
LET’S PROCESS
Imagine that you are hired by company XYZ to organize all of their
records into a computer database. The first thing you are asked to do is create
a database of names with all the company's management and employees. To
start your work, you make a list of everyone in the company along with their
position.
But this list (table 1.1) only shows one view of the company. You also
want your database to represent the relationships between management and
employees at XYZ. Although your list contains both name and position, it does
not tell you which managers are responsible for which workers and so on. After
thinking about the problem for a while, you decide that a tree diagram is a
much better structure for showing the work relationships at XYZ.
Computer Memory
Source: http://courses.cs.vt.edu/~csonline/DataStructures/Lessons/Introduction/index.html
Figure 1.3. Sample memory cell with a specific address
The computer can store many different types of data in its memory. You
have already learned about some of the basic types of data the computer uses.
These include integers, real numbers, and characters. Once the computer
Source: http://courses.cs.vt.edu/~csonline/DataStructures/Lessons/Introduction/index.html
Figure 1.4. Sample instruction and computer memory allocation.
Source: http://courses.cs.vt.edu/~csonline/DataStructures/Lessons/Introduction/index.html
Figure 1.5. String ‘apple’ in the computer’s memory.
Source: http://courses.cs.vt.edu/~csonline/DataStructures/Lessons/Introduction/index.html
Figure 1.6. The names of company XYZ employees in a linear structure.
LET’S PROCESS
Source: http://courses.cs.vt.edu/~csonline/DataStructures/Lessons/Pointers/index.html
Figure 1.5. Using pointer in the computer's linear memory
Source: http://courses.cs.vt.edu/~csonline/DataStructures/Lessons/Pointers/index.html
Figure 1.6. Example of double indirection
LET’S PROCESS
Source: https://techdifferences.com/difference-between-linear-and-non-linear-data-structure.html
Figure 1.7. Sample illustration of linear and non-linear data structures
The linear data structure is a single level data structure while non-linear
data structures are the multilevel data structure. The data structure priorly
describes how the data is organised, accessed, associated and processed.
The examples included in the linear data structure are array, stack and
queue. An array is a group of a definite number of homogeneous elements or
data items. Stack and queue are also an ordered collection of the elements like
an array but there is a special condition where stack follows LIFO (Last in first
out) order and queue employ FIFO (First in first out) to insert and delete the
elements.
Non-linear data structure does not arrange the data consecutively rather
it is arranged in sorted order. In this, the data elements can be attached to
more than one element exhibiting the hierarchical relationship which involves
the relationship between the child, parent, and grandparent. In the non-linear
data structure, the traversals of data elements and insertion or deletion are not
done sequentially.
The non-linear data structure utilizes the memory efficiently and does
not require the memory declaration in advance. There are the two common
examples of the non-linear data structure – tree and graph. A tree data
structure organizes and stores the data elements in a hierarchical relationship.
2. The traversing of data in the linear data structure is easy as it can make
all the data elements to be traversed in one go, but at a time only one
element is directly reachable. On the contrary, in the non-linear data
structure, the nodes are not visited sequentially and cannot be traversed
in one go.
4. The linear data structures are easily implemented relative to the non-
linear data structure.
6. Examples of the linear data structure are array, queue, stack, linked list,
etc. In contrast, tree and graph are the examples of the non-linear data
structure.
The linear data structures involve a single level of data elements and
represent the linear relationship. On the other hand, the non-linear data
There are two types of data structures: the linear and non-linear data
structures.
REFERENCES
3. https://www.geeksforgeeks.org/difference-between-linear-and-
non-linear-data-structures/
5. http://courses.cs.vt.edu/~csonline/DataStructures/Lessons/Com
puterMemory/index.html
6. https://techdifferences.com/difference-between-linear-and-non-
linear-data-structure.html