1 / 6

CS-2852 Data Structures

CS-2852 Data Structures. Week 4, Class 1 - Review Review ! Thursday Exam I - Review Implementing ArrayList Big-O Iterators – High-level description Linked Lists – comparison with ArrayLists. Review of 1011 and 1021. Write a loop for a given repetitive task

kelton
Download Presentation

CS-2852 Data Structures

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS-2852Data Structures • Week 4, Class 1 - Review • Review! • Thursday • Exam I - Review • Implementing ArrayList • Big-O • Iterators – High-level description • Linked Lists – comparison with ArrayLists CS-2852 Dr. Josiah Yoder Slide style: Dr. Hornick

  2. Review of 1011 and 1021 • Write a loop for a given repetitive task • Explain the difference between a class and an interface • Describe key differences between an array and an ArrayList<E> object • Implement classes and methods that make use of generics • Write code that uses an ArrayList<E> or two • Use references to interfaces instead of concrete classes wherever possible CS-2852 Dr. Josiah Yoder Slide style: Dr. Hornick

  3. Interfaces • Use the Collection<E> and List<E> interfaces defined in the Java Collection Framework • Explain when to use Collection<E> instead of List<E> and vice versa • Demonstrate correct use of generics when declaring Collection<E> and List<E> interfaces • Describe the implications of an interface extending another interface • List two classes that implement the List<E> interface CS-2852 Dr. Josiah Yoder Slide style: Dr. Hornick

  4. Implementing ArrayLists • Write the method headers for the key methods of an ArrayList • Don’t need to match Java API perfectly • Just include arguments needed to perform the job • Implement the key methods of ArrayListt • add(E) • add(int, E) • clear() • contains(Object) • equals(Object) • get(int) • indexOf(Object) • isEmpty() • remove(int) • remove(Object) • set(int, E) • size() • subList(int, int) • toArray() CS-2852 Dr. Josiah Yoder Slide style: Dr. Hornick

  5. Linked Lists – comparison with ArrayLists • Methods offered • Determine order given a single add() method • Describe key differences between our implementation of theLinkedList<E>class and Java’s. CS-2852 Dr. Josiah Yoder Slide style: Dr. Hornick

  6. Time Complexity • Determine the asymptotic time complexity for a method from our simple ArrayList class. • Identify key loops that make ArrayLists or LinkedLists faster for a given problem, provided the method for the LinkedList class. • Determine the asymptotic time complexity for a given method from the source code • Determine the simplified O(f(n)) for a T(n) polyomial CS-2852 Dr. Josiah Yoder Slide style: Dr. Hornick

More Related