Programming Practice No. 4: Bubble Sort Technique in Java, Lab Reports of Computer Science

The code and output for a java programming practice session focused on implementing the bubble sort technique. Variable declarations, loops, and conditional statements.

Typology: Lab Reports

2020/2021

Uploaded on 12/21/2022

vishwajittidke
vishwajittidke 🇮🇳

5 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Proclical
No4
Dates
711/22
Aim
Wrik
progrom
on
Suble
5on
5ottuoone Requin
ed:
Tava
Online
Compilen
Program
Code
nclude<iostrcom>
usinn
omespate
s d
int
mgin)
nt
, mP,
pass0
ia
lo
{10,
2,0,14,43,25,
3,,5,45}
cout
Inpu4
ist
for
Ci=o,1<lo,
i4
t)
Coul
cealiJ<et"
Cout
endl
fonli0
<10
++)
fon
(j
11
i10
J1)
FotI1<ot11)
ttm
aLI
ali
a
[]
a
+emp,
pass
+t
3
Cout<<50nled Elemenl
List
forCi
o,<D
1+)
Cou
<atik<u
3 Coul<eONumber ot
Pa5ses
taken
to
6tnl
te
ls:
pas5<<endl
petunno
Output:Inputl15t:
lo
2o
143
25
1815
45
sonted Ele
ment
Ls
O 25
t0
14
6 25
43
45
Numben
of
po5ses
tqken
fo
50n
he
lis 10
pf2

Partial preview of the text

Download Programming Practice No. 4: Bubble Sort Technique in Java and more Lab Reports Computer Science in PDF only on Docsity!

Proclical No

Dates 711/

Aim Wrik progrom on Suble 5on

5ottuoone Requin^ ed:^ Tava^ Online^ Compilen

Program Code

nclude usinn omespate^ s^ d int mgin)

nt , mP, pass

ia lo {10, 2,0,14,43,25, 3,,5,45}

cout Inpu4 ist for Ci=o,1<lo, i4 t)

Coul cealiJ<et"

Cout endl fonli0 <10 ++) fon (j 11 i10 J1)

FotI1<ot11)

ttm aLI ali a []

a +emp,

pass +t 3

Cout<<50nled Elemenl List

forCi o,<D 1+)

Cou <atik<u 3

Coul<eONumber ot Pa5ses taken to 6tnl te ls:

petunno pas5<<endl

Output:Inputl15t: lo 2o 143 25 1815 45

sonted Ele^ ment (^) Ls (^) O (^25) t0 (^14 6 25 43 )

Numben of po5ses tqken fo 50n he lis 10

clASSMAte

71/ Pracical No. 44 Aim: Woile a proqeam far Bubble 5ont safwane Requin ed Java OnlineCompilen.

Theany Ta^ the^ bubble^ sontechnique,each^ ot^ theeleme ia theistis^ Campaned^ to^ 1%^ adfattnt^ elemeat. Poognam (odei tincludeslosneam uSing namespace 5td int main

int iikop pass0,

int alol=^ iLa,2,0,1443,25,^ L5,^451 Coutk'Topu 1ist

Couts<end far Ci=o,ikloj itt)

Acmp =a Li

ali] =a1;

a temp

passt

3 chu 60nsdFlsmeat^ Lis

Cautssalil<\P' Caut\aNumber of passes daken to 0nthe list re tuan 0

Kpas5 <<end

OutouELTApuflist 0 20 144326 A^15 S0pted Ekment 151 o 1 25 16 14 14 25 43 45. Numben afpasses^ taken^ o^ 4omhe^ lisl^ lo