0% found this document useful (0 votes)
125 views15 pages

FDS Unit 1&2 Insem Notes

Uploaded by

sidmalakar89
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)
125 views15 pages

FDS Unit 1&2 Insem Notes

Uploaded by

sidmalakar89
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/ 15

SPPU SE COMP

DK elAsSMAte
Date

UKIT-T (REVISIa) Page

Abshact DataTipes mn
Hbstxact data heeis
Hunction name o Callection ot fypa
tunctianand behaviou of t .
Specitication af ADT indicate what
AoT Opeaations
do

Tmplemnentati.on of an AOTincludes choosinq a paficular


datastkuctuie
allOuS the proqrammer tohide implementafton
details Hence it is called Abstract

Detinitions ohodnd
Data T 1efers to mw datal unpocossed data-

Data Structuie-A data stuctureis paticular


uay ot 0xgani3ing data in computer So that t
Can be used eFtectivelu

Linear &Non-LlinearDatq Stucture

Lineaxdata stiuctuieake data structurein which


data s aanged in a list L sequen.ce

Eg- Azxays list

Nan-linear datastucture ane datastuctune in which


arangedinhieaichialmannez

aata may be
Ea-zeesgkaphs
SPPUDafeSE COMP
Page

Dynamic Data Stxuctue


Static and

tatic data stuctunes havinq


axeStIuCEUIOSLhavino e
sige memary utiligatia

Eq- Axxausin C

Dynamic data staucture 1 0Lobich memo


structure nLohich_m
Can be_allacatedas pex sequirement

Eg-Linked List

Algaaithm its chaaoactemstics ai


Algaitn is _a tinite set ot instuctions tor
pertarminq a paticulartask

Characteiistics
= Each algoithm S Supplied urth zexo or more inputs
Each alaoaithm must puoduced atleast 1 output
Each alaaithmshould haedetiniteness etectiveness
etc

t Paeudocode

Tt is nathing but intamal uas_a


iting a
pcgramT isCombinationof alqaaithm qnd
and So
s0
proaiamminglanguage
SPPU SE COMP
Date
Page

Howchaats
Flouchoxts_
gaphicalsepresentation ofalgonthmns
They Can sho eroas in loqic andset ot data
easils he tested usinq can
tlawchaats

Design& Faplain Algoaithm toindthe Sum o


digits an integer o

Redd N
Remaindex =Oo
Sum = 0
Repeat hn h
Remaindex=Neel0 ainniunoz
Sum= Sum+ Remaindex
N=NLiO
Until N<0
Display Sum
End ln
0itbollos

bako

bonDin
SPPU SE COMP

Space Camplexity
Spacecomplexity is defined as amaunt of mom.
sequired by an alaoaithm to gun.
i s denated bs 0(n)

SpaceCamplexits measurement med at


Can be peatotmed
wo diHerent types.
Compile time
Run time

Campile time spae complexits is delinec as storage


Kequirement_ paagkam at Compiletime n

Run time Space complexits is detined asstomao


seqLirement af progtam at sun-timema

Time Complexits

Amaut of time zequired by an algoaithm to execue


is called time aomplexits ot Pe m algourthm
i s denoted bs TCn)

Eq timing tunctiontox s0t Opexation Specifles ime-


sequired to Saat In values.
SPPU SE
Date
COMP
Page

Biq OH Notation

I t is denated by 'o
t Samethod
ofsepresenting
algaaithm's sunninqtime upper bound of

T aan qe ongest amountwOKst


case oftime
taken by alqaithm Complete

Omega Notatian
bobai
Ttls_dencted bs
i s used to epresentlowex bound of algorithm's
sunNiNg time

TtCan qive shoatest amcuntbest case ot time taken


by algaaithm to Complete

Pend
SPPU SE COMP
alsSMate
Date
Page

Theta Natation

It isdenated by e
is Used to xepresent bath uppexbound and
laex baund of aunninqtme

lome a n d p

Diride and Conquex Statequ

Tn divide and Conquex methada qivenpablem is


Divided into Smallex Subpaablems
h o t n b

