Assignment3--final.pdf - Assignment#3 Chapter 3 10 points 1...

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

Assignment #3 Chapter 3 10 points 1.Linked lists and arrays: a.What are some advantages of linked lists versus arrays? b.What are some advantages of arrays versus linked lists? Answer: 15 points 2.What is the Big-O running time of the following code fragment? Assume lst1 has N items, and lst2 is initially empty.
lst2.add(0, x); // add to front } a.If an ArrayList is passed for lst1 and lst2. Explain your answer. b.If a LinkedList is passed for lst1 and lst2. Explain your answer. Answer:

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture