Assignment on Data Structures and Algorithms (Doc)
Added on - 09 Oct 2019
3
Pages
1133
Words
107
Views
0
Downloads
Trusted by +2 million users,
1000+ happy students everyday
1000+ happy students everyday
Showing pages 1 to 1 of 3 pages
Data Structuresand AlgorithmsObjectivesDesignandimplementaprogrambasedonagreedy algorithmtosolvetheMinimalSpanningTree(MST)problem;Chooseandimplementappropriatedatastructuresforthe algorithm;Analysetheefficiencyofdifferentimplementationsofthealgorithmincomparisonwiththebruteforcealgorithm.TaskYoushouldwriteasingleprogramwhichimplementsPrim’salgorithmwithdifferentdatastructures,aswellasthebruteforcesearchalgorithm,tofindtheMSTofanundirected,connected,weightedgraph.ProgramYourprogramshouldreadasymmetricmatrixfrom atextfilethatdescribesweightededgesofanundirected, connectedgraphandfindtheMSTthatissavedinanoutputfileasasequenceofedgesoftheMST.Theprogramalsodisplaysthe numbersofverticesandedgesinthegraph andthetimespenttofinditsMSTforeachdatastructure usedinPrim’sandthebruteforcesearchalgorithms,whichcanbesavedin anotheroutputfileaswellforyourlateranalysis.Yourprogramshouldonlymeasurethetimespentbythealgorithmwithitsdata structuretofindtheMSTsothatitisaproperdesigntouseonemethod/functiontoimplementanalgorithm anditsassociateddatastructure.Foranalgorithmthatoperatesonaweightmatrix,ittakestheweightmatrixstoredinatwo-dimensionalarrayasitsparameter;foranalgorithmthatoperates onadjacencylists,ittakesadjacencylistsyoucreatedfromtheweightmatrix.Youmaycreateyourownlistdatastructuresbased on arrays.NoSTLorJavaCollectionorothercollectionframeworkcanbe used.Inthe partofthe algorithmimplementation,youshould notuseanylibraryfunctionsincludingmaximalorminimalfunctions butcreateyourownfunctionsto operate onarrays.Yourprogramshould bereadable andwellcommented.Inaddition,youneedstocreateasmallprogram orscripttogeneratetheweightmatrixforagraphofvariousverticesand edges, savedtoatextfile. Whenyoucreategraphs,youneed considerthedensityandconnectivityofgraphs.Youmayuseaprogram/scriptbyotherpeople,withreferencetothesource,togeneratethesematrices.

You’re reading a preview
To View Complete Document
Click the button to download
Subscribe to our plans