19CS050 Shegar Dipti Sunil DSA Journal
19CS050 Shegar Dipti Sunil DSA Journal
YEAR 2020-21
TERM – 02 (4 SEMESTER)
TH
Batch :C
1
Index
Sr. Experiment Experiment Name Perform Submission Page
No No. date Date No.
2
values in the order given.
After constructing a
binary tree - i. Insert new
node, ii. Find number of
nodes in longest path
from root, iii. Minimum
data value found in the
tree, iv. Change a tree so
that the roles of the left
and right pointers are
swapped at every node,
v. Search a value
3
money to connect
different pairs of cities.
You want a set of lines
that connects all your
offices with a minimum
total cost. Solve the
problem by suggesting
appropriate data
structures.
4
name, division and
address. Allow user to
add, delete information of
student. Display
information of particular
employee. If record of
student does not exist an
appropriate message is
displayed. If it is, then the
system displays the
student details. Use
sequential file to main the
data.
5
Pege No.
xpt 0t(Aroup-A) Date
2) midSQ1aYe_method
n this methdd firstluKeu is Saua Yea
he mid paYt_ ho gU|
the imdex
ey3Jo1* 310=96T2 0
h30= 6middle 3digits)
B0gt folding me thod
4nthis meth ed tho Keu is divided into
sepa ate payts byS1ng some imple
exatio ThOBe paYts Ar (ombin ed
to YCdute hash Ke
ex ecoy of 12 44sS12 it will be
j Agdedinto paYtS24,65,512
fter dividiotho pas t (Ombing hase
a vts by_addinh. i
HKeu=12 4eyt65 s 61
Digit Ktradion method'
An this S0me dgis ar
tofom add Oxtradtad from RO
ocaton ia hash tabe
multiplicatlog nethod'
multigll K K by_constont
7 rangel©,D
aConal PArt
Page No
Date
ConclugiON
He ledynt 0oabout hashing hash fun dtionE
mplementatlon 'e hash tables 0nd
ditferet (ollision hesp tfon techniques
10
11
12
13
14
Page No.
heoxy
idionary An UnNdered etdee (ollection
ie
aota yallks used to stoY e datd alues He
a mapStholds euU Value gai ey is
ualue S gYDid ed in dictionaru to mare
i t mo pptlmsed gten didilodarieR are
mrle merted' apith hash tablez
haim
Ondey Dota
O
TB1
2
2 -
3
S
-
-
20
Page No.
Date
(ondusion o
tence De implemente undo o
didionak anghhig (ode is
implenentrd compiled
21
22
23
24
25
Pege No.
xperiment no 5 (roup -B) Date
h l l d - h e Suc©ssoY Of a node i s
CCul)edits child
o a t _A Ode having no childkenL
IS cal ed a leaf
Subtree Subtee presents the
descendants e a n o d e . t Can be
pmptu,d single nod0 O a yo
whol s n g l e
treeD rtsef
Visiting AefeYS to checkinq. valu0
C nod0 (ohen (ont o PS On_
nddo
hov e 4 t nekovs to 4enerattol 0
Yod e By daau t use lonsidor
Oot to pe att evel
Depth' h e depth a node
epresent helevel twhich i1is
phesent
Heignt Ahe heignt Ctree is
thedepthof it outest 1edfnod o
dyontages ot trees
28
Date
90
xOmple-0
1D
PostordeX L9,5,1l,10,15IO
Snorde- 5910,1l1610_
Conclusion'
Me leur nt the ConceptS tree its.
ApaatioN and pYopetieA:h e
pYoa1aM Das implem.eted stiESStull
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
~'I- pt '. \'6 CCi'fbUf - CJ Page No.
t( t
8tru ~
e~ thoi
tex .
l ~ c
\ ,') 0 O
(2_ 0 \J \
57 ~ 0 D
~ [i d.ici.ten~ mo.tr\x "t QK! 6~ 0
8
()
~~c_e._ -:-:r- - '
TOO ·
•.
, \ Df " bou (s
e_ta
C
[ 'f~ i f' ' ed , · · 1 • ,
I ot ~ rt •
58
Dat'J
" I
V S\
'n'oo lJ '( s. .
\ . CC\\\ \f To
-
59
---L --
60
61
62
Page N0
Date
subjecb' DSAL
sever
im uOu have a business oith
OfficeS ou Voant to lease phone ines
t o (omecb them up with each othey
and the phone Compans_oharge difterent
AMOUts money td onnbd diterent
pai (s of cities o Loant aset CL
ines that connects all youY o(EE
utth a minimUm tota cöstt Solve n
fhe piobem hy suggesttng agpapriate
data '_ctructue
heoru-
reedy Algorithm
|dAY eedy is an alaprithmic paxadigm that
builds up a solution piece Du_piéce
ghoesi ig he ne Kt plece that offeVSalwOU3
he mOSt ODVIOUS and
bene fit t fiods he immediate
Overall,o
aloba lu OpHmal Solution
botimiation for SOme
pxoblemgbut
ess-than-optimal may find
ADrme STOnes solutrong t
other problermg
63
Pageo.
Date
Yimum_Spannin
mins mum spanniNa tiee (ms T)is a kind
sUD qraph oan u ndirecbed a rapn in_
oHich the ub-aiaph srans orincLydes
ol the nod0s has d minimum total edae
1peight
NY
Prim's Alqovithm
Prims alqovthmn has the follousl ng_propertie3
heedges in the sabset come
mimimuM cpannlng tyee alpnux fbim a
2 4 e tree
qrogg hetee unn it spans all
h érttce 0 he1aph
64
Date
Algorithm
COnduson
nderstocrd
the concept baslc
Spanni ng 2to fH nd tha minimUm
Astance BetWeen The vertcel
raph in ata Stru dturKe
65
66
67
68
69
70
71
72
xpt 18(Graup-D Date
Koll no.14CS05O
Name NM ptt shega
UassSE-Co mR Batch C
Subjecb psAL
AImiven SegNeoce
k=K1k2M K
Nsort ed Keug Oith a s eaYch Poba blit
the binayy
I foX ach Ke ki Build least
Seaxch tree that has the
(oSt
aven the access probability OY edch
Reu
heory
Optimal Binary seardh Tree (OBs T)
An 085T is a binayy sFarch tYte ( 8ST)
Jo which the nodes aYe axtangd on
Nels sudh that the tree os
Ymiimum O
Du sauare
Generali zation
P P6
92
Binaru Sarch
tree
124
ktended inarySrarch treg.
he tminalnode i0 the extended bnaYU
tee that is the left suCESS OY h klcan be
iterpyefed as eprelen ti ng dl Ro valUe
thart aYe not Stored ahd ae esthan
Slmilartu the terminal. node in the
extended fee hat is the ight sureSS V
k pYesetS Call key values not
Lgtoiin he ttee hat dMie AYeater han Kn
he teYmiAad nodo that is Ce sses betueen
K and ki-Ua an iaOrder trONersal Oprelent
A Ky Valu not stored that lie
batwegh Ki Ki
Blgovithms
Me hove the foll owincuDrOCeduYe fo1 det erming
74
CompuTERoOT(IP19B,
PROCEDURE
beain
foX =0 to n do
C
foy m=0 ton dQ do.
foy 0 to (n-m)
w )EOiAD+pjtq)
find cli) and ) Lwhich
miimize the tree (st
ond
YOS
2e0r
76
77
78
79
80
81
s
_, i
ee 'c. ,_
82
Pag9N::>.
r ~ -r - r- ---==-::C---- -
e~ \J d fu at
\.s o e eorch
*eve 1) e . lS
~ -1s a\ a n ~ __ .,
e e e "'<&t- -t( ee ,s
C ·
\
'I
0
.- ' t .
• I
,
• • •
....
~ ero ()cl
~Ub. -tv:ee
ht
83
~
' 2.. an
f;;0 ("t '
tree f>'(mrts
voi ' ,
I
I
j
.
.
0
84
ht-- YO
ef-t rotation
~===---=======c-=-=====::::
Pag9NO .
Date
h ee Wt 'oe reyn e
\(\ \e-f -S U
ote1~ a' 0 ,
,o\lIT\ Of
en .
O'< \1°\, m ', -
f\&e, t :-
uU- €( \ ~
ew ntde
85
~ \e + - 'ne1
I·
h-trotate
~d+'
86
Data
"l: - L
;:: - - --:,- -_ -=- - --i::::=- ---=- ----C:.... ---::.. I - .,;::.. ·- C:
'-
r
~ . .
II
II Cb f\
II
II
II
II
. I •
j .
, I
87
r
88
89
90
91
Name Shegar pipti sunil Roll no 1q CSO6 O
Class'SE Comp-I Bath. C
Subjech Rata 8trudureg and lgorithng
aborotOY
Experiment no E-21
5(3)
95
96
97
98
Name Sheday Pipti Sunil Roll no D50
CUGss SE-eompL Batch C
Subiecb 9ata südueg Alaorithm aboYatory
Xperiment n0.(hroup F-23 1
Sheox
Seauential Organization
hie tupe ofile orgoniza tionmahás TSmsiemo
he TSmA kcheme ie ndex scqMentia0 memoYU
laces scheme 1S a ind le o1gcnization
n which ecordbe_YNanged gngq ulindo
Can
SUYtacE
qg Corsldes th iKangemeat studont s
oovdin uhicM qulindey S AsUYfaces aree
UL ed
99
Name RollMayk&loulinder|surfocel
Record no
numbeY
AAA 40
BB8 &0
3 36
CCC HO q0 2
5 2 2
DPD
FEE 50 +8 3
eUa
a the humber
surface then muotrack& Ore mOYe pn he
ldtt ple disk aceR
100
moy rNquIvd
basic apeyattons hat can be_perfoY med on
seauentioal f|e_OYganigafon e
O Creat e 4Update
Ca Sispau Append
B) Delet séadh
Dreate -
yoid EMP_(LASS Create )
chaY eh y
strea m seaHle
3eghile Open maDAT iosinios
binayu
do2
Cout ntter Name
nRecordsname
COUt\nter emplbue1d
0n Aecoxdk.emp-ld
Cout ¬er Saláry
OnYzheCOY dR.alary
/then LoiterecoYd containinq in this datd in fle
segfilewYitellchaY")Acovd,sizeQ.ROcOYds)
(out2n Do uoU LDant to add mye
CIZh
reoYd2
Lonileldh
seqfile case
Use must entey tho doiyed ata tho
ho strudu yeCOS dg
in memberS
101
2 isplay79020
Condusion
Ahe prqyam as execudtod suceutullu
and we DeYe abe Tbaeneate dog) yd
Cutpuds
102
103
104
105
106
107
108
Expt 25 (Group F)
Dato
2iyedovr_ loohup
n this Scheme ho indoX fnY tho_polnteys to tha
re(O du I6 madnia ned AheCirLO baCRS_@hs
methcd is that t eauirek moe disk.Aey
than cukec addes methad
a)Hashing
4 the echnique in tuhich hmah Key ix ohtained
hsna Some sutable hah unctidn rOCord
OCor
is laced in th0hah talble wth tho
Lalp e this haah _Ruy
OperatioY onOiredb Hccessile=
Narig operatioY hat can be perfOrmed
on diyedb access J e ae
CYeate
AnsPyt a rcoYd into a file
110 8) 9eeTe e cOYd om a e
Date
pdate a ecord
Condusion i s e ired
Hence we dearnt what
{operctons
Aces Jile its tupeX
Rahd on i
ArOtO900
111
112
113
114
115
116
Name : Shegar Dipti Sunil
Batch : C
Roll no : 19CS050
Subject : Data Structures and Algorithms Laboratory.
MINI PROJECT
Experiment no : 29
Experiment title : Smart text editor (using JAVA)
Aim : Design a mini project to implement a Smart text editor.
Theory :
To create a simple text editor in Java Swing we will use a JTextArea, a JMenuBar and add
JMenu to it and we will add JMenuItems. All the menu items will have actionListener to
detect any action.
There will be a menu bar and it will contain two menus and a button:
1. File menu
• open: this menuitem is used to open a file
• save: this menuitem is used to save a file
• print : this menuitem is used to print the components of the text area
• new : this menuitem is used to create a new blank file
2. Edit menu
• cut: this menuitem is to cut the selected area and copy it to clipboard
• copy: this menuitem is to copy the selected area to the clipboard
• paste : this menuitem is to paste the text from the clipboard to the text area
3. Close : this button closes the frame
117
Methods used:
method explanation
cut() removes the selected area from the text area and store it in
clipboard
copy() copies the selected area from the text area and store it in clipboard
paste() removes the selected area from the text area and store it in
clipboard
print() prints the components of the text area
118
• On selecting “open” menu item, a file chooser will get opened which will show
the open dialog after selecting a file a file reader and a buffered reader would
read the file and set the text of the text area to the contents of the file.
• If the “new” menu item is selected the text of the text area will be set to blank. If
“close” menu item is selected the frame is closed by using the function
isVisible(false).
119
120
121
122
123
124
125
126
127
128
129
130
131