0% found this document useful (0 votes)
9 views

lec1

The document provides an overview of data structures and algorithms, emphasizing their importance in writing efficient computer programs. It covers key concepts such as data types, algorithms, and characteristics of algorithms, as well as different forms of data structures and abstract data types. Additionally, it explains built-in and derived data types, illustrating how data can be organized and manipulated effectively.

Uploaded by

sanskarnew1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

lec1

The document provides an overview of data structures and algorithms, emphasizing their importance in writing efficient computer programs. It covers key concepts such as data types, algorithms, and characteristics of algorithms, as well as different forms of data structures and abstract data types. Additionally, it explains built-in and derived data types, illustrating how data can be organized and manipulated effectively.

Uploaded by

sanskarnew1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

INTRODUCTION

INDEX
■ Introduction
■ Data
■ Data types
■ Data structure
■ Abstract data types (ADT)
■ Algorithm
■ Characteristics of an algorithm
Introduction
■ Learning data structures and algorithms allow us to write
efficient and optimized computer programs.
■ Data – The quantities, characters, or symbols on which
operations are performed by a computer, which may be stored
and transmitted in the form of electrical signals and recorded
on magnetic, optical, or mechanical recording media.
■ Structures - Something arranged in a definite pattern of
organization.
■ Algorithm - An algorithm is a process or a set of rules
required to perform calculations or some other problem-solving
operations especially by a computer.
Data
■ Computer data is information processed or stored by a
computer.
■ This information may be in the form of text documents,
images, audio clips, software programs, or other types
of data.
■ Computer data may be processed by the
computer's CPU and is stored in files and folders on the
computer's hard disk.
■ A bit is the smallest unit of data, and represents just a
single value.
■ A byte is eight binary digits long.
■ Storage and memory is measured
in megabytes and gigabytes.
Algorithm
■ Algorithm is a step-by-step procedure, which defines a set of
instructions to be executed in a certain order to get the desired
output.
■ Algorithms are generally created independent of underlying
languages, i.e. an algorithm can be implemented in more than
one programming language.
Example
• Let's try to learn algorithm-writing by using an example.
Problem − Design an algorithm to add two numbers and
display the result.
• Algorithms tell the programmers how to code the
program. Alternatively, the algorithm can be written as −
• Step 1 − START ADD
• Step 2 − get values of a & b
• Step 3 − c ← a + b
• Step 4 − display c
• Step 5 − STOP

• It makes it easy for the analyst to analyze the algorithm


ignoring all unwanted definitions.
Characteristics of an algorithm
■ Not all procedures can be called an algorithm. An algorithm
should have the following characteristics −
• Unambiguous − Algorithm should be clear and
unambiguous. Each of its steps (or phases), and their
inputs/outputs should be clear and must lead to only one
meaning.
• Input − An algorithm should have 0 or more well-defined
inputs.
• Output − An algorithm should have 1 or more well-defined
outputs, and should match the desired output.
• Finiteness − Algorithms must terminate after a finite number
of steps.
• Feasibility − Should be feasible with the available resources.
• Independent − An algorithm should have step-by-step
directions, which should be independent of any programming
Data types
■ Data type is a way to classify various types of data
such as integer, string, etc. which determines the
values that can be used with the corresponding type of
data, the type of operations that can be performed on
the corresponding type of data.
■ There are two data types −
• Built-in Data Type
• Derived Data Type
■ Built-in Data Type
■ Those data types for which a language has built-in
support are known as Built-in Data types.
■ For example, most of the languages provide the
following built-in data types.
• Integers
• Boolean (true, false)
• Floating (Decimal numbers)
• Character and Strings
■ Derived Data Type
■ Those data types which are implementation
independent as they can be implemented in one or the
other way are known as derived data types.
■ These data types are normally built by the combination
of primary or built-in data types and associated
operations on them.
■ For example −
• List
• Array
• Stack
• Queue
Data structure
■ A data structure is a particular way of organizing
data in a computer so that it can be used effectively.
■ A data structure is a collection of data type ‘values’
which are stored and organized in such a way that it
allows for efficient access and modification. In some
cases a data structure can become the underlying
implementation for a particular data type.
■ When we think of data structures, there are generally
four forms:
1. Linear: arrays, lists
2. Tree: binary, heaps, space partitioning etc.
3. Hash: distributed hash table, hash tree etc.
4. Graphs: decision, directed, acyclic etc.
Abstract Data Types (ADT)
■ The Data Type is basically a type of data that can be
used in different computer program.
■ It signifies the type like integer, float etc, the space
like integer will take 4-bytes, character will take
1-byte of space etc.
■ The abstract datatype is special kind of datatype,
whose behavior is defined by a set of values and set of
operations.
■ The keyword “Abstract” is used as we can use these
datatypes, we can perform different operations.
■ Some examples of ADT are Stack, Queue, List etc.

You might also like