1. Homepage
  2. Programming
  3. CS575 Design and Analysis of Algorithms Fall 2023 Programming Assignment 3: Longest common subsequence

CS575 Design and Analysis of Algorithms Fall 2023 Programming Assignment 3: Longest common subsequence

Engage in a Conversation
Binghamton UniversityCS575Design and Analysis of AlgorithmsLongest common subsequenceC++Java

CS575 Design and Analysis of Algorithms Fall 2023
Programming Assignment 3 CourseNana.COM

Assigned: October 28, 2023
Due: Midnight Friday, November 10, 2023 CourseNana.COM

  1. [45%] Implement the longest common subsequence (LCS) algorithm using the dynamic programming method that was discussed in class. (No credit will be given if you implement a brute force algorithm, which does exhaustive comparisons between two input strings, or any other algorithm unless you prove your algorithm is correct and more efficient than the LCS algorithm described in Chapter 7.) Save your source code in a file and name the file as lcs.cpp or lcs.java. CourseNana.COM

    Make sure that your program can take any two input strings in the Linux command line and print the LCS found between the two input strings. (Assume that a string consists of at most 100 alphabetic characters.) For example, if we type “lcs abc afgbhcd” in the command line to find the LCS between string “abc” and string “afgbhcd”. Again, your program should work for arbitrary two input strings. No credit will be given, if your program only works for some specific strings, but fails to find the LCS for other strings. CourseNana.COM

    Program Usage CourseNana.COM

    Your program should be invoked as follows. CourseNana.COM

       $> ./lcs <input-string1> <input-string2>
    

    A sample run of your program appears below. $> ./lcs ABCDEfghi AcbDedghaq CourseNana.COM

    A sample output is as follows (standard output in the terminal) Length of LCS: 4
    LCS: ADgh
    CourseNana.COM

  2. [45%] Write a program floyd.cpp or floyd.java to find all pairs shortest paths using Floyd’s algorithm for several undirected complete graphs, which are saved in a file called output.txt. Print all pairs shortest paths and their lengths. CourseNana.COM

    Program Usage CourseNana.COM

    Your program should be invoked as follows CourseNana.COM

       $> floyd <graph-file>
    

Graph File: <graph-file> is the name of a file that includes more than one problem. The lines that correspond to problem j will contains an integer n (between 5 and 10) that indicates how many cities and n x n adjacency matrix A (that is, the distance between n cities, between 1 to 10), in the next n rows. Note that no infinity will appear in the matrix A. CourseNana.COM

A sample graph file appears below. Problem 1: n = 7
0654636
6064553
CourseNana.COM

5603146 4430414 6514055 3541503 6364530 CourseNana.COM

Problem 2: n = 6 012134 103223 230336 123035 323305 436550 CourseNana.COM

Output File CourseNana.COM

Output the solution of problem 1 first, then problem 2, and etc. The solution of problem j should start with an integer n (the number cities) and the n x n Pointer Array P (in the next n rows). The shortest paths should then follow, one per line. Output the shortest paths from C1 to all other cities, then C2 to all other cities, and Cn to all other cities. CourseNana.COM

A sample output file: Problem 1: n = 7
P matrix: 0006306 0050040 0500005 6000306 3003030 0400300 6056000
CourseNana.COM

V1-Vj: shortest path and length V1 V1: 0
V1 V2: 6
V1 V3: 5
CourseNana.COM

V1 V6 V4: 4 V1 V3 V5: 6 CourseNana.COM

V1 V6: 3 V1 V6 V7: 6 CourseNana.COM

V2-Vj: shortest path and length V2 V1: 6
V2 V2: 0
V2 V5 V3: 6
CourseNana.COM

V2 V4: 4 V2 V5: 5 V2 V4 V6: 5 V2 V7: 3 CourseNana.COM

V3-Vj: shortest path and length V3 V1: 5
V3 V5 V2: 6
V3 V3: 0
CourseNana.COM

V3 V4: 3 V3 V5: 1 V3 V6: 4 V3 V5 V7: 6 CourseNana.COM

V4-Vj: shortest path and length V4 V6 V1: 4
V4 V2: 4
V4 V3: 3
CourseNana.COM

V4 V4: 0 V4 V3 V5: 4 V4 V6: 1 V4 V6 V7: 4 CourseNana.COM

V5-Vj: shortest path and length V5 V3 V1: 6
V5 V2: 5
V5 V3: 1
CourseNana.COM

