48024 Lecture Notes - Lecture 6: Linked List, Dynamic Array

52 views1 pages
5 Jun 2018
School
Department
Course
Professor
Study 6: Lists
Like an array except lists can also add and remove elements, letting the size change
overtime unlike an array.
Need to import.
Array List
Stores elements as an array, allocating more space than needed to allow you to add
more elements. When you reach the max, it creates a new array 5 times the size and
copies the previous contents into the new larger array.
To insert an element, elements are shifted to the right to add the new element in
the desired location.
An array list is as fast as an array and provides access to any element instantly.
Adding elements to the beginning can be slow and time consuming.
Linked List
Elements are stored in objects that are linked together through pointers. Thus it is
easy to change and insert an element.
Slow to access random elements.
Fast for inserting and removing items.
find more resources at oneclass.com
find more resources at oneclass.com
Unlock document

This preview shows half of the first page of the document.
Unlock all 1 pages and 3 million more documents.

Already have an account? Log in

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents