java:

Lists in Java

List interface: The List interface specifies two remove methods: List<Integer> list = new List<>(); // Remove the element at index 4 remove(int index): list.remove(4); // Remove the first occurrence of the object 4 remove(Object o): list.remove(new Integer(4)); Linked List: Pros Cons Can insert or remove anywhere in the list without shifting elements Not sortable Insert: O(1) Elements are not stored in contiguous memory addresses Remove: O(1) Find: O(n), as must traverse to find an element

by lek tin in "java" access_time 1-min read