COMPSCI 61B Lecture Notes - Lecture 16: Linked List, Binary Tree, Java Syntax
Document Summary
Modified alist and sllist to implement list61b. Modified ad and lld to implement deque. With disjointsets, we saw a much richer set of possible implementations. An abstract data type (adt) is defined only by its operations, not by its implementations. Push(int x): puts x on top of the stop. Int pop(): removes and returns the top item from the stack. No resized in for linked lists, so probably a little faster. Insert(int x): inserts x into the grab bag. Int remove(): removes a random item from the bag. Int sample(): samples a random item from the bag(without removing) Int size(): number of items in the bag. Syntax differentiation between abstract data types and implementations. Interfaces in java aren"t purely abstract as they can contain some implementation details (default methods) Among the most important interfaces in the library are those that extend the collection interface (interfaces can extend other interfaces)