Čas:29.11.2010 15:15:18
Předmět:ArrayList.remove complexity
@Matej Tymes: Complexity for the ArrayList.remove method is not O(n) for a typical implemetation based on memory moving via System.arraycopy. See Sun's JDK sources for example. Asymptotically, such implemetation can be considered constant time. But no doubt that's an expensive operation anyway compared to a simple index shift. If fast random access is needed, replacing the linked list by an array (perhaps an ArrayList will do) can probably help while keeping the pros of your solution.
Diskuzní příspěvky
kulik ArrayList.remove complexity