辅导案例-CMPUT 201

  • May 15, 2020

/* CMPUT 201 Assignments *//* Dues: *//* #1: 11:55pm, September 29, 2019; *//* #2: 11:55pm, November 3, 2019; *//* #3: 11:55pm, December 6, 2019 */(Mandatory assignment cover-sheet; without it, your work will not be marked.)Submitting student:Collaborating classmates:Other collaborators:References (excluding textbook and lecture slides):Regardless of the collaboration method allowed, you must always properly acknowledge the sources youused and people you worked with. Your professor reserves the right to give you an exam (oral, written,or both) to determine the degree that you participated in the making of the deliverable, and how wellyou understand what was submitted. For example, you may be asked to explain any solution that wassubmitted and why you choose to write it that way. This may impact the mark that you receive for thedeliverable.So, whenever you submit a deliverable, especially if you collaborate, you should be prepared for anindividual inspection/walkthrough in which you explain what every line of assignment does and why youchoose to write it that way.1/* CMPUT 201 Assignment #1 *//* Due: 11:55pm, September 29, 2019; */The following is from a sample input file named “sequences.txt” (also posted in eClass and PublicWebpage under Week 1):311028302531829281831814313112301728031631251841324This file contains two sequences over the numerical digit alphabet Σ = {0, 1, 2, . . . , 9}, of length 25 and26 respectively. Let us use an array to represent such a sequence, and further use S1[25] and S2[26] todenote the above two sequences.Given the sequence S1[25], one may delete any number of members from S1[25] (and then conca-tenate the remaining members in the original order) to achieve a subsequence of S1[25]; for example,T [10] =“3108025843” is a subsequence of S1[25]. One sees that T [10] is also a subsequence of S2[26], andin such a case T [10] is called a common subsequence of S1[25] and S2[26]. Our goal is to compute a longestcommon subsequence (LCS for short) for any two input sequences (over Σ = {0, 1, 2, . . . , 9}, for now).The following list contains the specifications for Assignment #1 (10 marks in total):1. Write a single-file C program with multiple functionalities (i.e. objectives). Suppose your executablename (after compilation) is “myprogram”:>myprogramRunning your program through command-line as in the above will read in the two input sequencesfrom the stdin (that is, the terminal, and the two sequences are separated by the return key), byproviding an interface as follows (functionality 1):To compute an LCS,enter the first sequence:enter the second sequence:and then proceed to compute an LCS.2. Your program needs to do a sequence check, that is, if there is any non-digit character, then printsan error and re-provides the interface, as follows (functionality 2):Error, non-digit character detected!To compute an LCS,enter the first sequence:enter the second sequence:3. After successfully reading in the two input sequences, your program prints out the two input sequencesto the stdout (that is, the screen), as follows (functionality 3):# Two input sequences (length = 25, 26) are:3110283025318292818318143131123017280316312518413244. After an LCS has been computed (functionality 4, for which there will be a lecture to explain howto compute an LCS), your program prints it out to the stdout as well (functionality 5, the following311230128131814 is indeed an LCS).# an LCS (length = 15) is:311230128131814//End of description of Assignment #1.2

LATEST POSTS
MOST POPULAR

ezAce多年来为广大留学生提供定制写作、留学文书定制、语法润色以及网课代修等服务,超过200位指导老师为您提供24小时不间断地服务。