Snsertion Sort Algovithm
) Alo) : -99
Step 3
to S fo
) Repeat
ad e1e : k
3) set Te mp : nlk]
while Temp< ACp1e]
4) Repeat
D- AlprR)
AlpTR4
a)Set
PR PT2 -)
6) Set
s) Se t
6) Re tuin
Selec ton Sort Alqosi thm
minlA. k, N,oc)
) Set avd loc =k
e) Repeat for
3et min AC] ard oe
it min >AL] the n
) 2etun
Selecbon (A, N)
for
) Repeat
min(A, k,N,loc)
2) Ca ll
3) Set
Alloc] Temp
H) t t
Bu66le Sort Alqozi thm
Bubble Sor E Da ta, )
) Repeat Step 2 G 3 for ke| to N-|
2) Set pT R =-I
3) Repeat while
PArALpre] >0ata L prR+
temp Datq Lpte]
DAT ALpte] - Data LpTe+)
b) Set Ptr PTR+1
Alqorithm for Binany Sarrh
0B, m) D (BEG +END)/2
) BEG (B, END
wwhile(BEG e END a d DA7A Cmi
Rept step3 and L4
2)
3| 4 IT EM ZOtACT0J then
Set
Set
H) mIO CB EG + ENO/2
DATACmED 1TE M
s) 94
Set Loc= mID
Else
6) E't
Algoritthm for inay Seo h
1) x[l-], TTE M, fl ag o
ad for i o to n-)
) Repat
3) s4 XCJ ITE M. then:
tound at are.
a. Pint Search Suceesstul ,Element
the loop
4) Continue to next)
tlag
Pint Seax Ch vnsocceysfl. Elemnent not foond
6) Ew
STAck
Push Alqoxithm
Pus H (ST,ToP, mA,Tte M)
(top == MA -) Prin
pon t overlo
TOP t )
) Set Top
STITo P] ITEy
3)
ee turn
Po Algoithm
M)
poP ls T,TO P, I TE
i) 1f (Topz -) then
"Underflo uw veturn
Psin t
) Set
Ite m = S t (Top]
Top- Top
peturn,
Snsort
Enqueue (a,f RoN T, eE AL, mA, ITEM)
) 44 (rEAR - MAx -1) then
Psint "OvevPlo w
Retur
) 4+ CreoNT == -)
- then
feONT=o
3) Set 2EAg= REAR+
H)ACRERe] ITE M
s) Re burn
Delek
ITEM)
PEqueue (Q, FeoNT,REAR)
- -) then
(FRoT
Pr'nt Under fo
3) 9 (FeowT == PEAR) then
EsE
FRoT
u) Retrn
Cala
CRoNT,eE AR mA ITE M)
Srsert (ca,
)) Ennr) /. mAx) thoy
(froNTCe
prin!s 4
-)Print "overflow
- Yetun
(FRoNr =-) then
2) 44
-)fRo NT=0, 2EA2=o
ElSe
3) CeE AR) 11E M
Retrn
Bednove(caFRoNT, RE Ae, ITEM)
) 94 (FRoT -) then
-’Pint "Underflow
’2etur n
2) ITE M (reoN)
94 CEPoNT == REAR) then
4) eetumn
Qoicksot
Algoritam
QuickSot(x, ow, h'gn)
the
lowehigh
m par6 ton (x, low, high)
ck sort ( ,low, m-)
au Quc Sort Cx, mt I, high)
Pasti tion(, tow, high)
) Set pivot = x(towJ
,hiqh
iclow
whle
3 Repeot
move signt
Until
move deft
l1] avd xlsJ
iLj,soap
S eetorn
Merge Sot
Algothm
|. Read and element Co, n-].
2 Set high n .
3 call ms(x, low, hig h)
4 Pso ecuy e ms (3, low, h'g h)
then
i) find mid (lo wthig ) /2
Cau
i) Cau Combi ne (a, tow, mid, hg)
Procedore Combi' ne (*, ow, mid, hig n)
a) Compare elemen ts of two 5Jb ar ays
andd &tore n mp
sema'nig el enentg
c) co py t mp Eo x
6
6. Pint
Algorithm
Linked Lst
Stack ope vatbn s
heod < NuLL
) Start and Set
the use's chore in loop
meno and geod
2) Display
choice Posh:
new node Set
Read the Vaw e Cseatt a
a-d vpdak heod newnade
menodenet =head
choice Po p:
. 4t he ad = ulL prit "3 tack Underflow
emo se the fist node, prnt it vale,
Ese
and fee
s) 9t choice Dsplay:
Tra vese the (inke d (Gst from hecol and
prut earh element
6) S4 choice= txit, bveae the loop
a) Stop.
Aveve ope-oton e'nked bs
)tart and 8e t Qnd
8) Reptat (sho w menU and ead choice):
) f Choice = E nque ve
"Cxeate meu node and 8tove tho valw e
queve is empy, Se t bo th font and eas to
ne w node
.EIse,nk the new o de at the end ad updake
is
empty , Pnnt "Queve empy".
2se, emove the front node pont it data
front to ne t Mode.
beomes
ehoice - Pee k
ueue empiy pnt Qeve s empty".
£lse pont front ’data .
6) Choice Display
.TaNerse font to
and
aU elen
prt
1. 1f Choice - Exit, Stop
the Prgra
Alqorith m
Tree
Birary
|. Start
fonction to mak e a me w node :
9 . Cxeate
. Allocat memon
Store data
. Set let t and gnt poin ts to
tree manualyi
the
6irond
4) chi lden
Qnd ig ht
ASSg n forthor Chid nodes
4. Pre order Travedal Algoithm:
Tiaverse (ett Su6 tree
TYavese ignt S6tyee
[Link] Travesal Algo th:
Travexse Cett s6bee
6) " visit t0ot
.Travese ignt Sobbee 8End.
1- 6. pos t Order Tiavesal Algonha:
Cet t Sb tree
-Tavese
right Sibtree
Visit 60ot.
Pint
three
txavesay