EssayGhost Assignment代写,Essay代写,网课代修,Quiz代考

EssayGhost-Essay代写,作业代写,网课代修代上,cs代写代考

一站式网课代修,论文代写

高质量的Assignment代写、Paper代写、Report代写服务

EG1hao
网课代修代上,cs代写代考
C++代做
您的位置: 主页 > 编程案例 > C++代做 >
代写C++/C:CS代写之算法设计C++代做题目:Design of Algorithms Assignment 1: Multi-wo - C++代写
发布时间:2021-07-25 22:19:50浏览次数:
COMP20007 Design of Algorithms, Semester 1, 2018 Assignment 1: Multi-word QueriesDue: 12 noon, Monday 9 AprilOverviewIn this assignment you will implement a small part of a text search engine: using an existing inverted file index for a multi-word query to find the top-matching documents in a large document collection.The assignment consists of 2 coding tasks and 1 written task. Each task is described in detail in the sections below.Provided filesBeforeyouattemptthisassignmentyouwillneedtodownloadthefollowingcodeanddatafilesfrom theLMS:Makefile To assist with compilation. Edit if you add any extra files. data/ Directorycontainingmanyterm-basedinvertedfileindexfiles. documents.txt List of all documentsindexed.At this point, you should be able to compile the supplied code (above) by running make. Once your assignment is completed, you will be able to execute it by running a command of the form./a1 -t task -r num results -d num documents list of querytermswhere•taskiseither1or2representingwhichcodingtasktoexecute,•numresultsisthenumberofsearchresultstofindanddisplay,•num documents is the maximum number of documents to consider (optional; the default is ‘all documents’, or 131,563),and•list of query terms is a space-separated list of words making up a query for your program to ‘search’for.For example, the command ./a1 -t 1 -r 12 algorithms are fun will run your solution to task 1ontheentiredocumentcollection,printingthetop12resultsmatchingthecombinationofwords ‘algorithms’, ‘are’, and‘fun’. Data structuresYour solution will need to work with the data structures defined in index.h and list.h. Here’s a briefoverview(consulttheheaderfilesforthefinerdetailsandafulllistofavailablefunctions):•An Index is used to represent a multi-term inverted file index. An Index has an array of string ‘terms’.Foreachterm,italsostoresaListofDocuments.•EachListintheIndexisalinkedlistofNodes,witheachNodecontainingapointertoasingleDocument. These lists can easily be traversed using an appropriate while or for loop.•A Document contains an integer id and a floating-point score. The id is an ordinal integer identifyingaparticulardocumentintheoverallcollection(seedocuments.txt,whichlistsall documentsbytheirid,startingwithdocument0).Thescoreisanon-negativerealnumber calculatedbasedontheprevalenceofthecorrespondingtermwithinthisdocument.•Documentsoccurineachoftheindex’slistsinorderofincreasingid.Onlydocumentswithscore greater than zero for a term are present in the list for that term.Additionally,youwillrequireanarray-basedbinarymin-heapmoduletocorrectlyimplementeachof the coding tasks. It is up to you exactly how to design and implement this module. Your solution to theweek4labtaskswillbehelpfulhere.Notethatsamplelabsolutionswillbereleasedintheweeks aftereachlabandthatthesemaybeusedinyourassignment(withproperattribution).Furthermore,youmaycreateanyadditionalmodulesnecessarytosupportyoursolution.Ifyouadd additionalmodules,itisyourresponsibilitytocorrectlyextendyourmakefile—youmustensurethat yoursolutioncanbecompiledaftersubmissionsimplybyrunningmake.Coding tasksThe first two tasks of the assignment require you to implement functions inside query.c.Task 1: Array-based accumulation approach (3 marks)Implement the function print array results() defined in query.c. This function has three input parameters: index (an Index pointer) containing data for the query to perform; n results (an integer)describingthenumberofresultstooutput;andndocuments(anotherinteger)containingthe total number of documents in the collection to be queried.Thisfunctionshouldfindthetopnresultsmatchingdocumentidsandtheirassociatedtotalscores. The total score for a document is the sum of its score from each term in the query. For this function, usethefollowingmethodtofindthesetop-scoringdocuments:1.Initialise an array of n documents floating-point numbers, all set to0.0.2.Iteratethrougheachdocumentlistintheindex.Foreachdocumentinthelist,addthedocument score to the corresponding position in the array (using the document id as an arrayindex).3.Use the priority queue-based top-k selection algorithm to find the maximum n results total scores in the resulting array, and their associated documentids.The function should print these results as per the instructions in the ‘Output format’ section below. Task 2: Priority queue-based multi-way merge approach (3 marks)Implement the function print merge results() defined in query.c. This function has two input parameters:index(anIndexpointer)containingdataforthequerytoperform;andnresults(an integer) describing the number of results tooutput.This function should also find the top n results matching document ids and their associated total scores. For this function, use the following method to find these top-scoring documents:1.Useapriorityqueue-basedmulti-waymergealgorithmtoiteratethroughthentermsdocument listsconcurrently:•Initialiseapriorityqueuetoorderthedocumentlistsbasedontheidoftheirfirstdocuments.•Repeatedly retrieve a document from the document list at the front of the priorityqueue, and rearrange the priority queue so that this list is positioned according to the id of its nextdocument(steppingthroughthelist).Stopafterprocessingalldocumentsinalllists.2.Whileiteratingthroughthelistsinthisway,accumulatetotalscoresforeachdocumentid.Use the priority queue-based top-k selection algorithm to find the maximum n results total scores and associated documentids.The function should print the results as per the instructions in the ‘Output format’ section below.Output formatThe output of both functions should follow the same format: the top-scoring n results results with non-zero scores, printed one result per line to stdout (e.g. via the printf() function).Theresultsshouldbeprintedindescendingorderoftotalscore(thatis,withthehighesttotalscoring document on the first line, and then the second, and so on). In the case of multiple documents with the same score, such documents may be printed in any order relative to each other. Each document shouldbeonitsownline.Thelineshouldbeformattedwiththedocumentidprintedfirstasa6-digit decimalinteger(paddedontheleftwithspacesifnecessary),followedbyasinglespace,followedby the floating-point total score of the document to a precision of 6 digits after the decimal point. The followingformatstringwillbeuseful: 6d .6f Thereshouldneverbemorethannresultslinesofoutput.Ifmanydocumentshavethesamescoreas thedocumentwiththenresultsth-highestscore,anysubsetofthesedocumentsmaybeprintedsuch thatthereareexactlynresultslinesofoutput.Moreover,thereshouldbenoadditionalinformation printed to stdout (if you must print additional information, you can use stderr). Finally, only documentswithnon-zerototalscoresshouldeverbeshown.Therefore,forsomequeries,theremay actually be fewer than n results lines ofoutput.Example outputTohelpyouvalidatetheoutputformatofyourfunctions,weprovidesomesamplesofcorrectoutput for three basic queries. Download the sample files from the LMS. The files contain one example of correctoutputfromaselectionofcommands,describedinthefollowingtable.Theseexamplesareintendedtohelpyouconfirmthatyouroutputfollowstheformattinginstructions. Note that for some of these inputs there may be more than one correct output due to different possibleorderingsofdocumentswiththesamescore.Thesesamplesrepresentonlyoneordering.Note alsothatthesesamplesrepresentonlyasmallsubsetoftheinputsyoursolutionwillbetestedagainst after submission: matching output for these inputs doesn’t guarantee a correct solution. You are expectedtotestyourfunctionscomprehensivelytoensurethattheybehavecorrectlyforallinputs.Since the expected output format for task 2 is identical to that of task 1, you can test task 2 by replacing -t 1 with -t 2 in each command.Warning: ThesefilescontainUnix-stylenewlines.Theywillnotdisplayproperlyinsometext editors, including the default Windows text editorNotepad.Written taskThefinaltaskoftheassignmentrequiresyoutowriteareportaddressingthetopicsdescribedbelow.Task 3: Analysis of algorithms (4marks)First, analyse the different approaches from task 1 and task 2 in terms of their asymptotic time complexity.Then,exploretheeffectthatthevariousinputparameters(suchasthenumberandlength of document lists in the query and the number of results requested) have on the time taken by your program to produce its results. Support your investigation with experimental evidence gatheredby timingyourprogramwithvariousinputconfigurations.Includeaplottovisualiseyourexperimental results in your report. To conclude, give a precise characterisation of the circumstances where we should prefer one approach over theother.Your report must be no more than two pages in length. You may use any document editor to create your report, but you must export the document as a PDF for submission. You should name the file report.pdf.SubmissionVia the LMS, submit a single archive file (e.g. .zip or .tar.gz) containing all ftles required to compile your solution (including Makefile) plus your report (as a PDF). When extracted from this archive on the School of Engineering student machines (a.k.a. dimefox), your submission should compile without any errors simply by running the make command.Please note that when compiling your program we will use the original versions of the filesmarked ‘Do not change’ in the Provided files list. Any changes you have made to these files will be lost. Thismayleadtocompileerrors.Donotmodifythesefiles.Submissions will close automatically at the deadline. As per the Subject Guide, the late penalty is 20% of the available marks for this assignment for each day (or part thereof) overdue. Note that networkandmachineproblemsrightbeforethedeadlinearenotsufficientexcusesforalateormissing submission.PleaseseetheSubjectGuideformoreinformationonlatesubmissionsandapplyingfor anextension. MarkingThe two coding tasks will be marked as follows:•2 of the available marks will be for the correctness of your program’s output on a suite of test inputs. You will lose partial marks for minor discrepancies in output formatting, orminor mistakes in your results. You may score no marks if your program crashes on certain inputs, producescompletelyincorrectanswers,orcausescompileerrors.Wewillcompileandtestyour programontheSchoolofEngineeringstudentmachines(a.k.a.dimefox).•1oftheavailablemarkswillbeforthequalityandreadabilityofyourcode.Youwilllosepartor allofthismarkifyourprogramispoorlydesigned(e.g. withlotsofrepetitionorpoorfunctional decomposition),ifyourprogramisdifficulttofollow(e.g.duetomissingorunhelpfulcomments orunclearvariablenames),orifyourprogramhasmemoryleaks.The written report will be marked as follows:•1 of the available marks will be for the clarity and accuracy of your analysis of the asymptotic time complexity of the two approaches. You will lose partial marks for minor inaccuracies, or misuse of terminology ornotation.•2oftheavailablemarkswillbeforthequalityofyourinvestigationintotheobservedperformance ofbothapproaches.Youwilllosemarksifyourinvestigationisnotsupportedbyexperimental evidence,ifyourreportdoesnotincludeavisualisationofyourresults,orifyourinvestigation does not fully address thetopic.•1oftheavailablemarkswillbefortheclarityandaccuracyofyourconclusion.•Additionalmarkswillbedeductedifyourreportistoolong(pastthetwo-pagelimit)orisnot a PDFdocument.Academic honestyAllworkistobedoneonanindividualbasis.Anycodesourcedfromthirdpartiesmustbeattributed. All submissions will be subject to automated similarity detection. Where academic misconduct is detected, all parties involved will be referred to the School of Engineering for handling under the University Discipline procedures. Please see the Subject Guide and the ‘Academic Integrity’section of the LMS for moreinformation.代写CS Finance|建模|代码|系统|报告|考试编程类:C++,JAVA ,数据库,WEB,Linux,Nodejs,JSP,Html,Prolog,Python,Haskell,hadoop算法,系统 机器学习金融类:统计,计量,风险投资,金融工程,R语言,Python语言,Matlab,建立模型,数据分析,数据处理服务类:Lab/Assignment/Project/Course/Qzui/Midterm/Final/Exam/Test帮助代写代考辅导E-mail:[email protected]微信:BadGeniuscs 工作时间:无休息工作日-早上8点到凌晨3点如果您用的手机请先保存二维码到手机里面,识别图中二维码。如果用电脑,直接掏出手机果断扫描。

所有的编程代写范围:essayghost为美国、加拿大、英国、澳洲的留学生提供C语言代写、代写C语言、C语言代做、代做C语言、数据库代写、代写数据库、数据库代做、代做数据库、Web作业代写、代写Web作业、Web作业代做、代做Web作业、Java代写、代写Java、Java代做、代做Java、Python代写、代写Python、Python代做、代做Python、C/C++代写、代写C/C++、C/C++代做、代做C/C++、数据结构代写、代写数据结构、数据结构代做、代做数据结构等留学生编程作业代写服务。