Topic 1 Notes
Topic 1 Notes
1.1 Introduction
Data structures and Algorithms are at the heart of every computer application. Therefore every
computer scientist and every professional programmer should know about the basic structures that
allow efficient organization and retrieval of data, frequently used algorithms, and generic
techniques for modeling, understanding, and solving algorithmic problems.
The information that is available to the computer consists of a selected set of data about the actual
problem, namely that set that is considered relevant to the problem at hand, that set from which it
is believed that the desired results can be derived. The data represent an abstraction of reality in
the sense that certain properties and characteristics of the real objects are ignored because they are
peripheral and irrelevant to the particular problem.
In solving a problem with a computer it is necessary to choose an abstraction of reality, i.e., to
define a set of data that is to represent the real situation. This choice must be guided by the problem
to be solved. Then follows a choice of representation of this information. This choice is guided by
the tool that is to solve the problem, i.e., by the facilities offered by the computer.
Definitions
Data
Data can be represented in the form of binary digits in memory using the basic unit of data called
bit which can represent either a zero or a one.
Data type
A data type defines the specification of a set of data and the characteristics for that data. It is
derived from the basic nature of data that are stored for processing.
Data Structure
Data structure refers to the actual implementation of the data type and offers a way of storing data
in an efficient manner. A data structure is designed to organize data to suit a specific purpose so
that it can be accessed and worked in appropriate ways both effectively and efficiently. It may be
selected or designed to store data for the purpose of working on it by various algorithms.
The choice of a data structure begins from the choice of an abstract data type. Data structures are
implemented using the data types, references and operations on them that are provided by a
programming language.
Hash table
A hash table, or a hash map, is a data structure that associates keys with values. A function termed
as Hash function is applied on the key to find the address of the record.
Non-linear structures
A data structure is said to be non-linear if its elements are not in a sequence. The elements in the
data structure are not arranged in a linear manner; rather it has a branched structure.
Some of the non- linear structures are:
Tree: Collection of nodes represented in hierarchical fashion
Graph: Collection of nodes connected together through edges