Arrays Flashcards
1
Q
space \_\_\_ lookup \_\_\_ append \_\_\_ insert \_\_\_ delete \_\_\_
A
space O(n) lookup O(1) append O(1) insert O(n) delete O(n)
2
Q
Two strengths of an array
A
- Fast lookups
2. Fast appends
3
Q
Two weaknesses of an array
A
- Fixed-size
2. Costly inserts and deletes
4
Q
Function in Java to slice an array
A
Arrays.copyOfRang( arr, startIndex, endIndex)
where endIndex is exclusive
5
Q
Arrays are passed by ____.
A
Reference