Stacks and Queues.pdf - Which List implementation is faster for removeFront Implementer’s Design Decision Hierarchy Abstract Data Type List Which ADT

Stacks and Queues.pdf - Which List implementation is faster...

This preview shows page 1 - 3 out of 8 pages.

5Implementer’s ++0Design ++0Decision /4Hierarchy 3 243ist )('IbstrHaJct ,+*,HatHa :<;ype Which ADT is the best fit? ,+*,HatHa 9;:truJcture Which data structure offers the best performance for our input/workload? 0/10mplementHation ,+*,etHails How do we maintain invariants? 8:9esizHaIble )('rrHay 243inkeKd 465oKdes data is an array of items, never null. The i-th item in the list is always stored in data[i]. . % % .3--ow do we determine whether one dGatGa struIcture is fGaster thGan Ganother%%* **/))oes it depend on the implementGation detGails%%* . % % .3--ow do invGariGants relGate to dGatGa struIctures%%* Which List implementation is faster for remove-2Front&&+ 4
Image of page 1
)).Big°O Runtime ((-Analysis ;hat does it mean for a data structure to be slow or fast# *)(ig°576 runtime HanHalysis : count how many steps a program takes to execute an input of size N. Suppose our list has N items. A method that takes a JconstHant number of steps (e.g. 23) is in 576±²³ . A method that takes a lineHar number of steps (e.g. 4N + 3) is in 576±465³ . 5 465umIberofsteps±runtime³ 9;:ize of input ±465³ 576±465³ 576±²³ . % % .3--ow does HTVSUXZY[FSUY[ or QSNPSUJLFWY relGate to GanGalyzing runtime “with respeIct to Hbig inputs”%%* . % % <<=hGat Gare the Hbig°445 runtimes for '',&rrGay7112ist Gand 7112inked7112ist remove,1++ront%%* . % % )).(Gan we sGay thGat Gan '',&**/))99: is slower or fGaster thGan Ganother '',&**/))99:%%* ((-ArrayList vs± LinkedList 1. Which List implementation should we use to store a list of songs in a playlist? 2. Which List implementation should we use to store the history of a bank customer’s transactions? 3. Which List implementation should we use to store the order of students waiting to speak to a TA at a tutoring center? 6 798 99:ime needed to GaIcIcess the i°th item from Ga list of 9334 items± ° '',&rrGay7112ist% % 445²³´ ° 7112inked7112ist% % 445²9334´ 99:ime needed to insert Gan item Gat position i in Ga list of 9334 items± ° '',&rrGay7112ist% % 445²9334´ ° 7112inked7112ist% % 445²9334´ . % % <<=hy Gare these runtimes whGat they Gare%%* 4% % % <<=hiIch 7112ist implementGation should we use to store Ga list of songs in Ga plGaylist%%* 4& % % <<=hiIch 7112ist implementGation should we use to store the history of Ga HbGank
Image of page 2
Image of page 3

You've reached the end of your free preview.

Want to read all 8 pages?

  • Spring '14

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors