23.11.2014 Views

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

add(i,e)<br />

O(n) time<br />

remove(i)<br />

remove(i)<br />

A is O(1), L is O(m<strong>in</strong>{i, n − i})<br />

addFirst(e)<br />

add(0,e)<br />

A is O(n),L is O(1)<br />

addFirst(e)<br />

addFirst(e)<br />

only exists <strong>in</strong> L, O(1)<br />

addLast(e)<br />

add(e)<br />

O(1) time<br />

addLast(e)<br />

addLast(e)<br />

only exists <strong>in</strong> L, O(1)<br />

addAfter(p, e)<br />

add(e)<br />

<strong>in</strong>sertion is at cursor; A is O(n), L is O(1)<br />

addBefore(p,e)<br />

add(e)<br />

<strong>in</strong>sertion is at cursor; A is O(n),L is O(1)<br />

remove(p)<br />

remove()<br />

350

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!