Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 2 (30 points) Write a MIPS function (called mips_palindrome) that returns 1 if the input string is a MIPS palindrome and returns 0 otherwise;

Problem 2 (30 points) Write a MIPS function (called mips_palindrome) that returns 1 if the input string is a MIPS palindrome and returns 0 otherwise; your program should be named as mips_palindrome.s. The address of the string will be passed in using register $a0 and the resulting value should be returned in $v0. Here a string is a MIPS palindrome if it reads the same in forward or backward direction (including white spaces, punctuation marks, and so on) except that M, I, P, and S match any character. For example, NOLE-MIPS is a MIPS palindrome, but Nole-EloN is not (because e and E are not the same). Note the string is ended with \0 (C/C++ convention). You need to test your program using test_mips_palindrome.s (http://www.cs.fsu.edu/~liux/courses/cda3100/assignments/test_mips_palindrome.s) and include the results (shown on the console) in the pdf file to be submitted.

Hints and note: The definition of a palindrome is customized; this is intentional to avoid reusing similar programs. One solution is to find the position of the last character in the input string, and write a loop to compare the character at the beginning and the last character of the string and change the pointers accordingly if the characters match. Figure out the condition to end the loop (you need to consider the cases of both even and odd numbers of characters in the strings).

If prompted when following link: username: cda3100 password: cda3100-fsu

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

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

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions