Professional Documents
Culture Documents
Kattankulathur, Chennai
Unit 1 – Week 1
Introduction
In the modern world, Data and its information is an essential part, and various
implementations are being made to store in different ways. Data are just a collection of facts
and figures, or you can say data are values or a set of values that are in a particular format. A
data item refers to a single set of values. Data items are then further categorized into sub-
items, which are the group of items that are not being called a plain elementary form of items.
Let us take an example where the name of the student may be divided into three sub-items,
namely: first name, middle name, and last name. But the ID that is assigned to a student
would typically be considered as a single item.
In the example mentioned above, such as ID, Age, Gender, First, Middle, Last, Street, Area,
etc. are elementary data items, whereas (Name, Address) is group data items.
Data Structure can be defined as the group of data elements which provides an efficient way
of storing and organising data in the computer so that it can be used efficiently.
A data structure should be seen as a logical concept that must address two fundamental
concerns.
The functional definition of a data structure is known as ADT (Abstract Data Type)
which is independent of implementation. The way in which the data is organized affects the
performance of a program for different tasks. Computer programmers decide which data
structures to use based on the nature of the data and the processes that need to be performed
on that data.
Some examples of Data Structures are arrays, Linked List, Stack, Queue, etc. Data
Structures are widely used in almost every aspect of Computer Science i.e. Operating System,
Compiler Design, Artificial intelligence, Graphics and many more.
Data Structures are the main part of many computer science algorithms as they enable
the programmers to handle the data in an efficient way. It plays a vital role in enhancing the
performance of a software or a program as the main function of the software is to store and
retrieve the user's data as fast as possible.
The data structure is not any programming language like C, C++, java, etc. It is a set
of algorithms that we can use in any programming language to structure the data in the
memory.
Each of the data structures has a different special way of organizing data so we
choose the data structure based on the requirement
As applications are getting complexed and amount of data is increasing day by day, the
following are the problems encountered:
Processor speed: To handle very large amount of data, high speed processing is required, but
as the data is growing day by day to the billions of files per entity, processor may fail to deal
with that much amount of data.
Data Search: Consider an inventory size of 106 items in a store, If our application needs to
search for a particular item, it needs to traverse 106 items every time, results in slowing down
the search process.
Multiple requests: If thousands of users are searching the data simultaneously on a web
server, then there are the chances that a very large server can be failed during that process
In order to solve the above problems, data structures are used. Data is organized to form a
data structure in such a way that all items are not required to be searched and required data
can be searched instantly.
Efficiency: Efficiency of a program depends upon the choice of data structures. For example:
suppose, we have some data and we need to perform the search for a particular record. In that
case, if we organize our data in an array, we will have to search sequentially element by
element. hence, using array may not be very efficient here. There are better data structures
which can make the search process efficient like ordered array, binary search tree or hash
tables.
Reusability: Data structures are reusable, i.e. once we have implemented a particular data
structure, we can use it at any other place. Implementation of data structures can be compiled
into libraries which can be used by different clients.
Abstraction: Data structure is specified by the ADT which provides a level of abstraction.
The client program uses the data structure through interface only, without getting into the
implementation details.
Data Type:
A data type is an attribute of data which tells the compiler (or interpreter) how the
programmer intends to use the data.
Classification of Data Type:
Program:
A program is a list of instructions or program statements composed in such a way as to
enable a computer to solve a problem.
The problem to be solved is broken down into successively smaller parts. These parts should
form a well defined structure, the large complex problem at the top the small easy to handle
problems at the bottom.
The following are the sequence of steps to form a layout or algorithm for solving the
problem:
Problem analysis.
The context of the proposed investigation must be established to provide the proper
motivation for the design of a computer program. The designer must fully recognize the need
and must develop an understanding of the nature of the problem to be solved.
Problem statement.
Develop a detailed statement of the mathematical problem to be solved with a computer
program.
Processing scheme
Define the inputs required and the outputs to be produced by the program.
Algorithm
Design the step-by-step procedure using the top-down design process that decomposes the
overall problem into subordinate problems. The subtasks to solve the latter are refined by
designing an itemized list of steps to be programmed. This list of tasks is the structure plan; it
is written in pseudocode, i.e. a combination of English, mathematics and anticipated
commands. The goal is to design a plan that is understandable and easily translated into a
computer language.
Program algorithm
Translate or convert the algorithm into a computer language and debug the syntax errors until
the tool executes successfully.
Evaluation
Test all of the options and conduct a validation study of the computer program, e.g. compare
results with other programs that do similar tasks, compare with experimental data if
appropriate, and compare with theoretical predictions based on theoretical methodology
related to the problems to be solved by the computer program. The objective is to determine
that the subtasks and the overall program are correct and accurate. The additional debugging
in this step is to find and correct logicalerrors (e.g. mistyping of expressions by putting a +
sign where a − sign was supposed to be placed), and run-timeerrors that may occur after the
program successfully executes (e.g. cases where division by 0 unintentionally occurs).
Application
Solve the problems the program was designed to solve. If the program is well designed and
useful it could be saved in your work directory (i.e. in your user-developed toolbox) for
future use.
Program design begins by focusing on the main goal that the program is going to achieve and
breaking the program into manageable components each of which contribute to this goal.
Approach program design is called top down program design or modular programming.
o Structure
o charts
o Algorithms
o Flowcharts
o Pseudocodes
Coding the program involves translating the algorithm into specific program language
instructions. While writing the code, prefer to use well defined control structures. technique
of programming using only well-defined control structures is known as structured
programming.
Programmer must find and correct logical errors by carefully examining the program output
for a set of data for which results are already known, such type of data is known as test data.
If the software developed is a complex one and consists of large number of modules then
testing is done unit testing, system testing. Syntax errors and logical errors are collectively
known as bugs. The process of identifying and eliminating these errors is known as
debugging
After testing, the software is almost complete. The structure chart, pseudo codes, flow chart
developed during the design phase become documentation for others who are associated with
the software project. In addition more documentation done as the program are being coded
such as list of variable names and definition, description of files that the program need to be
work with and the format of the output that the program produces.
In the final phase, the program is installed at the user’s site. Here also, the program is kept
under watch till the user gives green signal to it. User may discover the errors that were not
caught in the testing phase. Even after the software project is complete, it needs to be
maintained and evaluated regularly. In program maintenance, the programming team fixes
program errors that user discover during day-to-day use.
INTRODUCTION TO ALGORITHM
Input: There are zero or more values which are externally supplied.
Output: At least one value is produced
Definiteness: Each step must be clear and unambiguous.
Finiteness: Must terminate after a finite number of steps.
Effectiveness: Each step must be definite and must be feasible.
EXAMPLE
Given an one dimensional array a[0,n-1] of real values, and we want to find the location of its
largest element.
Algorithm
Let a[0:n-1] be one dimensional array with n real values. This algorithm finds the location loc
of its largest element. The variable i is used as index variable, max is temporary variable to
store the current largest element.
ALGORITHM DESCRIPTION
RECURSION:
The process in which a function calls itself directly or indirectly is called recursion and the
corresponding function is called as recursive function. Using recursive algorithm, certain
problems can be solved quite easily.
Advantages of recursion
Disadvantages of recursion
References:
1. https://www.javatpoint.com/data-structure-introduction
2. https://www.freecodecamp.org/news/how-to-think-like-a-programmer-lessons-in-
problem-solving-d1d8bf1de7d2/
3. https://csveda.com/data-structure/applications-of-data-structures/
4. https://www.geeksforgeeks.org/real-time-application-of-data-structures/
5. https://web.chem.ox.ac.uk/fortran/programs.html#:~:text=A%20program%20is%20a
%20list,down%20into%20successively%20smaller%20parts.