{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Algorithms

# Algorithms - CS161 Homework 1 Due Thursday July 2 5:00pm...

This preview shows pages 1–2. Sign up to view the full content.

CS161 - Homework 1 Due: Thursday July 2, 5:00pm 1. (5 points) What sorting method does the function sort use from java.util.Arrays? Make sure to cite your source. Why do you think this is the case? 2. (10 points) The table below contains run times for 6 different algo- rithms. The input sizes ranged from 1000 to 32000 seen at the top of the table. For each of the algorithms, give the θ complexity of the algorithms based on the running times and include a brief explaination for your answer. Algorithm 1000 2000 4000 8000 16000 32000 A 1 50 378 3,345 26,300 215,680 1,658,002 A 2 99 110 105 976 103 100 A 3 60 130 237 501 954 1999 A 4 1005 1095 1201 1289 1420 1540 A 5 5 21 84 311 1304 5280 A 6 10 22 50 108 245 533 3. (10 points) Arrange the functions below in ascending order of growth rate. Specifically, if f ( n ) = O ( g ( n )) then f ( n ) should be before g ( n ) in the list. If two functions are asympotically equal, i.e. f ( n ) = Θ( g ( n )) then note this in the list by including all elements in a set. For exam- ple, given: n, log n , n +4, and n 2 the list would be: log n, ( n, n +4) , n 2 .

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}