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

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

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

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

EG1hao
网课代修代上,cs代写代考
C语言代写
您的位置: 主页 > 编程案例 > C语言代写 >
代写C语言:CS代写之计算机C code代写 算法代写comp10002 Foundations of Algorithms - C语言代写
发布时间:2021-07-25 19:30:36浏览次数:
School of Computing and Information Systemscomp10002 Foundations of Algorithms Semester 2,2018Assignment 1In this project you will demonstrate your understanding of arrays, strings, and functions. You may also use typedefs and structs if you wish (see Chapter 8) – and will probably find the program easier to assemble if you do – but you are not required to use them in order to obtain full marks. You should not make any use of malloc() (Chapter 10) or file operations (Chapter 11) in this project.Superstring AssemblySupposethatmultiplecopiesofalongstringarecutupintomuchsmallerpieces.Ifyouaregiven theavailablefragments,isitpossibletorebuildthelargerstring?Forexample,iftheoriginalstring was algorithmsarefunfunfun ,andyougotgivenalistoffragmentslike refun and unfun rith and lgo andsoon,pluslotsmoresmallfragments,couldyourebuildtheoriginalstring? Probablyyoucould,right?Butwhataboutiftheoriginalstringwasmillionsofcharacterslong,like WarandPeace?Orbillionsofcharacterslong,likeyourgeneticsequence?Let’s ask a slightly different question now: if you got given a set of small string fragments each fromalargerstringthatyoudidn’tknowanythingabout,couldyouatleastfindtheshorteststringin whicheverysuppliedfragmentoccursatleastonce? Thisproblemisknownastheshortestsuperstring problem,andcanbethoughtofashavingparametersn,thenumberofstringfragmentsprovided,and m, the total length of those string fragments. The shortest superstring problem is very important in bioinformatics, where genome reassembly from short fragments called reads helps contribute to our understanding of the behavior oforganisms.Unfortunately, finding optimal solutions to the shortest superstring problem has been shown to be very challenging, and falls into a family of intractable problems that we’ll talk about later in the semester.Inthisprojectyouwillimplementsomeapproximationtechniquesthatgeneratenon-optimal superstrings from a collection of stringfragments.Input DataInputtoyourprogramwill(always)comefromstdin,andwill(always)consistofstrictlylower-case alphabeticstrings,oneperinputline,eachlineterminatedbyasinglenewline’ ’character.Besure to read the message on the FAQ page about newlines. For example, the following file test0.txt containing six fragments is a validinput:accgtcgatg gcctag gtacctacta cgatgcc tcgatgccgca atgagaccgtcAsyoudevelopyourprogramaccordingtothestageslistedbelow,theoutputwillevolve.Fulloutput examples for this and two other test files are linked from the FAQ page. You should also check your program against other inputs too; and can easily generate your own tests using a text editor. Testing and debugging is yourresponsibility.Intermsofdevelopingyourprogramforthisproject,youmayassumethatnostringfragmentwill be longer than 20 characters, and that there will be at most 1,000 such fragments supplied. You may alsousebrute-forceprogrammingratherthantryandusemoreelegantdatastructuresandalgorithms– this activity is primarily about C programming rather than algorithm design.Stage 0 – Reading Strings (0/15 marks)Before tackling the more interesting parts of the project, your very first program should read the set of input fragments into an array of strings, and then print them out again so that you can be sure you havereadthemcorrectly.YoucandothataspartofyourDEBUGmodecode,seethesuggestionbelow. Each of the following stages will then require a function that carries out the required processing, in each case working through the strings that were read, and then building (and selectively writing) the requiredsuperstring.Stage 1 – Overlapping Suffixes (8/15 marks)In this first stage you are to build a superstring according to the following process: start with thefirst of the input fragments and use it to initialize a partial superstring; then process every other fragment ininputorder,checkingfirsttoseeifitisalreadywhollypresentinthepartiallybuiltsuperstring,and if it is not, checking to see if there is any overlap between the head of the new fragment and the tail ofthesuperstring.Ifthefragmentappearsalreadywithinthesuperstring,nofurtheractionisneeded. Or, if there are overlapping characters, the required part of the fragment is appended to the end of the partial superstring. If there is no tail overlap, the whole of the fragment is appended to the partial superstring. For example, on the test0.txt file, the six input fragments result in this sequence of superstrings beingformed:Stage 0Output 6 fragments read, 55 characters in totalStage 1Output 0: frg= 0,slen=10 Accgtcgatg1: frg= 1,slen=15 AccgtcgatGcctag2: frg= 2,slen=24 AccgtcgatGcctaGtacctacta3: frg= 3,slen=24 AccgtCgatGcctaGtacctacta4: frg= 4,slen=35 AccgtCgatGcctaGtacctactaTcgatgccgca5: frg= 5,slen=45 AccgtCgatGcctaGtacctactaTcgatgccgcAtgagaccgtcwhere the three numbers shown are the operation number, the number of the fragment that is beingadded, and the new length of that partial superstring. Note how the letters that are at the start of eachfragment have been capitalized in the output so that they can be identified in the superstring, and howone of the fragments was found within the partial superstring. At the end of the process there are 45characters in the superstring, a saving of 10 compared to the original input size of m = 55 characters.ThereisdetailedexampleoutputprovidedontheFAQpageshowingtherequiredoutputforlonger inputs that your program mustmatch.Stage 2 – Choosing Extension Fragments (13/15 marks)The approach used in Stage 1 is simple, but a bit limited, since it only saves space if there is overlap between the first characters of one fragment and the last characters of the previous one. A better approachistostartbyinitializingthesuperstringtothefirstfragment(andmarkingthatoneasbeing processed),andthenrepeatingthesestepsuntileveryotherfragmenthasalsobeenprocessed:Check every unprocessed fragment; if it appears anywhere within the superstring, mark it as pro- cessed.Then, check every remaining unprocessed fragment, and calculate the length of the overlap be- tween the beginning of the fragment and the end of the superstring;Choose the unprocessed fragment with the longest overlap, append it to the superstring, and then mark it as being processed.If two fragments have the same maximum overlap length (including the case when the overlap length is zero), select the one that appeared earliest in the input.TheStage2outputfortest0.txtis,with(notedinthe“frg=”column)theorder0,4,3,5,1,2,is:Stage 2Output 0: frg= 0,slen=10 Accgtcgatg1: frg= 4,slen=15 AccgTcgatgccgca2: frg= 3,slen=15 AccgTCgatgccgca3: frg= 5,slen=25 AccgTCgatgccgcAtgagaccgtc4: frg= 1,slen=31 AccgTCgatgccgcAtgagaccgtcGcctag5: frg= 2,slen=40 AccgTCgatgccgcAtgagaccgtcGcctaGtacctactaThis superstring requires 40 characters. Again, see the FAQ page for full output requirements.Stage 3 – Double-Ended Strings (15/15 marks)Nowforachallenge(ifyoureallywantthelasttwomarks).Insteadofregardingthepartialsuperstring as being “append only”, observe that it has two ends, and hence two points where it might have fragments joined to it. That is, instead of searching at each iteration for the unprocessed fragment that has the most overlap with the end of the partial superstring, you should also check for overlaps between the head of the partial superstring and the tail of eachfragment.Then,outofallthepossibilities,choosetheonethatgivesthemostoverlap.Tobreakties,choose thefragmentthatappearedearliestintheinput,andifthesamefragmentnumberhasthesameoverlap (including zero overlap) at head and at tail of the superstring, place the fragment at the end of the superstring (rather than prepending at the start ofit).You might need to make some quite wide-ranging changes in your program to accomplish this stage,sobesureto:(a)submityourStage2program(seetheinstructionsontheFAQpage);andthen(b) save a copy of your Stage 2 program before you start restructuring it. Example Stage 3 output is provided at the FAQ page, for test0.txt the superstring takes just 34 characters.Beyond the Scope of the ProjectLater in the semester, when you have been taught about malloc() and dynamic memory, if you feel like some fun, then try this approach: check every pair of strings against each other at both ends, to find the two that have the longest head-to-tail overlap. Join those two strings together to exploit that overlap. Doing so reduces the set of strings by one, and hence after a total of n 1 such steps, a single string will remain. It is guaranteed to be within a factor of three of the length of the optimal superstring.(Butpleasedon’tsubmitanysuchprogramsforassessment,evenifyougetthemworking prior to the submissiondeadline.)General tips You will probably find it helpful to include a DEBUG mode in your program that prints out interme- diate data and variable values. Use #if (DEBUG) and #endif around such blocks of code, and then#defineDEBUG1or#defineDEBUG0atthetop.Turnoffthedebugmodewhenmakingyour finalsubmission,butleavethedebugcodeinplace.TheFAQpagehasmoreinformationaboutthis.Thesequenceofstagesdescribedinthishandoutisdeliberate–itrepresentsasensiblepaththough tothefinalprogram.Youcan,ofcourse,ignoretheadviceandtryandwritefinalprograminasingle effort, without developing it incrementally and testing it in phases. You might even get away with it, thistimeandatthissomewhatlimitedscale,anddevelopaprogramthatworks.Butingeneral,oneof thekeythingsthatmakessomepeoplebetteratprogrammingthanothersistheabilitytoseeadesign path through simple programs, to more comprehensive programs, to final programs, that keeps the complexityundercontrolatalltimes.Thatisoneoftheskillsthisissubjectisintendedtoteachyou.The boring stuff Thisprojectisworth15%ofyourfinalmark.Arubricexplainingthemarkingexpectationsisprovided on the FAQ page. You need to submit your program for assessment; detailed instructions on how to dothatwillbepostedontheFAQ pageoncesubmissionsareopened.Submissionwillnotbedonevia the LMS; instead you will need to log in to a Unix server and submit your files to a software system known as submit. You can (and should) use submit both early and often – to get used to the way it works, and also to check that your program compiles correctly on our test system, which has some different characteristics to the lab machines. Failure to follow this simple advice is highly likely to resultintears.Onlythelastsubmissionthatyoumakebeforethedeadlinewillbemarked.Marksand a sample solution will be available on the LMS before Tuesday 2October.Academic Honesty: You may discuss your work during your workshop, and with others in theclass, but what gets typed into your program must be individual work, not copied from anyone else. So, do notgivehardcopyorsoftcopyofyourworktoanyoneelse;donot“lend”your“Unibackup”memory stick to others for any reason at all; and do not ask others to give you their programs “just so that I can take a look and get some ideas, I won’t copy, honest”. The best way to help your friends in this regardistosayaveryfirm“no”whentheyaskforacopyof,ortosee,yourprogram,pointingoutthat your “no”, and their acceptance of that decision, is the only thing that will preserve your friendship. A sophisticated program that undertakes deep structural analysis of C code identifying regions of similarity will be run over all submissions in “compare every pair” mode. Students whose programs are so identified will either lose marks through the marking rubric, or will be referred to the Student Center for possible disciplinary action without further warning. This message is the warning. See https://academicintegrity.unimelb.edu.au for more information. Note also that solicitation of solutions via posts to online forums or marketplaces, whether or not there is payment involved, is also Academic Misconduct. In the past students have had their enrollment terminated for such behavior. The FAQ page contains wording for an Authorship Declaration that you must include as a comment at the top of your submitted program. Marks will be deducted if you do not doso.Deadline: Programs not submitted by 10:00am on Monday 17 September will incur penaltymarks at the rate of two marks per day or part day late. Students seeking extensions for medical or other “outside my control” reasons should email [email protected] as soon as possible after those circumstances arise. If you attend a GP or other health care service as a result of illness, be suretotakeaHealthProfessionalReport(HPR)formwithyou(getitfromtheSpecialConsideration section of the Student Portal), you will need this form to be filled out if your illness develops in to something that later requires a Special Consideration application to be lodged. You should scan the HPR form and send it with any non-Special Consideration assignment extensionrequests.And remember, algorithms are fun!

所有的编程代写范围: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++、数据结构代写、代写数据结构、数据结构代做、代做数据结构等留学生编程作业代写服务。