These subpxoblemsare salvedindependentls

TT necessau Solutions ct Sub- problems axe Combined


to qet salutionto Oiqinal prablem

TTE
f subpaoblems ase lakge enough, then divide aand
nd

Conquex is eapplied

Generated Subpxablem as Usually af Game Hype as


a2iqinal and hencexecursivealqorithm axe uSed
SPPU SE COMP
elAsSMAte
Date
Page

Eg Consider olements10 20 20
410 50, o
020
Divide
30 401o 50 GO
Divide
70 20 30 40 1050 GO
Divrde Divide
70 2o DivideR
30 4o0bhe 50 GO
Divide Divnde Divide
7O 20
80 40 10 50 Go
hen Mlerge
221
- 0Yhh A o2n9

Greedy Sthatequ
. This methodis papular torObtaining aphimiged Salutions

Tn Greeds methad tollouwing activittes axe perrormed


Fixstue select same solutionham input
feasible_ a not
Then we checkushether solution is
Faom set of teasible sal Sal that satisties
of tuncfion isselected nm
abjective

Eg Dikstha's Algoxithm
SPPU SE COMP
UNIT-I
Repkesentation Addxess Calculation
*Memazs

piviG

4 Foamula

Addxess oP Rouw Mqiax


Base Addxosst Na.of aous placed before ith
X Sige okxou Nar at elements placed befoare
thelement in th rowx
Sige of element

Address oak Calumn Major


