Different data structures offer different advantages and disadvantages. Some offer quick insertions and deletions but slower fetches, or the reverse, or something in between.
- [Narrator] Pros and cons of using some…of the most popular data structures.…Different data structures offer different advantages…and disadvantages.…Some offer quick insertions and deletions…but slower fetches.…Let's start with the advantages of an ArrayList and vector.…Both of these data structures provide fast access…to the individual elements using indexing.…They also have memory coherence.…The elements are stored sequentially in memory.…The initial size of the data structure is optional.…
You can provide the size if you know that ahead of time.…ArrayList uses an internal array for storage…which makes it particularly fast for random access.…The elements are stored in sequential memory addresses.…But now let's talk a little bit about the disadvantages.…The disadvantage is that adding elements…in an ArrayList or a vector in the middle…can be time consuming.…Can you guess why?…Think about a very large ArrayList.…Maybe it has 100 items.…
If you wanted to insert an item in the 50th position…in the middle, you would have to move…
In this course, explore data structures in the Java language. Follow Peggy Fisher as she introduces you to several types of commonly-used data structures in Java. Peggy explores ArrayLists and LinkedLists, both of which implement the List interface, which extends the Collection interface and allows you to access list elements in a specific order. She also goes into the Vector, Stack, and Queue collection classes. To help you better understand these new concepts, Peggy wraps up the course with a challenge—creating a grocery list—and provides a solution for that challenge.
- Reviewing the types of data structures
- Working with the Collection interface and Iterable interface
- Working with ArrayLists and LinkedLists
- Using the Vector, Stack, and Queue collection classes