Skip to content

Instantly share code, notes, and snippets.

@dineshkk
dineshkk / gist:ffe34599c45a1282768c04ad0ae085a9
Created March 30, 2019 17:30 — forked from psayre23/gist:c30a821239f4818b0709
Runtime Complexity of Java Collections
Below are the Big O performance of common functions of different Java Collections.
List | Add | Remove | Get | Contains | Next | Data Structure
---------------------|------|--------|------|----------|------|---------------
ArrayList | O(1) | O(n) | O(1) | O(n) | O(1) | Array
LinkedList | O(1) | O(1) | O(n) | O(n) | O(1) | Linked List
CopyOnWriteArrayList | O(n) | O(n) | O(1) | O(n) | O(1) | Array
@dineshkk
dineshkk / gist:74b06282e2abb4aaf4e663c65fffe53e
Created August 1, 2016 16:26 — forked from debasishg/gist:8172796
A collection of links for streaming algorithms and data structures
  1. General Background and Overview

Tech Interview Prep

@ Hacker Dojo 7/9/2016

Algorithms

Ordered Statistic Trees

  • Problem: Given a stream of integers, you should be able to provide the median at any given time..
    • Ex. input: [2, 8, 5, 3, 4, 2, .. ]
      • Output (medians at i): [2, 2, 5, 3, 4, 3, 3]
  • Assumption: if you have an even number of values, the lower value is the median