ITC - Lab 09
ITC - Lab 09
INTRODUCTION
TO COMPUTER SCIENCE
DATA STRUCTURES
Data Structure
► Data Structure is defined as the way in which data is organized in the memory location.
There are 2 types of data structures:
Float
Primitive Data Structure
In linear data structure all the data are stored linearly in the memory.
All the data are saved in continuously memory locations and hence all
data elements are saved in one boundary. A linear data structure is one
in which we can reach directly only one element from another while
travelling sequentially. The main advantage, we find the first element,
and then it’s easy to find the next data elements. The disadvantage, the
size of the array must be known before allocating the memory.
Linear Data Structure:
tyu
►Stack (LIFO)
Qwe
789
►Linked List
456
123
12 15 18 14 20
Xyz
Abc
Non-Linear Data Structure:
Every data item is attached to several other data items in a way that is
specific for reflecting relationships. The data items are not arranged in
a sequential structure. The various types of non-linear data structures
are: a
c d
►Trees b
►Graphs e f
Contiguous and Non-Contiguous Structures
As applications are getting complex and data rich, there are three common problems that
applications face now-a-days.
Data Search − Consider an inventory of 1 million items of a store. If the application is to search
an item, it has to search an item in 1 million items every time slowing down the search. As data
grows, search will become slower.
Processor Speed − Processor speed although being very high, falls limited if the data grows to
billion records.
Multiple Requests − As thousands of users can search data simultaneously on a web server, even
the fast server fails while searching the data.
Why to Learn Data Structure and Algorithms?
From the data structure point of view, following are some important categories of algorithms −
Index − Each location of an element in an array has a numerical index, which is used to
identify the element.
Array Representation
As per the above illustration, following are the important points to be considered.