on Gonference First Australasian Education

advertisement
The Proceedingsof the
on
Gonference
FirstAustralasian
ComputerScienceEducation
bYthe
SPonsored
ACMSPecialInterestGrouPon
ComputerScienceEducation
Australia
of SYdneY'
UniversitY
JulY3'5' 1996
SymPosiumChair:AlanFekete
Universityof SYdneY
ProgramChair:John Rosenberg
of SYdneY
UniversitY
Editedby: John Rosenberg
UniversitYof SYdneY
laboratories'
DataStructureswlth Ada Package.s'
Ee$.rt L Dc.sh.m,EoPeCo[.ec' Sont!4 I\dI'
W.[ify L B.df, UDfn6ity oflllhoi!' Cbrmp.tgD'UrbrE
Lifc Ir$rl{[cc
Chcri J. Bondcr, hdi$rfots
tra
Animations
@csdusGdr
TN
D.rrick P.Brcwn,gopc CoLg." Houtr4 I'tr'
IndactioD
Thc ahtastrcunEs aoursci5 onc of tbc oldrst rnd Bost st'_
blc colrsasitr thc computcrscicnccctltdc{lue. It hasbccn
DEscntin aI modcl clfticuls lnd curicuhm llcommcrda_
lLonsfton 196?on, snd its cortc hrs r.mrin d rcE{l_
$ly ltablc.
over thc hillory of thp drt! sFrcturcs coursq lDtry lools
ltd aFpolcbas hrvc b€.n inEodu.ld sod cfi.rtivcly
cEploycd.This paPr dBcribcs a courscth'l was&suncd
usins r cmbitrldon of tlElr suchtools: tbc Adr Prograrn'
-ini f"ogurgo,ag*i L vislralit tion atrdsimatio& snd
*itl o,poi..Dtd algoritbE !ntly3i!. Th. tools
t"t*"*i*
d4Elop.d .!d ur.d uE d6scribcdh &t!il
Th. Ar|r Progr.E oiDg l-srgulg!
Thc uacof Ada in tb. dna sEucoltls cousc w's pion'qrd
by FsldEr! [3] atrdnoll rcclldy advocsti by Sihlr [6]'
Scv€nl r,!ry gooddslAstrucltca tc)(tbook a& basadoo lba
Ada bng!.gp hcluditrg FcldmaD[21'Wci$ [9], H lrn t41'
endSobbsrd Wcblt [8].
Thc sd\'&tagcsof Ada in a data sEucur&scou$c includc
rh. followilg:
. Packagcs.ndprirnt. tyPcstllow thc coEPlctcimplemcntalionof absFactdalalyPrs i$ludiry cocapsdario!
endlbc scporatioDof 6pcciicationfioe imPldDcnlation.
. G€ncricscnablos$ddls to wot at . highcrlcvcl of
rtEtrrction whencotstuctilg absEact&ta tyP€s.
. Exccptio!ht ling c.n bc iiclud.! wilhin eb6Eact&ta
typcsto fidhcrc rtrc! cnc.p$rlation.
In rbc coursedqscrib€dhdl, srudcnbw€!€ Providcdwirh a
libEry of Ada paclagcswbich lhcy u!€d in lhcir Fogratnning Eojccts atrd l,.boBtory cxcrciscs.This dubled thc
studcnbto u5othe datasEuculIls in their own Progltrls
|rc|lft.FsorEl d
@9yd.I aFtolt{s
Pqmi!{rid to iEL.IgldlM
'chgur
fiattsh c
E b gnLd rilun lt Fw*Ld t'.t coti.4
ditdntag., tE c.fylt|{ mt q ih. td.
dbtllr!.d hD.ofit.. o.dl..d
o{d€ Fff.dnn 'td ili dd. .p!€at,.d t|dc. b gi|/gl ttr cqFq b bv
F€nr&ioiolACI,bc.Tocopyodlrt.'bl€P(n[d\toF06rorle..r's3c
ldft FtrilEbtdh..l€a
tollditt
.bfEr!,nanliFir3t
srss6Act08gDl{4$2860007-5150
*ilhout nccdingto iDploocot itlem in d.tail. Thc codr fro6
tbe packagcswasaveibblc fG studcntsto cxEmirc atrdwa5
us.d in dle classto {id in ttlc unde$ttDditrgof datasEucnltl
lnd algorithmimplcmcnlation.
dat wclc providcdin drc library 3rc:
PackaScs
. AVLTr.rs
. Rdional nutrlbcls
. Unlinitcd prccisior in&gcrs
' Bindy sctrchtrccs
. BinarYbclls
. Lrfrist hcrps
. Linkcd lists
. eurucs
.
.
'
Slacks
8-ttcs
SPIaYtrcc€
Somcof thcs! packagcswcn edaptcdAom thoscfoud in
\l'ciss [9].
AtgorithmVrsu.lizrtioE3 .|ld ADid.tiols
Alcoritbm visuslizadonrnd ani$ation b.s bcon us.d suc*inrlu in dua strucnr." cou$csfor somctinc. Exanplcs
r!. found in Bmwr [U and Naps [t. Tools ha€ bcor
darcribcdwhich facilitat dle drvclopEcnr of 6csc aliba'
dons. The tool choscDfor usc in &c prcscnt Foj.ri is
Xrango[?l.
I[ th. prlsala datasEuclrIEscours€,visualizatio$ rld raimatioasare us€dfor both clsssrooodcmo$talior ind lab_
oratorycxcrcbcs.Th€ adtrtatiols ars itrtctdcd to clhdcc
sludentund.nrandingof algorithEs,p.nicukly sioccthc
*ud.nts do not writ. codc !o imPlcmcntthe algoritbmsir
rDost cases. Mrny animatiols ilbsFate tbe algolitld
ihroughan aninalioDtharis vicw€dsinullao.ously wiih th.
Ada codcwhichimplcmcntsthe algoEithD.Ada statancnb
i! thc codc dis?lay arc bighlighted as lhoir acliotr is adMany admalions are provided with the distribution of
for use
Xfa.go. Somcof thesew€r€foundto bc approPdate
h the data stucnms cotrse. oft€tr *itb mimr modifca_
tions.In additioo,otheraoimatiotrswcre d€v€lop€dasa part
of thecoursedevclopmmtFoject Thoscdcvclopcdw€re:
. Unk€d listswith iDscrtion.deledon.ad serch
32
In atrils€rt, aDcxtemalPoinrcr6odsthc trodeto be inscdcd
sfte(, and a newnod€ is dravn and addedto the list In a
d.Lt€, ar crtcmsl pointcr fsds boih ihe lode to be delet4d
,trd thc no& immcdiatcly before it pdor to deletrngthe
rode.Ir 6 faq s compadsoris animatedbct*€'[ cachclcmcft of tlc list a[d tlle dtrd valu€.The 6trdr€lue apP.{rsin
thc lowcl lcft comerof thc dis?layatea,,!d a! eachelcEent
is visite4 lhe fitrdlaluc Erovcsrcxt to the valueof the !ode.
If |hc valucsnalch, the imagasflash.If they do no! marcb
thefind valucrctumsto its Pta., in the corn€r.
. hfx to Posdx exprassi":**.'Y:".
. Binrry s€€rchd€e rtrscluotranooclcuon
. AvL E€rins€ftron
. spbyaa rotaoon
. B-nEansctfron
Eir3mpl€A.ninatioDj
tnimarion
Ad*4siotr i5 lhc name givcn to tbc algorilbm
Ada
projccl
Adavision
coobiDcs
sysen dcvclopcdfor this
tool
for
as
a
&achhg
!o
sclt€
l-"s"t
Joa. *it ayou-i"
tbc
algoritbm
Usitrg
tAtlght
in
Ada"
d$. saucturccoutscs
lrirFriotr paEkagc)Clmgo, ardmationsarc cfiatcd so stu_
dcn6 may vicw thc conncctionbchl€c! Ada co'la tnd lhc
acdonof ilgorilbms on drta and darastuctu€'s. Thc Ada
codcasso.iatcdwith .3ch algoti$m appcalsir lhc dis?lay
!rca of lc!a[go. In sonc cascs'Proccducswhich all no[
cxplicitlydisdaycdalr us.i in ord.r to simplfy th' codc-
by divid.d rEctnglcs.Tbelcft half of
NodesarErEpE6€ntcd
contsins
thc \Eluc of thc node,whilc the dght
rcctangle
thc
hslf holdsapoi .rto tbc rcxt nodc.Any ext mal pohtcrs'
suchas thos€us.d to 6trd a ccrtainnodein the lisl, sPpea!
andmovcalongthe botoo of lhc list image.The codccor_
rrspondingto c€chopcralionapp€$ at lho top of thc anidation windoq and aft.r an oPcrdion is comPlctc4 ir is
cEscd.The originsl list consistsof a poincr nam€dHEAD
rhatpointsto adurDmyhc!d.r, th{t is, an cEpty [ode whosc
pointcr fictd poirts lo NULL. As lists bccomclong, thcy
wil movc off ttle display llta b thc righL Thc inagcs can
still bc vio*cd by using thc anov,bunonson thc lcft sid. of
thc Xfango *indow
Thc stucluls and datainvolvcd in a! algodlhmarc rlPrcs.ncd by inagcs. ThcsciEDg6 movcasthc rrsult of intcrcsdneavcnts,such as thc inscnion of a dodc into a Elc or
rlr iovcncnt of a liak in a rclation. At lhc bcgihningof
cschariroarion,lhc fnt linc of Ada cod. is trigblighudby a
r!.tangulrl inagc, Succc.dinglincs of codcrtE highliShtd
as ihey arc cxccuicd,Th. uscl observcsthc imagcmovc_
mcrt taling placcin corjunctionl'ith lhc codchighlightirg.
Tlvo of lhc adFations, Unktd List and AvL Trc. Rola_
dons,at! dcsdibcdbclow
PR-!dI := frid ilnPul-v!1u.,u;
lap :: nd liod.'fi. Pr.vJ.II.X.xr)l
tiEm
LiDt d List
I
Thc list animationdcmonstrateshow inscrts,dclctcs' and
6trdssrc doneon a linkcd list with a dummy hcadcrnode.
Inscrtsay bc donc at .ry Poinrwiddn dle lisr dclctewill
r€movcall occurrcnc.sof a pafticular valuc fton thc list,
sndfind will scarchfor thc fun occuEncc of a vslucio thc
lisL
'run anlXlango's animationwindowapPea$,andaftc! lhc
mation' butron is click€4 a[ int r3 tion with thc user
occursin th. shell window.A mcnu is displaycdth€re,giving thc us€rthe optionsof insenioga rcde, delctinga nodc,
findinga node.or quiaing the applic-ation
n
9
T@
Figure l. lnscrtirg a nodest the st!fi of r linlcd list
If lbc uscr choosesto i[scn a node,Jhe wi be prompted
fd the value to b€ ins€rtc4 and thcn promptcdfor the
desiredplaceto inscn the node:citber at the $art of dle Ist'
node.If dlc
thccndof lhc list, or aftcr anotheruser-specificd
userdesiEslo deletea noale,s/hewill be prompt€dfor the
valuero be deleted anditrJormcdlhat all nodescontAin-ing
the valuewil be deleted ff the userchoosesto 6nd a value
in the tist, s/hewill be promPtedfor dD rdue to find, and
iDforEredthatonly the 6$t occu.renccof thc valuewill be
founrLAftcr all inJorrrationfor a panicular opqation has
bccnsatleredftom lh€ user,the aninarion begms-
AVL Tr€€ Rot rion
singlc anddoublerota_
Adavision's 'avlrotat' denoDstrates
rionsof ar AVL Eee upor the irucdion of an clement The
user Inay view any of four rotarioN as matry times as
dcsircdby choosingan option numbs id a shel window
'Run Arimation' button.
afterclicking XTango's
In the singleleft rotation,rhereexist rcdes A andB. where
A is thc originalroot of rheE€€andB, As left child, is the
root which resoltsftom the rotation.The Eeeis flled in by
'n'. Tbe
tblee hiangleswb.icbrepresentsubtreesof depth
33
Ite Iaboletori€s
doublc lcft .oulion coosistsof lhl!. nodc ieag€s: A' the
origiDalmoq B, As Ieft child; and C, wtrich is B's dght
cbild ald lhe Bcwroot. Itr this casc,tb€ tre is fll.d by two
tiaryd.r subtrcs of &pth l\ ad tflo liarguld srbtcas of
dsp& 'n+1'. Thc nodct in €och rotdtion a! conMied to
'linlis,' which scrvcaspoiDicrsto nodcs
subllrs by way of
i[ lhe tec. Th€ siryle rigbt atrd aloubleight rctadonsale
mifior imagesof thc lcft rctations.
Th.[€ arc cight laboratorycrcrciseswdner for this cous..
Sonc of rl€sc rcquire6c studd*s to !5c a Pack gc calcd
THREADS Cf€sl l{arncss for dlc Rcpcatd Ex.clrtion of
Ada on D.ia Sa{ctues). THRBADS is d.s$ib.d h thc followings.ctioDTrtlcs and bicf descriptionsof the labontories srE g l'n
Thc clcnont is rqrus€nt€d by a s[nl, orang€Eiarglc
which f$t apF{rs in dle top riSht'btnd corncr of thc
X$trgo wirdow. After wor*ing its way down (hc trcc itr
stadrrd binarys.3rcbte! fashion,lhc clemod aalche's'or
inscrts,itsclf to thc botlom of a subtcc' potlntially causing
tbc E c to bccomeunbalarccd Thc clemcntis ins€rt€dinto
thc lcft-mostsubEe of th! pivot fo! thc singlc lcfl mlation'
thc righ-most subdt€ for lhc singledght rctatioD'thc right
subEccof thc lcft child of lhc Pivot for thc doublc left rota_
tio!, andtbc Icft subElc of tbc right child of lhc pivot for
tbc doublcdght rotation.
1. Writing 3nAda progr.m
Thc sordrnbar€itrtoduccd to lhe Ade larguagcby wit_
itrg a progtaD!o computcthc nth powcl of2 lsitrg integcrs atrd flosts. Tbcy arc abo .quirld ro \tritc a
progra$ which uscsNcwton's mclhod to calculatcthe
squarcroo! of 2 Studcntsobscrv. thc limitarions of sizc
andaclulrcl wih Ada's buih-in tum.ric tyPcs.
2. UsingAdr Packag€s
Studcnb usc a packagccallcd Big-In&gcr to obbin
rcsulB for larycr powcrsof 2. Thcy also usc a rational
numbctpsck gc to oboin moa! acorata rcsuhsfor thc
squaFrool of 2.
Eachrorarionalsobrs its own disPlayof Ada codc.As.ach
linc of codcis bighlightt4 thc apPropriat!lint movcmcntis
pcrformrd- Oncc all links arc in Position' thc rcation
o.cr.Es.Thc iDageat cachnodcDovosto ils DcwPositiodin
tle balaNcdt€c andthc linls arc r€drawnaccordinSly.
8.!!i[-ji-lu
3. UsingCcncricPackages
Studcntsulc a gcncdctationsl packagcalld instantiat it
for Big-Integcr to incrcasethe accun f of thc squlrl
root of 2 calcul|riod,
4. Big Oh Sarnpling
Fiv. algoritbmsatEprovidcdio Ada programswith v8i_
oua Big Oh wluls. Studcnts rur| thc'sc lbrough
THREADSl,oobscrvothcir timing bchaviorboth in tabular andgraphicdform.
i!!!J
5. Big Oh Dctcrminarion
Sbdentswork wilh l0 algoritbmswhos. big Oh bchaviors $ey mlst rnelyrc rnd observe.
Figur 2. Thc repositioningof lid(s duc to tbe ilscrtioo of
str clcncnii o a subt€e.
'
--.-/-^----...-
SEcksandQueucs
S0rdedsrun arimatiots in Xfango to observear|danalyzc the bchaviorof a stack(Inix to Posdx convcrsion)
anda queue(PostOfrcc QucucSieulation).
1. comparisonofAvl ard Binary searchTr!€6
stud€ s ule packagesfor AvL E !s and Biray search
tces to obscn€ rnd comparcthci! bcbaviorsin terEs of
timcs atrd avcragcdcpth of atr clemcnt
scarch/inscrtiotr
in rhetec. THREADSis usedto performthe analysison
A
A
A
/
\
7'
ll
1l
"'\
8. SonComparisons
THREADSis usedto comparerhe behador of five differenrson algorithns overvariousdaladistributiors.
TEREA.DS:I Data Shucrt[6 Lal,oratory ThstEaress
Figore 3. A balanced AVL tr€€ following the perfornance
of a double dght rotation.
Mary cip€rimentsthar 3re perforned h the laborarori€s
iftolve runningtestson algorithmsthat have b€€n inpleThesetests produc€dresuhs
nented using Ada package.s.
34
Sa$olc Distibudon: The statisticalFobability disEiburionuscdto g.[etat€d thc llndom alatasetSanolc ordcE Tb€ o(cnt of ordldng impocedo! clo_
DeG in tbed@ sc! ftc dcfadt scttitrgsarefor a rm
clcnclq canPlctcly ulsorcd dat scr g'Eiatld lan'
domly ftom a nnifoEr randomdisditr.don'
workhg inrbe lab gives
firr canb. m€a$ftd andamlyzld
in dcir
ffiJts oc ctt-* o t" more diretty itrrolv'd
of informltioo thcv rctlitt'
ifiirg, io"t"a.iog ttrc "tount
b€-wril@nby &c s[rdtnts
soEr. of d|c Ada packageswill
',#""i"o,
t tt tit" * ptovidcdbv lhc instucror' h this
!o mol! datasulctufts and
.*a"no .*
Hi[
"*p"t"a
secirg andcxPci-JUtU". Stoa.os *itt tPeodthcir time
of
.r *g"itbns instoad actualv codits
u.
li.i"i
"n "r.
ard conrsPonding datr stuctutt's Thjs
iil-J,i*,t-"
their ability to analyz' thc cffcctivcnass
LorA-it*.""
ro r problcm'
I-aroi otacnty of aif.tcot approachls
ExperimcnlsoD
THREADS Ctcst Halness for Rcpctitiv'
to n.tnicsts
uscd
bc
car
pao
thal
SrucoFs) is a ool
-eaa
ro tht uscr
ba'k
rcponing
uoaagodthms'
oia"ru .r*t""t
'lhc Ests atl
t€sl.
thc
of
romc typc of lbc mc5suEmcnt
'[""1 ii1' ercgram thar at' itnPlcmc 'd scparattly'and
rtbrwiaird
i"v U" *dl ioa *o ."Prat'ly as wcll A!
foUows
drsual for TIiREADS
Thr basicidra bcbiDdTSREADS is i[usE!r'-d bv d|c follor,ilg chrn
Fisur. 5. THREADSWindolv
Frgut! 4. Conigurationsfor TSREADS
THREADSgmctaresa daiasc( bascdon inforDadongiven
bv thc us.r. This datasct is uscdby a blackbox to ru! onc
cxocrimcnuUoon fte black box's conplction, i! rEtMs to
TIiIREA-DS6c s'Inpl. sizc of rhc darasct and an integ'r
mcasursrcntof tllc tesr'Th. mcrsurmcnt will bc i$lud'd
in a tablcthal tc€ps trackof eachexpaincnt tllc usd ns'
Rrltrd.ocIHREADS briogsuP thc int'rhcc showr in Fig'
urE5- il informadonnc.ded for fic dau setis irput ir the
apfrofEialcpla.!'s by tlle user.The panmctersthc uscrmay
dcsrgBrtasrc asfollows:
Mcthod:The black box to usefor thc cxPctiment
'Write
to File: The lamed fil€ where tbe dala set is
stored-If no file is designare4a
bv thc
M!1h94. Thc black box proccss is sp'wncd
a
black
cxccuus
THREA.DS
pto".tt.
whcn
ffips
gcnorattd
by
dal6
sct
a
box
givcs
thc
black
box, ir
wbcn
to
rrlurn
box
black
for
lhc
writs
drcn
TIS€ADS. It
ihc black bot rrtrrns, THREADSt k s thc dateandwdtcs
i! to thc Tbblc of Mctsurmcnb. Thc black box rEtums2
'Ihs frrs1is $e sizt of thc datas€tsnddlc sccondis
in&gcrs.
thcmcasulmontfiat the blackboxrltufns.
leomed by lhe blecl box
Th?mcaningof thc mcasurEmclrt
wi vsry d.Pcldbg oo which black box is bcing run ln
som.cascsthc mcasulEm.nrmay bc thc numbcrof cogrPa!_
isotrsthal welrPerfofircd inasortroutinc ln lhc cas' ofthc
binaryseaEhdcc cxFtiments' tbc lrcasurcmcntrcllE6dm
th! avcragcdcptbofa nod€in de Etc ln 'll csscs'howcver'
intcgcr uscful in
rhc neasurcrrerr will bc a non_negative
a c€rtaio data
of
amtvzinq thc cff€cdvercsso! eficiefty
sel
Thc measlltepsnicui5I
data
structfe-or algorithrofor a
cln
thcn be com_
exPcri$erts
nentsF$rmcd ftoE diffcrent
a!aly$s'
the
user's
aid
pa€d agailst elch othcr to
!.mporarydefault6lc will be us'd'
grilelqElel The text field labeled"wrire to Fitc:" takesa
ranr asinput I{ a oameis specific4 the gcrcrateddataset
vil bc saved!o a frle wilh tbat nameitr ihe dfieclory specr'Writ€ Parh" lext ficld- If no ntse is sPccified
fied h the
thedatas.t will besav€dto a t€nporary6lc'
write Path:The palh to the di.ecrorywheret dataand
61eswill be written.
Usc File: Th€ Paft atrdnameof a dataset!o be usedin
placeof a filc generat€dbv THREADS'
write lhth. The 'Write Pa$:" iext 6eld t &esa parhstsilg
as input- THREADSwill not op€rateuntil a valid paih is
SrmpleSize:The numberof clemenisitr tle ileras€L
35
iT
1
uscrh,s
sivetr.Tbc aad sEi.ngnc€dsto bea path wherEthc
writ€s
ard
rsds
pcrnissioos' THREADS
["4 -a
";tite
it wil
data'
c/dtc
its
ar|a nf"". ft i ot"ot r€d and
i-"
bhcl
box
a
'o
ruD
o*1r*
o.o".ty. It u. u""t dEdPts
win
aPpc{r
pronpt
oipiog'ut *i . palb' a loticc
approPn",iuo,t
andoorify thc ustr o supply TIIREADS wrir &€
Ekes.a sEirg ss inpul'
lJrqEilgi Tbc {sc FilcJ' tcxt 6€ld
oas' of rhe
d"o*
to
$er!D!r-.lQs!!IiThc sanple order ref€rs 9"
"t
!o
be
sct
dlc
dara
in
lpr€N"tcd'
Uke
ffi
Oe u"cruotla
nnchs fron -l0O to lO0. A sePlc ordct of 100meanslbat
t io incrEasingsorEdods- A $D'
r& if &c a"ia
"'itl
-lm
lhar 10096of tbc d6tais in dlcrtssmca[s
Dlc
'ineord.r of
odcr of zem mcaDsthu $! d'r'
A
samplc
sonedorder.
-lm tad
isin pe*ecrfyraldon odcr' Any v6luc b'$ecn
50%of
ftst
ioo ii *".p,itr". .q *"t* of 50 meatrsthd |be
(emabdcr
is ir
,fle a"r" i.'io i""."""iog .oned ordcr' thc
Bndon o[(lcr.
coo,io tlr cntircparhand
ffifr.oiog.*,
;; il . ; used-r a valid Pathand ranc is sivcn'
thc-iofornalion
Dda.lsgi Thc detasetfu gcncraltdbsscdotr
*ur ,rsclhisdaa sctfd rtc blackboxinstcadof
iiieoi
siz.. aisitution, ad odcr 6clds Thc cle'
THREADSwill uscs sPcci6'd flm uc ".npt
o"* a*.t.
mcnb aI! Irndomly gcDeratd !o firlill thc uscr's nquitE"iro"tt
" " g"n*iog a ncwdrrasct Thcrcforc'if lhc
.o 6rot"
li.
mcnis.A datasct can slso comc ftoD t imPon'd ilatl sct
gio..*
ot* drd's€t'tbcsting in thc"Usc
and
icr *lJ*.
;ing thc "Usc Filc:" Ext 6cld bv supPlyioga Pnth
"
Filc' t xt ficldhust hcdclctcd.
namc.
s.dlculcr to c er
allo
6cld
sizc
Thc
slsplc
Smglgsjrc:
Thblc of MecruEmcnts:Sincc dala scts mty bc savc<lu
to bc i@ludcdin tbedatas'q rlngttr" nu.bo of
iil-il ign*o uy,t" ot".' cxp'dmcn$nay bcrcPcrttd'
l0ooo.Thc sanPl' sizcbsv bc ch&gcdbv
;;-t"nr i. "1".*o
frofiI 3n cxP'riDcnt scs$onmay
Tbc tableof mcasurcEents
us-inq
thcmousco clickon thcuPdownarrows'orby m!ndata6t a
also bc savcd,ao the uscr may comc backto drc
is 100
prcvbus
Jii"oatiag tn" .it" ioo thc tcit 6cld Tbcdtfrull
thc
add
to
or
cvc!
Iatardlrc !o continucanalysis
clcmcDls.
ridt
thc
clictirg
by
savcd
.rocrincnr rccrra" Tattcs rIE
'Filc' mdru
thc
Fron
tlc
tvpc
lablc
.ius" Uunonwhilc on lhc '
SloDl-DirEilstiqDi Sa[tpl€disEibutioniEdicatrsdistrib'Savc as and a sav' window will
ttc option
iiiiriTaoto.o io *tti"n ttt" di6taclcEcntsarcto bc
"ioos"
ro chooseftom:
a5D!ar.To load in a prcviously sav'd bblc' choosc lhc
utca neIE arc six aficrcnt distdbuaions
'Fil€' mcnu'
and
binogallsu'
Poisson'
option 'OPm' ftom thc
oormal'
unifomucxponcntial,
'RuD ExPcridcnl' buuon ts
Eial.
Run Exrc;m.ti: WhcD thc
."t is g*"t"td snd wrinc! to drc tppropliTo lha righ! of thc SePIc Distibution'th"E is a button ii"t"a.[ior,
snd c-rca
'inrib,ltion
pu""mcrcts'.
clickrd
is
butlon
If rhis
at file. Ncrf thc black box Foccss is sPsm'd
ul"ta
sizc and
thc
ssmPlc
fioishcs,
box
black
cut d. Wh thc
windou,pahclwithnumbor6cldswil aPpca!'
If
ncasurdrlcnt&e writtrn to ttlc tablc of ncrsulctretrts'
rhc uscr h.s not provid.d TI{READS wih dlc aPProPna&
infoimarion,theuscrwi bc notificd to do 3oard no cxPnuscr
mcrt will bc run. If thc black box atois or ctashcs'thc
ad
boJ(
black
witt Uonotincathat Octc c/asao enor in tb'
no datawil bc wdtt n to thc bble.
Figurc6. DistributioDParamctclswitrdow
Wlth this disttihxion window Paoel,the usercan modify
the disttibudonsby changingthc parancte$ ior €€chdisErbudon.
Thes€distibutiols canbc ulcd to evaluatchow lhe disEibuiioD of dia can aficct iliff€tElt dala sEuclrlles For most
crses.Unifotm disEibutionis suffciedt. Fuu$cwo* on distribuiom includestbc developmerrof black boxcsthattully
udlizelhe SampleDisldbutiod featue of THREADS'
gsa.lftl8bi whcn tllc 'vicw Graph' buoonis click'd' lhe
-.r"ut r.os curcntlv in thc Eblc wil bc uscd as the
fot gopt. Crapt are gEndat'd using thc X_
"o*ainor,
" packageXVGR ald nay be cr€st'! al
sindoua glzphing
sassionE ch gr4h is ptEduc€d
-" ooiorin rtto
"*potiut.nr
inlts own windowwith a uniquctitlc, wbch alows for ctsv
compadsonbctw€cngraphs.
g.gcr.l3blg The Clcar Tablc' lutloo-alloq's th€ user to
clelr thc tablc ar any poi during a THREADS session'
This cMblesthc userto $an a newlet of exPcriEcn6at a$y
'ClcarTablc' boton is cliclcd a promptwi
dme.Whentb€
arDearaskirg f tbcy r.ally want to clcar thctablc ff "Cl$r
r:itu' ;s setcrrel" dc cablewiU bc cl€and If canccl is
selectrd,thc userwill be retumedto TIIREADS vith no
charycs.
36
sdollableare3-This witrdowis siztd so thatit canb€placed
trextto theTIIREADS witrdowon the sase s€reetrfol easy
refercnccwhetrwotking v/i6 TI{READS.
CondusioE
The studcnt r€rctioDs!o th€ use of tllc laboratorieswas
favonblc.TheyfoundISREADS !o be a very usetrl tool as
was
well as€3syto use,Tbelr e\€luadonof the laboaalories
them
udfom y positivc,itrdicatingtllat thc stuilcntsfound
intcrc$ing,instuctive, sndchallctrgirg.
Thb courscwasoficrcd i! a scnitrgwhcrc &e laborarorics
hsd to bc conplctcd outsidc of r.gularly scb.dulcd class
timc ard without thc instuctor's supervision.It would have
bccnbctterto havcscbedulcdandsupcrviscdlaboratorysessionsfor complciionof thc laboralorycxcrciscs Also' thc
scoingu!.d madcthc laborarory.xcrcisesindividualefforis
{,hclcr.sa tcamcfrort q/ouldbc morc cffcctivc.
Figule?. E)qonc sclcctionfor Big Oh cocfficientsuEma'Cocmcicnc' buton is clickrd' r small
@l6cigltr: If thc
window wilh 6vc buttonswill alpcar (Figu. 7) Thc fivc
'n'
buBonsarc log(t), n, nlog(n), n2, and n to sohc pou/er
bciry tho saEplc sizc.If one of dpse buttoDsis clickcd, an
wirdoi/ ydll .pp.-a! displayingrhc cocfficicntsof th{r Parriculrr Big Oh of tlc datain thc tablc. For cxamPlc,if lhc
datr in thc tabk is:
100
Thc animatior! werc lsed in two settr[gs. Thc studcnb
wcrc givenistuctions on thcir usc8nd€ncoomg€dto run
ad obse c thcm.In lddition, thcy wcrc usedfor irclass
A closcdlaboratorysctting would incr.asc
domonsEations.
thc cfrcctivcncssof thc animationsby pdnidiog an cffcctivc combinationof dcmonsradonand intcractivesMcnt
600
The succcssof the substitutionof animationsfor stualcnt_
writtcn implemcntaliotrsis bci mcasu€dby the ability of
thc datashruracs andassociatcd
thc studcntsto understand
algorittms lnd to apptyth€m in thcir tats work Si[c! all
studcntsftom this classhavc now completcda subccqucnl
algoritfunscbss, wc canstatethal ltudcnts l€arningin this
lnvironsrcntwcreablc to und€rsttnd,apply,ad cxtendtlle
conccptsofthis courseaswcll aslhosewho did moreextensiveimplcbentstiooptogsnming.
If thc tl2 buson is clickcd, tlr windowwiu apPsr displaying:
100
t
f
d
'-.
lt
d
v
.v
.ll
6006.0000000008-{D
This mcaasthatwith n=loo atldyd0o, sn cxFtssion of the
form y=cn2 would tquirc c to b. 6.000q)00E-02.lf lhis
cocficicnt rcmainsralatively consta ovcr nratryYalucsof
n, thc function rcpr€scntcdis a goodcandida&for thc bi8oh functionofthc blackbox proccss.
Thc mostproblcmaiicaspcctof thcscmodificationswasthc
us. of theAda prognmhitrg language.Thc strdentrEaction
to tbe usc of Ada was uiformly negative.This was not a
rcslll of ihe languageits.lf, which thc auihoE still betieve
to bc a vcry efrcltive vehiclcfor thc demonstationof dala
structur.s,bu rarherduc !o local cotditions.
'HelP' button
Hdti Hclp may bc foudd both by ctcking thc
or thc THREADS window. or by F!.ssing thc hclp key on
tbc kcyboad. The btion or thc THREADS windo* will
opcn a pop-up witrdow that codains completehclp text.
Pushinet|e 'hclp' key on thc kcyboad wi giv€ a shon
summrryof helpfor the spoton th€ windowwhffe thc cursoris pointirg.
'Quit' buttor is clickrd, a notic€pronpt will
Ogir If the
appearand askif thc userrealy wan6 to quit. If c$cel i5
s€I€.ted"the uler will be rcfi.Enedto the loain THREADS
'Quit' is selecred'
plogram 'tithout any changes. U
TI{READS vill exir and close all witrdows. Also wben
THREADSis quit, all tenpordry files will bo deleted$ no
unvtantEd
files remainin the specifiedwdte PatbdiEctory'
There is a snall tutorial Fogram lhat
!8EADS-&Ed3L
is includti with THREADS. When this prograrnis run a
window opeDstbat disPlaysthe compl€tehrto;al text in a
Itr all cou$esb thecurriculumprior to lhis collls., the stu_
denlshad'rsedPascal.Ir coursesbcyondthis onc, thcy ar€
either osingC++ or g !n a choice of language.The only
that uscsAda heavilyis
olhorcou$ein thc local cNlrriculuEl
tlte progr.[lnidg laneuagpscouse. As a resull the students
foundthc on-the-flytearningof Ada at the begiming of th.
burdc!. They
data structuescourseto be a[ unnecessary
fett tharthis burler cameon top of iheir otherrcsponsibili
ties for the classard that thcre waslittte futur€ valucto be
dqived ftom lbis cfforl
the tutri€ directionof
As a resultof the abovcobs€rvations,
thi! effon ir to convent!€ dala strucorescoursq it Lbom-
37
torics, and animatims to C++. The local cuniculllm has
trowb€cDDodiE d so thr! thr students6lsr pmglm in Ci+
in a courso Fior io this oDq so tha! ni be no tine
fiquircd to lcan thc language.In additioa, the pr€vious
cou$cs low cEphasizclbc objcct-oricnlcdapproach,rnd
this approacbwill bc intcgratcd i$o the dacastuctures
co|.|Isoandthelaboratori€saswell.
Ihc incoductionof closedlaboratori€sis ano6€rmodifcationthat wi[ bc institrrtcdin fuorc offeringsoftbis course.
Acknostdgmc[ts
Workon thisprojcc!wassupportd in palt by DARPAgrant
lumbcr MDA972-92-J-1030andNaionrl Scicrcc Foundatio! grantoumb€tCDA-9200118-
BIBLIOGRAPEY
MA,
Ul Broqn,M.H.,AtgonrrraArinarion, Cambddgc,
MITPrcss,1987
VA,
t2lFddn,{'\1"}', DataAbstr*tion rir, Ada,Reston,
Conplny,l98t
RcstonPubUshilg
*ith Ada:an
[3] FcldEar,M3., Tcachingalalastructurcs
cigbtycarpc$pc.tive,S16CSE
Bu erin,22Q):21-29,Itllrc,
r990.
8., Introdlr.tio to Absn'actData,p.s Using
t4l HjJJam,
nda BnSlcwood
Oifis, Nt, hcnticc-llall, 1994
in compu&rscicnce
[5] Naps,lL. Algoritbd visualizatiotr
laboratorics,
SICCS' 8lllt .i,r, 22(1):105-110,
Fcbruary,
1990.
[6] Silvcr, J.L., Using Ada to spclify and c]"luatc project!
in adra(asuucNrcscoursc,SICCSEBu\erin,23(l).337-y0,
Ma&h l9l.
m SE ko, JohnT. TANGO: A framcwork and systemfor
algorithmanination, Conputea23(5\t n -38, l99O.
[8] St'!bbs, D.F. and N.w. webrc, Ddto S''l'.tures with
Abttmct Dota Ttp.s atd Ada, Boston,PWSK€nt, 1993.
[9] weiss,Mffk A. Dara Stuctuns and Algorithn Analysb
ir Ada, New York Benjanin Curltrrings PublishinsCo.
Inc..1993.
38
Download