CSE116 Midterm Review

CSE116 Midterm Review - Array Lists: A collection of...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Array Lists: A collection of variables, all of the same type Each variable in an array is accessed by an index An array occupies a contiguous block of memory Inserting something into this list sometimes involves allocation of a large block of memory Inserting an item into this list sometimes involves copying of data from one block of memory to another Memory for storage is allocated for more than one element at a time The size of an array is fixed, specified at creation Finding an item by its index requires constant time Linked Lists: All insertation operations take the same amount of time If the elements of the list must be kept in order, insertation of an item into this list is faster If the elements of the list must be kept in order, removal of an item from that list is faster [ does not work that if not in order, ArrayList would be faster ] Advantages of an ArrayList - Fast access to a specific index - Typically less space usages than other options Disadvantages of an ArrayList - Can be expensive to insert items - Resizing is an expensive operation Advantage of a Linked List
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

CSE116 Midterm Review - Array Lists: A collection of...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online