V5 V3 V4: 4 V5 V5: 0 V5 V3 V6: 5 V5 V7: 5 CourseNana.COM

V6-Vj: shortest path and length V6 V1: 3
V6 V4 V2: 5
V6 V3: 4
CourseNana.COM

V6 V4: 1 V6 V3 V5: 5 V6 V6: 0 CourseNana.COM

V6 V7: 3 CourseNana.COM

V7-Vj: shortest path and length V7 V6 V1: 6
V7 V2: 3
V7 V5 V3: 6
CourseNana.COM

V7 V6 V4: 4 V7 V5: 5 V7 V6: 3 V7 V7: 0 CourseNana.COM

Problem 2: n = 6 P matrix: 000022 001100 010102 011002 200002 202220 CourseNana.COM

V1-Vj: shortest path and length V1 V1: 0
V1 V2: 1
V1 V3: 2
CourseNana.COM

V1 V4: 1 V1 V2 V5: 3 V1 V2 V6: 4 CourseNana.COM

V2-Vj: shortest path and length V2 V1: 1
V2 V2: 0
V2 V1 V3: 3
CourseNana.COM

V2 V1 V4: 2 V2 V5: 2 V2 V6: 3 CourseNana.COM

V3-Vj: shortest path and length V3 V1: 2
V3 V1 V2: 3
V3 V3: 0
CourseNana.COM

V3 V1 V4: 3 V3 V5: 3
V3 V1 V2 V6: 6
CourseNana.COM

V4-Vj: shortest path and length V4 V1: 1 CourseNana.COM

V4 V1 V2: 2 V4 V1 V3: 3 V4 V4: 0
V4 V5: 3
V4 V1 V2 V6: 5
CourseNana.COM

V5-Vj: shortest path and length V5 V2 V1: 3
V5 V2: 2
V5 V3: 3
CourseNana.COM

V5 V4: 3 V5 V5: 0 V5 V2 V6: 5 CourseNana.COM

V6-Vj: shortest path and length V6 V2 V1: 4
V6 V2: 3
V6 V2 V1 V3: 6
CourseNana.COM

V6 V2 V1 V4: 5 V6 V2 V5: 5 V6 V6: 0 CourseNana.COM

3. [10%] 10% of the grade will be based on good coding style and meaningful comments. CourseNana.COM

All programming must be done using C or C++ or java in Linux (remote.cs.binghamton.edu) where your code will be tested. Create a tar file that includes (1) source code files, (2) a Makefile to produce an executable, and (3) a readme file that clearly describes how to run your code. Submit only the tar file through the Blackboard. The name of the tar file should be yourlastname_yourfirstname _proj3.tar (Do not use special characters like #, @, or &, because they have caused Blackboard problems in the past.) Suppose that your assignment files are under the directory of /your_userid/yourlastname_yourfirstname_proj3/ and you are under that directory right now. To create a tar file under /your_userid directory, do the following in Linux command line: CourseNana.COM

>cd ..
>tar cvf yourlastname
_yourfirstname_proj3.tar yourlastname_yourfirstname_proj3 CourseNana.COM

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
Binghamton University代写,CS575代写,Design and Analysis of Algorithms代写,Longest common subsequence代写,C++代写,Java代写,Binghamton University代编,CS575代编,Design and Analysis of Algorithms代编,Longest common subsequence代编,C++代编,Java代编,Binghamton University代考,CS575代考,Design and Analysis of Algorithms代考,Longest common subsequence代考,C++代考,Java代考,Binghamton Universityhelp,CS575help,Design and Analysis of Algorithmshelp,Longest common subsequencehelp,C++help,Javahelp,Binghamton University作业代写,CS575作业代写,Design and Analysis of Algorithms作业代写,Longest common subsequence作业代写,C++作业代写,Java作业代写,Binghamton University编程代写,CS575编程代写,Design and Analysis of Algorithms编程代写,Longest common subsequence编程代写,C++编程代写,Java编程代写,Binghamton Universityprogramming help,CS575programming help,Design and Analysis of Algorithmsprogramming help,Longest common subsequenceprogramming help,C++programming help,Javaprogramming help,Binghamton Universityassignment help,CS575assignment help,Design and Analysis of Algorithmsassignment help,Longest common subsequenceassignment help,C++assignment help,Javaassignment help,Binghamton Universitysolution,CS575solution,Design and Analysis of Algorithmssolution,Longest common subsequencesolution,C++solution,Javasolution,