# CS_282_Module_09_Lab_Algorithm_Analysis.pdf - CS-282:...

• 4
• 100% (1) 1 out of 1 people found this document helpful

This preview shows page 1 - 2 out of 4 pages.

CS-282: Intermediate Java ProgrammingModule 9 Lab: Algorithm AnalysisProfessor Thomas VolkmanItems 3-8 require that you perform algorithm analysis.To receive credit in this lab, please attempt to answer each ofthese items in the cell following the item.Please respond withREDtext for your answers, so it is much easier for meto focus on your answers.1Algorithm Analysis ExampleUsing Big Oh notation, indicate the time requirement of each of the following tasks in the worst case.Describe anyassumptions that you make.[Try to determine this before looking at the solutions]a.After arriving at a party, you shake hands with each person there.O(n), wherenis the number of people at the party under the assumptions that there is a fixed maximum time betweenhand shakes, and there is a fixed maximum time for a handshake.b.Each person in a room shakes hands with everyone else in the roomO(n2), wherenis the number of people at the party under the assumptions that there is a fixed maximum time betweenhand shakes, and there is a fixed maximum time for a handshake.c.You climb a flight of stairsO(n), wherenis the number of steps under the assumptions that you never take a backward step, and there is a fixedmaximum time between steps.d.You slide down the banisterO(h), wherehis the height of the banister under the assumptions that you never slow down and you reach a limitingspeed.e.After entering an elevator, you press a button to choose a floorO(1), under the assumption that you reach a decision and press the button within a fixed amount of time.

Course Hero member to access this document

Course Hero member to access this document

End of preview. Want to read all 4 pages?