Algorithm Complexity

Arrays Set, Check element at a particular index: O(1) Searching: O(n) if array is unsorted and O(log n) if array is sorted and something like a binary search is used, Similarly, Insert for arrays is basically Set as mentioned in the beginning ArrayList: Add: Amortized O(1) Remove: O(n) Contains: O(n) Size: O(1) Linked List:… Continue Reading