Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please take time to answer the questions correctly and accurately. And show clear workings and proper steps. Whenever you are designing an algorithm you must

Please take time to answer the questions correctly and accurately. And show clear workings and proper steps.
image text in transcribed
Whenever you are designing an algorithm you must address the three questions we are typically posing (correctness, complexity and improvement potential). The faster your algorithm, the better your mark. Assignment 1 Question 1: Consider the following algorithm // L is a list and n is its length// // For the purpose of this assignment we assume that n= 4**k, for k21// Alg1 (L,n) remove the smallest and largest element from L fn-2> (4"k)/2 call Alg1 (L, n-2) a) What is the algorithm intended to do? b) Is it correct? If it is not correct discover the error(s) when trying to prove c) d) correctness and fix it (them). Then, reprove the correctness. What is its time complexity? Can it be improved? You may use any algorithm discussed in class

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

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions