Format Painter Words 224 Page 2012 05020717 IC patibility Mo

Format Painter Words: 224 Page 2012 05.020717 IC patibility Mod New Ro CSC 305 Assianmeut Due February 7,2017 Read these directions carefully. Promyouz text 79, Discussion Questi Go through 6 and label chline far determiningthe Big-o problem. Find the Big-oand the valuesofcandD). Go thorough 6 again, d label chhine, but this time, count all Find the Big-o and the You can find Listengs nd onthe Moode aite. Pnnt them out and go through each of these listins to detemine the Big-o lude operatio Find the Bis-o and the From the Ja ext, go throughthe 6piec defor 2. do not o do parte a ther go throughth ndlab chlure for detenminingthe Big-o ch Include the walues for dng- Repe but this timeinchudeth tions and calculatetheBig-o andthe lues forc included py ofthe problerne fioroChapter print cut de andiabelthe lines appropriately. While y bring the detocl ll work forthis assigumentmust be uploaded to Moodle. oft Word 2.6 Discussian Questions Give the Big- performance of the following code fragment: for 1 in range 2. Civ he Big-o pertonuaruce ot the following code fraguent: 3. Give the Big-o pertomaarce ot the following code fragment: while Give the Big performaaoe of the following oode fragment: range(n) in range range 5. Give the Big-o performance of the following code fraguent: while Give the Big O perfonnance of the following code fragment: arge(s) range(n) Editing 0:57 40 04-Feb-

Solution

Ans)

1) O(n2) Since there are two loops within each other.

2) O(n) only a single for loop.

3) O(n) single while loop

i=i/2 but O(n/2)~~O(n)

4) O(n3) Three nested loops.

5) O(n) [same as 3]

6) O(n) Three lkoops but are not nested.

thus, (O(n) + 1) x 3 is the total time complexity.

 Format Painter Words: 224 Page 2012 05.020717 IC patibility Mod New Ro CSC 305 Assianmeut Due February 7,2017 Read these directions carefully. Promyouz text 79

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site