You are on page 1of 66

knowledge ManagemenL

and
uaLa SLrucLure
knowledge managemenL and daLa
sLrucLure
uaLa preprocesslng ls Lhe flrsL sLep of Lhe
knowledge managemenL process
uaLa ln Lhe daLa warehouse was preprocessed
and Lhen fed Lo Lhe knowledge managemenL
Lool
1he hlsLorlcal daLa belng preprocessed was
sLored ln a flle
A uaLa sLrucLure refers Lo a scheme for
organlzlng relaLed pleces of lnformaLlon
uaLa SLrucLure
uaLa sLrucLure ls a maLhemaLlcal way for
sLorage of daLa ln Lhe compuLer memory
lL ls Lhe way of sLorlng and accesslng Lhe daLa
from Lhe compuLer memory
So LhaL large number of daLa ls processed ln
small lnLerval of Llme
knowledge abouL Lhe relaLlonshlp beLween
daLa lLems allows deslgnlng of efflclenL
algorlLhms for Lhe manlpulaLlon of daLa
aslc Lypes of uaLa sLrucLure
1he baslc Lypes of daLa sLrucLures lnclude
llles
LlsLs
Array
8ecords
1rees
1ables
Lach of Lhese baslc sLrucLures has many
varlaLlons and allows dlfferenL operaLlons Lo be
performed on Lhe daLa
1ypes of uaLa SLrucLure
1here are Lwo Lypes of daLa sLrucLure
Llnear daLa sLrucLure
non llnear daLa sLrucLure
L|near data structure
Jhen Lhe daLa ls Lo be sLored ln Lhe memory ln
llnear form ls called llnear daLa sLrucLure
Array
LlsL
SLack Cueue Clrcular Cueue uequeue
Llnk LlsL
1ypes of uaLa SLrucLure
-n L|near Data Structure
Jhen Lhe daLa ls Lo be sLored ln Lhe compuLer
memory ln dlspersed order ls called nonllnear
daLa sLrucLure
lor example
1rees
llles
Craphs
ClasslflcaLlon of llnear daLa sLrucLure
lL can be classlfled lnLo Lwo Lypes
hyslcal uaLa SLrucLure
Loglcal uaLa SLrucLure
9s|ca| Data Structure
Jhen Lhe daLa ls Lo be sLored ln Lhe compuLer
memory ln proper order ls called physlcal daLa
sLrucLure
ClasslflcaLlon of llnear daLa sLrucLure
L|ca| Data Structure
1he Lwodlmenslonal array ls called loglcal
daLa sLrucLure because we are noL sure LhaL
ln whlch formaL daLa ln sLored ln Lhe memory
Lhen we represenL Lhe daLa ln Lhe memory aL
row ma[or order or column ma[or order so
due Lo Lhls reason lL ls called loglcal daLa
sLrucLure
peraLlon erform on uaLa SLrucLure
Jhen daLa ls proceedlng Lhen dlfferenL Lype of
operaLlon perform
lollowlng are mosL lmporLanL operaLlon whlch
play ma[or role ln daLa sLrucLure
Searchlng
SorLlng
lnserLlon
ueleLlon
Merglng
Copylng
1raverslng
peraLlon erform on uaLa SLrucLure
1ravers|n
Accesslng of records ls called Lraverslng lL ls
also known as vlslLlng of records
Searc|n
llndlng Lhe locaLlon of record wlLh glven value
ls called Searchlng
Srt|n
1he arrangemenL of daLa ln ascendlng or
descendlng order ls called sorLlng
peraLlon erform on uaLa SLrucLure
Insert|n
Addlng new record Lo sLrucLure ls called lnserLlng
De|et|ns
8emovlng a record or seL of records form daLa sLrucLure ls
called deleLlng process
Mer|n
Jhen Lwo or more Lhan Lwo records are comblned Lhls
process ls called merglng
|n
1he creaLlon of dupllcaLe daLa lLem ls called copylng process
Llnear daLa sLrucLure
Arra
LlsL
SLack
Cueue
Clrcular Cueue
uequeue
Llnk LlsL eLc
Array
Array ls Lhe collecLlon of flnlLe homogeneous Lype of
daLa whlch are sLored ln successlve memory
locaLlons
1he memory locaLlons are ldenLlfles by a name whlch
ls called Lhe array name
1he daLa lLems of Lhe array are called Lhe elemenLs of
array and each daLa lLem ls sLored ln separaLe
memory locaLlon
Lach memory locaLlon wlLhln Lhe array ls ldenLlfles by
lLs poslLlon value whlch ls called Lhe lndex of Lhe
array
Array
1ypes of array
1here are Lwo Lypes of array
ne dlmenslonal array
1wo ulmenslonal array
Cne D|mens|na| Arra (L|near Arra%
nedlmenslonal array represenL Lhe daLa ln Lhe
form of vecLor llsL or llnear form lL ls used Lo
sLore slmllar Lype of daLa conslsLlng of only one
row or column
ne ulmenslonal Array (Llnear Array)
1wo dlmenslonal array
1wodlmenslonal array represenL Lhe daLa ln
Lhe form of Lable or maLrlx
ln Lwodlmenslonal array Lhe sLorage of
elemenLs can be Lake place by Lwo Lechnlques
8ow Ma[or rder
Column Ma[or rder
8ow Ma[or rder
1o undersLand Lhe concepL of row ma[or order
conslder Lhe followlng maLrlx of 2 x 3
12 9 16
3 11 22
now Lhe sLorage of above maLrlx ln row ma[or
order ls
Column Ma[or rder
1o undersLand Lhe concepL of column ma[or
order conslder Lhe followlng maLrlx of 2 x 3
12 9 16
3 11 22
now Lhe sLorage of above maLrlx ln column
ma[or order ls
Llnear daLa sLrucLure
Array
L|st
SLack
Cueue
Clrcular Cueue
uequeue
Llnk LlsL eLc
LlsL
1he arrangemenL of elemenLs ln some sequence ls called
llsL 1here are Lwo Lypes of llsL
rdered LlsL
unordered LlsL
Crdered L|st
1he proper sequence of elemenLs ls called ordered llsL
lor example 1he days of week Lhe monLh of year seasons of
year
Unrdered L|st
ln Lhls Lype of llsL Lhe sLorage of elemenL ls noL Lake place ln
proper order
lor example SLack Cueue uequeue Clrcular Cueue Llnk LlsL
Llnear daLa sLrucLure
Array
LlsL
Stack
Cueue
Clrcular Cueue
uequeue
Llnk LlsL eLc
SLack
SLack ls LhaL Lype of llsL ln whlch lnserLlon and
deleLlon of elemenLs can Lake place from one
end 1he end of sLack ls called 1op polnLer
SLack work on Lwo prlnclpal
Lll (LasL ln llrsL uL)
llL (llrsL ln LasL uL)
lll
Lll
peraLlon on SLack
ulfferenL operaLlon can be performed wlLh sLack
reate Stack 1he creaLlon of sLack sLrucLure
9us Cerat|n 1he lnserLlon of elemenL ln Lhe sLack
9 Cerat|n 1he ueleLlon of elemenL from Lhe sLack
Iu|| Stack lf sLack ls full lalse value ls reLurned le oolean
value
Lmt Stack lf sLack ls empLy 1rue value ls reLurned le
oolean value
1wo Ma[or peraLlon of Lhe SLack
Cver I|
Jhen Lhe sLack ls full and new elemenL ls lnserLed/ ush
Lhen overflow condlLlon occur
Under I|
Jhen Lhe sLack ls empLy and a deleLlon process ls
performed Lhe under flow condlLlon occur
Lxam|e
lle of 1rays ln CafeLerla
lle of books ln Llbrary
Llnear daLa sLrucLure
Array
LlsL
SLack
;ueue
Clrcular Cueue
uequeue
Llnk LlsL eLc
Cueue
Cueue ls LhaL Lype of llsL ln whlch lnserLlon can Lake
place from one end called (8ear) and deleLlon can
Lake place from anoLher end called (lronL)
Cueue works on Lhe prlnclple of flrsL ln flrsL ouL
(lll)
LlsL come llrsL Serve and LasL ln lasL ouL (LlL)
Da|| L|fe Lxam|e
1he number of cars aL pollce check
eople purchase LlckeLs from clnema make a queue
eople deposlLs Lhelr bllls ln bank make a queue
peraLlons on Cueue
ulfferenL operaLlons can be performed aL queue as
reate ;ueue
y uslng Lhls operaLlon Lhe sLrucLure of Lhe queue ls
generaLed
Lnqueue
1he lnserLlon of elemenL ln Lhe queue ls called enqueue
Dequeue
1he deleLlon of elemenL from Lhe queue ls called dequeue
peraLlons on Cueue
Lmt ;ueue
lL reLurns oolean value Lrue lf queue ls empLy
Iu|| ;ueue
lL reLurns oolean value false lf queue ls full
Destr ;ueue
1hls operaLlon deleLes all Lhe elemenLs of Lhe
queue and also deleLes Lhe sLrucLure of queue
from Lhe compuLer memory
Ma[or peraLlon on Cueue
Cverf| nd|t|n
Jhen no more elemenLs can be lnserLed ln
Lhe queue Lhen Lhls condlLlon ls called
overflow condlLlon
Underf| nd|t|n
Jhen queue ls empLy and no more elemenLs
can be deleLed from Lhe queue Lhen Lhls
condlLlon ls called underflow condlLlon
Llnear daLa sLrucLure
Array
LlsL
SLack
Cueue
|rcu|ar ;ueue
uequeue
Llnk LlsL eLc
Clrcular Cueue
Clrcular queue provlde flexlble way for Lhe
lnserLlon of elemenL ln a clrcular way
ln queue we are nor sure LhaL when Lhe rear
polnLer goes Lo an end le 8ear n overflow
condlLlon occur may be Lhe same elemenL from
Lhe fronL are deleLed lL ls Lhe ma[or drawback of
queue
1hls drawback can be overcome wlLh Lhe help of
clrcular queue
ln clrcular queue Lhe lnserLlon can be Lake place
by uslng Lhls sequence 123 n
Clrcular Cueue
eck fr Underf|
Jhen Lhe fronL and rear polnLer become equal LhaL ls
lronL 8ear 0
underflow condlLlon may arlse
eck fr Cverf|
Jhen lronL 1 and 8ear n Lhen overflow condlLlon
may arlse 8
Jhen lronL 8ear + 1 Lhen overflow condlLlon may
arlse
Llnear daLa sLrucLure
Array
LlsL
SLack
Cueue
Clrcular Cueue
Dequeue
Llnk LlsL
uequeue
lL ls a llnear daLa sLrucLure 1hls queue ls
called double ended queue
ln Lhls Lype of queue lnserLlon and deleLlon of
elemenLs can be Lake place from boLh ends
ln Lhls queue lnserLlon and deleLlon of
elemenLs from 8ear and lronL can Lake place
on Lhe prlnclpal of 8lghL and LefL polnLer
1wo Lypes of uequeue
Inut restr|cted queue
ln Lhls Lype of queue lnserLlon can Lake place
only from one end and deleLlon can Lake place
from boLh ends
Cutut restr|cted queue
ln Lhls Lype of queue lnserLlon can Lake place
from boLh ends and deleLlon can Lake place
from one end
Llnear daLa sLrucLure
Array
LlsL
SLack
Cueue
Clrcular Cueue
uequeue
L|nk L|st
Llnk llsL
A llnked llsL ls a daLa sLrucLure whlch can change durlng
execuLlon
Successlve elemenLs are connecLed by polnLers
LasL elemenL polnLs Lo nuLL
lL can grow or shrlnk ln slze durlng execuLlon of a
program
lL can be made [usL as long as requlred
lL does noL wasLe memory space
1ypes of llsL
Llnear slngle llnk llsL
Clrcular llnk llsL
uouble llnked llsL
L|near s|n|e ||nk ||st
lL can be made [usL as long as sequence
lL does noL wasLe memory space
Clrcular llnk llsL
1he polnLer from Lhe lasL elemenL ln Lhe llsL
polnLs back Lo Lhe flsL elemenL
uouble llnked llsL
olnLers exlsL beLween ad[acenL nodes ln boLh
dlrecLlons
1he llsL can be Lraversed elLher forward or
backward
usually Lwo polnLers are malnLalned Lo keep
Lrack of Lhe llsL head and Lall
non Llnear uaLa SLrucLure
1rees
llles
Craphs
1rees
1rees are used Lo lmpose a hlerarchlcal
sLrucLure on a collecLlon of daLa lLems
lor example we need Lo lmpose a hlerarchlcal
sLrucLure on a collecLlon of daLa lLems whlle
preparlng organlzaLlonal charLs Lo represenL
Lhe synLacLlc sLrucLure of a source program ln
compllers
So Lhe sLudy of Lrees as one of Lhe daLa
sLrucLures ls lmporLanL
ueflnlLlon of a 1ree
A Lree ls a seL of one or more nodes 1 such
LhaL
1here ls a speclally deslgnaLed node called a
rooL
1he remalnlng nodes are parLlLloned lnLo n
dls[olnLed seL of nodes 1
1
1
2
1
n
each of
whlch ls a Lree
1rees
1hls ls a Lree because lL ls a seL
of nodes ACuLlCPl
wlLh node A as a rooL node
And Lhe remalnlng nodes
parLlLloned lnLo Lhree dls[olnLed
seLs CPl CLl and u
respecLlvely
Lach of Lhese seLs ls a Lree
because each saLlsfles Lhe a fore
menLloned deflnlLlon properly
1rees
Lven Lhough Lhls ls a seL of
nodes ACuLlCPl
wlLh node A as a rooL
node Lhls ls noL a Lree
because Lhe facL LhaL node
L ls shared makes lL
lmposslble Lo parLlLlon
nodes Lhrough l lnLo
dls[olnLed seLs
1rees
Deree f a -de f a 1ree
O 1he degree of a node of a Lree ls Lhe number of sub Lrees havlng Lhls
node as a rooL A 1 8D 0
Deree f a 1ree
O 1he degree of a Lree ls deflned as Lhe maxlmum of degree of Lhe nodes
of Lhe Lree LhaL ls degree of Lree max (degree(node l)
for l 1 Lo n)
uegree of a 1ree 1
Leve| f te tree
O 1he depLh of Lhe Lree Lo be Lhe maxlmum value of Lhe level of Lhe
node of Lhe Lree
Level of Lhe Lree 3
lnary 1rees
ueflnlLlon A blnary Lree ls a flnlLe seL of nodes LhaL ls
elLher empLy or conslsLs of a rooL and Lwo dls[olnL
blnary Lrees called Lhe lefL sub Lree and Lhe rlghL sub
Lree
lnary 1rees
non Llnear uaLa SLrucLure
1rees
I||es
Craphs
llle
CollecLlon of loglcal relaLed records ls called flle
lL ls a seL of records LhaL ls sLored on secondary
sLorage devlces llke magneLlc Lap Lape drlves
floppy dlsc hard dlsc flash eLc when creaLed
1here are Lhree Lypes of flles
SequenLlal llle
lndex sequenLlal flle
8andom/ 8elaLlve flle
1ypes of llle
Sequent|a| I||e
ln sequenLlal flle Lhe records are sLored ln sequenLlal order ln
whlch Lhey are lnserLed
1hls Lype of flle ls can be sLored on magneLlc Lape magneLlc
dlsc and hard dlsc
Indexed Sequent|a| I||e
ln Lhls flle separaLe key ls deflned 1he key unlquely ldenLlfles
Lhe record
y uslng proper lndexlng Lhe dupllcaLlon of record ls noL
posslble
ln lndex sequenLlal flle Lhe records can be accessed ln
sequenLlal order also
lndex sequenLlal flle cannoL be processed by magneLlc Lape lL
can be processed by magneLlc dlsc
1ypes of llles
andm] e|at|ve I||e
ln random flle Lhe daLa can be sLored randomly
and Lhe record can be accessed randomly also
lL ls fasL flle processlng as compared Lo oLher flle
organlzaLlon
8andom flle can be processed by magneLlc dlsc
-n L|near Data Structure
1rees
llles
ras
Craphs
A seL of lLems connecLed by edges Lach lLem ls called a
verLex or node lormally a graph ls a seL of verLlces and
a blnary relaLlon beLween verLlces ad[acency
A graph C can be deflned as a palr (vL)
where v ls a seL of verLlces and L ls a seL of edges
beLween Lhe Lwo verLlces
lf Lhe graph ls undlrecLed Lhe ad[acency relaLlon
deflned by Lhe edges ls symmeLrlc
lf Lhe graph does noL allow selfloops ad[acency ls
lrreflexlve
1ypes of Craphs
D|rected ra
A graph edges are ordered
palrs of verLlces 1haL ls
each edge can be followed
from one verLex Lo anoLher
verLex
Also known as dlgraph
orlenLed graph
Und|rected ra
A graph whose edges are
unordered palrs of verLlces
1haL ls each edge connecLs
Lwo verLlces
1ypes of Craphs
Dense ra
A graph ln whlch Lhe
number of edges ls close
Lo Lhe posslble number of
edges
Sarse ra
A graph ln whlch Lhe
number of edges ls much
less Lhan Lhe posslble
number of edges
1ypes of Craphs
Labe|ed ra
A graph whlch has labels
assoclaLed wlLh each edge or
each verLex
Je|ted ra
A graph havlng a welghL or
number assoclaLed wlLh
each edge Some algorlLhms
requlre all welghLs Lo be
nonnegaLlve lnLegral
poslLlve eLc
Craphs
Craphs are so general LhaL many oLher daLa
sLrucLures such as Lrees are [usL speclal klnds
of graphs
A graph ls llke a road map ClLles are verLlces
8oads from clLy Lo clLy are edges
Array and llsL
Array ls collecLlon of
homogeneous elemenLs
lor Array memory
allocaLed ls sLaLlc and
conLlnuous
user need noL have Lo
keep ln Lrack of nexL
memory allocaLlon
Array slze should be
speclfled
LlsL ls collecLlon of
heLerogeneous elemenLs
lor LlsL memory allocaLed ls
dynamlc and 8andom
user has Lo keep ln 1rack of
nexL locaLlon where memory
ls allocaLed
llsL slze can be deLermlned
aL run Llme also
SLack and Cueue
A sLack ls generally llrsL ln
LasL uL
lLem can be added or
removed only aL one end ln
sLack
1he baslc operaLlon of sLack
are push and pop'
Pile of Trays in Cafeteria
Pile of books in Library
Cueue ls llrsL ln llrsL uL
Cueue lnserLlon aL Lhe rear
and deleLlon from Lhe fronL
Cueue are enqueue and
dequeue
1he number of cars aL pollce
check
eople purchase LlckeLs from
clnema make a queue
1rees and Craph
A Lree ls a connecLed graph wlLh
no clrculLs and no self loops
As a Lree does noL conLaln any
loops and ls sLlll connecLed lL ls
also called a mlnlmally connecLed
graph le Lhere ls [usL one paLh
beLween any 2 verLlces
1he manlpulaLlon of ArlLhmeLlc
expresslon
Symbol 1able consLrucLlon
SynLax analysls
A Lree ls a speclallzed case of a
graph
A clrculL ls alLernaLlng
sequence of edges and verLlces
where ln edges are noL
repeaLed verLlces may be and
sLarLlng and endlng verLlces are
Lhe same Lhls forms a loop
A graph ls llke a road map
ClLles are verLlces 8oads from
clLy Lo clLy are edges
Areas ln whlch uaLa SLrucLures are
used exLenslvely
Compller ueslgn
peraLlng SysLem
uaLabase ManagemenL SysLem
SLaLlsLlcal analysls package
numerlcal Analysls

You might also like