CS 17700 Study Guide - Final Guide: Binary Search Algorithm, Bubble Sort, Merge Sort

59 views4 pages

Document Summary

Q1 se1 consider a large sorted list of n numbers. Q2 consider the following search function: def mysearch(something,alist): for item in alist: if item == something: return "found it!" elif item > something: return "not found" Q3 s2 which is the number of swapping operations needed to sort a list of numbers: [8, 22, 7, 9 ] in ascending order using bubble sort: * 3, 5, 4, 16. Q4 s2 which is the complexity of bubble sort and the complexity merge sort, respectively: o(n) and o(log n, o(n2) and o(log n, * o(n2) and o(n log n, o(log n) and o(n) Q5 consider the following functions that calculate ax. You can assume that both a and x are positive. Which of the function code above is the correct one: * i, ii and iii, i and iv, ii and iv. Q8 what is the output of the following code? def matfun():

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers

Related Documents

Related Questions