Base Address + (No. af columns placed betore ithcol
x sige ot columnt Na.at elements
placed betore ith element in_h cal
x Slae of element
bodton

Canside itager aray int ar 41[s1T base -addessis


lo2otind addessat element ar [3lr41 with rou)
maior and column major

Rowmajox

CORKE
Element a[zl[41 willbeat addaess=
1020 3x5t4x 2 (OR) 1020(2x+3)
1620t 38 1020t 26
058
I046

(3x
SPPU SE COMP

Page

Calumn Majar da
ORKE Eltmentnki[41uill be _placedat address
1020+ (4x4t 3)x2(OR 1020t2xat2)x2
ld 20+38 L020t (28)
1058

Oxdexed List

An Gxdexed ist is a set af elements uhere Set


may be empts 0x it can bo uxitten as collection
Ot elements like (aiLa an

Opoationsan oxdeed listinai


Diaplayof list
Searchin an element
Tnseafion ot an olement
deletionof anelement
SPPU SE COMP
elassMate
Date
Page

t Single Variable folynamial


here each tem
Palun.omialis Sum af fems
aiablecoefticient andL exponent_
Lxponent
Cansists af

Repzestntation

-19 E 3115t
10 Coefficitnt 10a-19
Of polyn omia)

5
3

Tndex uwhich acfsS

as exponen of
aeSp, COPEEieient

epxesenhnqa Singlevazigblepalyngmial,
ane
Fox
Can make use af One dimensional axtay-

l o b
Toomol
SPPU SE COMP
Page

Palunomial Addition
HSSumethatpalynamials
toqet zesulkant
A and Bae to be added
palynamial C_
CaseTT: TE exponents of bath tems
af palunamioa
H3B axe equalthen caetticients are added,
and nus temis stoxed in C and adrance
painteas,jkto next tem
Case IT It expanentot term indicated bs i'in A.
s esS han expanenth.al tem in B, then Cops
Cuent term_af Bpainted bs to lacatian painted
byRinpalynamial C
Case IL TH expaneaf tumindicatedby in B
is less than expanent aE teim in A then Cops
Curent teum_af A pointed b to location
pointed bs k in palynamialLc'

Palynomial Multiplicatian
A
SPPU SE COMP

Spakse matix
Tn mans situati.ons is Yeaslaano
mataia Sigeis eaylaaqe
but most ot elements axezex0snat necessa
aluaya 0 Sarilu
Onlu a smallractionok matai is actualls uSed
A matixat Such hpeis called spase_mat
actuallu1Sed
20 Aaray is used to epresemt aSparse_matin
in hich thexe arethxee xows named as
Rou Indexuhexenon zero element is located
i Calumn Tndex where nonzera element is located
Yalue Nalue otnonzero element lacated a indey

Eg00 zo 4
0 5 570
2 0 O

Rau 1
Calumn 242312
Value 3 572 G
SPPU SE COMP

ranspose SparseMatiiX bonbu

Let A be amatixof sige mxnuithTnan-zao


elementss and lot 8beits taanspose

Oneo easiest uwaus is Searchtax each Columa


dnd eequentialls place each column as x0w in
TAanSposedmati 8by placinginterchanged
entaies as oucalumn value

Eg
Let A E G 5 uod
1 2 7
2
2 4
365
5 4
8

its taanspose is uDiime n t ea

BT 5
2 1 1
4 2 2
3 5

5 4
G
matnaisispeitamed usinq
Sparse
Simple tianSpose Of Complexity is d(n)
Hence time
2 nested tor loops canrentianal matrix tianspose
f o r

which is luotse han


SPPU SE COMP

2-2 Linear Data Structure using Sequential Organization


Fundamentals of Data Structures

2.1 Concept of Sequential Organization


that means the data in arrays is
Arrays is refered as the sequential organization
stored in some sequence.

class we can make use


If we want to store names of all the students in a
For example:
in sequential form.
of an array to store the names

locations which contains


is set of consecutive memory
Defintion of Arrays: Array a

similar data elements.

Array is basically a set of pair-index and the value.

Syntax
Isize]
data type name_of_array
For example, int a [10]; double bl[10] [10];
the square bracket size of the array is given.
Here 'a' is the n a m e of the array inside
are of integer type in array
'a'.
This array is of integer type i.e. all the elements

of data structure
Advantages of sequential organization
1. Elements be retrieved or stored very
can efficiently in sequential organization with
the help of index or memory location.
locations. Hence searching of
2. All the elements are stored at continuous memory
element from sequential organization is easy.

structure
Disadvantages of sequential organization of data
sequential nature.
1. Insertion and deletion of elements becomes complicated due to

2. For storing the data large continuous free block of memory is required.
3. Memory fragmentation occurs if we remove the elements randomly.

2.2 Array as an Abstract Data Type


The abstract data type is written with the help of instances and operations.
We make use of the reserved word AbstractDataType while writing an ADT.

AbstractDataType Array

Instances An array A of some size, index i and total number of


elements in the array n.

Operations
1. Create 0 - This operation creates an array.

TECHNICAL PUBLICATIONS An up thrust for knowledge


low lines are used to indicate the flow of
SPPU SE COMP
data. The arrow heads are important for
flowlines.. The flowlines are also used to
connect the different blocks in the
flowchart
Flowline

These are termination symbols. The start of


the flowchart is represented by the name
of the module in the ellipse and the end Start
of the flowchart is represented by the
keywords End or Stop or Exit
End/Stop/Exit
The rectangle indicates the processing. It
includes calculations, opening and closing
files and so on.
Processing
The parallelogram indicates input and
output.

/O

The diamond indicates the decision. It has


one entrance and two exits. One exit
indicates the true and other indicates the
false.

Decision
The process module has only one entrance
and one exit.

Process Module

TECHNICAL PUBLICATIONS An up thrust for knowledge

tals of Data Structures 1-17 Introduction to Algorithm and Data

This polygon indicates the loop


A indicates the starting of the counter
S indicates the step by which the counter Counter
1s incremented or decremented. S B
B indicates the ending value of the counter
Using the counter the number of times the
looping instruction gets executed.

The on-page connector connects the two


different sections on the same page. A
letter is written inside the circle.
The off-page connector connects the two
O
On page connector
different sections on the different pages.
The page numbers are used in off-page
connector.
These two symbols should be used as little
as possible because then the readability of Off page connector
the flowchart may get affected.

1.8.6 What do you mean by flow chart ? Give the meaning of each symbol
Drau flowchart to compute the sum of elements from a given integer array

SPPU: May-10,
: Refer section 1.8.2 for flowchart and symbols used in it.

Start

Readarray
elements

You might also like