Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part A: 1) Implement both the Brute Force and Improved versions of the MCS algorithms. 2) Check the correctness of the algorithms for the following

image text in transcribed
Part A: 1) Implement both the Brute Force and Improved versions of the MCS algorithms. 2) Check the correctness of the algorithms for the following sequences: a. -1, -2, -3.-4.-5.-6 MCS: See notes b. -1, 1,-1, 1,-1,1 MCS: See notes c. -1,2,3,-3,2 MCS: See notes d. 1.-5.2.-1.3 MCS: 2,-1,3 e. -2,2-2,-2, 3,2 MCS: 3.2 3) Modify both algorithms to record the number of iterations used. Test your modified algorithms on the above examples. 4) Generate 10 random sequences of length 5, 10, 15, ..., 50 each (100 sequences in totals). Record the number of iterations for each sequence. Plot the results (x-length - n, y-iterations) to compare the algorithm's time complexity. Also compare the Brute Force algorithm's iterations with n(n+12 and the improved algorithm's iterations with n. (Produce 3 plots: Brute vs. Improved, Brute vs, n(n+1 72 and Improved vs. n). Part A: 1) Implement both the Brute Force and Improved versions of the MCS algorithms. 2) Check the correctness of the algorithms for the following sequences: a. -1, -2, -3.-4.-5.-6 MCS: See notes b. -1, 1,-1, 1,-1,1 MCS: See notes c. -1,2,3,-3,2 MCS: See notes d. 1.-5.2.-1.3 MCS: 2,-1,3 e. -2,2-2,-2, 3,2 MCS: 3.2 3) Modify both algorithms to record the number of iterations used. Test your modified algorithms on the above examples. 4) Generate 10 random sequences of length 5, 10, 15, ..., 50 each (100 sequences in totals). Record the number of iterations for each sequence. Plot the results (x-length - n, y-iterations) to compare the algorithm's time complexity. Also compare the Brute Force algorithm's iterations with n(n+12 and the improved algorithm's iterations with n. (Produce 3 plots: Brute vs. Improved, Brute vs, n(n+1 72 and Improved vs. n)

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

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

Recommended Textbook for

AutoCAD Database Connectivity

Authors: Scott McFarlane

1st Edition

0766816400, 978-0766816404

More Books

Students also viewed these Databases questions