Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The purpose of this assignment is to practice your analysis of algorithm complexity. In the second part of this assignment you will be asked to

The purpose of this assignment is to practice your analysis of algorithm complexity. In the second part of this assignment you will be asked to empirically test the performance of four different data structures for storing and searching. For each of the algorithms below:

1. State the size of the input in big-Oh. For example, if the input to an algorithm is an array of size k, then the input size is O(k). (1 mark)

2. Derive the cost function for the algorithm. Be sure to show your work like we do in lectures. You can use O(1) to denote all constants. (2 marks)

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed 3. State the complexity of the algorithm in Big-Oh. The complexity MUST be stated in terms of input-size. (2 marks)

Example: Multiplication input: A[k] // A vector (10 array) of size k B[k] // A vector (10 array) of size k output: AB // A matrix of kxk in size R = array[k] [k] // new array of size k x k [O(1)] for j = 0 ...k for i = 0 ...k R[i][j] = A[j] * B[i] [k] [k] x [k] [k] x [k] x [0(1)] return R O(1) +k+k xk+k x k x 0(1) + O(1) = 0(1) + [0(1)] (k) = O(k) (k) + Solution 1. The inpput size is O(k) + (k) Ok) 2. f(k) = 0(1)+k x 0(1) + kx 0(1) 3. f(k) O(k) Problem: Last Resort? input: A[k] // 1D array of size k, k is a power of 2 output: sorted array A B = array(k) size = 1 while size

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

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

0805302441, 978-0805302448

More Books

Students also viewed these Databases questions

Question

What is the economic meaning of duration? ( LG 3-8 )

Answered: 1 week ago

Question

What do these students reactions tell you about childrens thinking?

Answered: 1 week ago