Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Submission Guidelines: The due date is Saturday Mar. 9 , 2 0 2 4 Midnight. The assignment can be solved individually or in - group

Submission Guidelines:
The due date is Saturday Mar. 9,2024 Midnight.
The assignment can be solved individually or in-group of two students. Both team members
should be declared in gradescope when submitting the assignment.
The submitted code should include the name(s) and student ID(s) of students who did the
assignment.
The submitted file should be renamed as "assign2_lcs.s"
Submit your assignment through gradescope. Email submissions are not accepted.
Late submission is not acceptable.
Introduction:
Longest Common Sequence (LCS) is the longest subsequence that is common in two given
sequences, provided that the elements of the subsequence are not required to occupy consecutive
positions within the original sequences. LCS is used in compressing genome resequencing data and
to authenticate users within their mobile phone through in-air signatures
Implementation:
Define Function: find_lcs
Inputs:
s1, an address of the first null-terminated string in Register $a0.
S2, an address of the second null-terminated string in Register $a1
Outputs:
,N, the size of the longest common sequence in Register $ vo.
You are asked to write recursive function that find the LCS between two null-terminated strings.
The function receives the address of two strings S1 and S2 as a parameter and return the length
of the longest common sequence as an output. The label of the function should be declared as
global (i.e. can be called from another file). Refer to the C code given below:
int find_lcs(string s1, string s2)
{
if (s1[]==0||s2[]==0),?? return when reach the end of
either strings.
return 0 ;
if s1[]??=s2[] advance both pointers if the first chars are
matching
return 1+lcs(s1[1:n],s2[1:m]);
else
return ;
}
Test function find_Ics():
Write assembly program that test the function you defined in part (1). The code should prompt
the user to enter two strings of maximum of 1024 characters then it calls function find_lcs().
The program should print the output to the user. An example is shown below:
Example 1:
Enter the first string (max 1024 character): AGGTAB
Enter the second string (max 1024 character): GXTXAYB
The length of LCS is 4introduction : Longest Common Sequence (LCS) is the longest subsequence that is common in two given
sequences, provided that the elements of the subsequence are not required to occupy consecutive
positions within the original sequences. LCS is used in compressing genome resequencing data and
to authenticate users within their mobile phone through in-air signatures.
Question : You are asked to write (mips assimbly language) recursive function that find the LCS between two null-terminated strings.
The function receives the address of two strings S1 and S2 as a parameter and return the length of the longest common sequence as an output. The label of the function should be declared as
global (i.e. can be called from another file)
1. Define Function: find_lcs
Inputs:
- s1, an address of the first null-terminated string in Register $a0.
- s2, an address of the second null-terminated string in Register $a1
Outputs:
- N, the size of the longest common sequence in Register$v0.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems For Advanced Applications 18th International Conference Dasfaa 2013 Wuhan China April 22 25 2013 Proceedings Part 2 Lncs 7826

Authors: Weiyi Meng ,Ling Feng ,Stephane Bressan ,Werner Winiwarter ,Wei Song

2013th Edition

3642374492, 978-3642374494

More Books

Students also viewed these Databases questions

Question

Why are there two stages of allocation in activity-based costing?

Answered: 1 week ago