Skip to content

Commit

Permalink
feat(book/linkedlist): add applications
Browse files Browse the repository at this point in the history
  • Loading branch information
amejiarosario committed Oct 30, 2020
1 parent c1cf57a commit 2b96f00
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion book/content/part02/linked-list.asc
Expand Up @@ -9,7 +9,28 @@ endif::[]
[[linked-list]]
=== Linked List

A list (or Linked List) is a linear data structure where each object has a pointer to the next one.
A list (or Linked List) is a linear data structure where each object has a pointer to the next one creating a chain. You can also have a back reference to the previous node.

image::dllx4-compact.png[]

The data doesn't have to be a number. It can be anything that you need (e.g., images, songs, menu items).

.Some features powered by linked lists:
- _Image viewer_ – The previous and next images are linked in an image viewer so that the user can navigate them.
- _Previous and next page in web browser_ – We can access the previous and next URL searched in a web browser by pressing the back and next button since they are linked.
- _Music Player_ - Queue of songs in a music player connects them so you can move to the next song or previous one.
.Other Applications:
- Build <<Stack>> and <<Queue>> data structures, which are useful for Graph Traversal and other things.
- Linked Lists are used on <<hashmap-chap>> to handle collisions.
- Linked Lists can be used when representing a <<graph>> as an adjacency list.
- Operate arbitrary big numbers (think hundreds of digits). Each digit is a node of a linked list.
- Manipulation of polynomials by storing constants in the node of a linked list.
- Representing sparse matrices (an array representation will waste a lot of memory when most of the cells are empty). The linked list will represent only the non-zero values saving significant space.
Hopefully, this will get you excited about learning Linked Lists since it's the base of many interesting applications. Let's learn more about the different types of linked lists.

==== Types of Linked List

.Linked Lists can be:
- *Singly*: every item has a pointer to the next.
Expand Down
Binary file modified book/images/critical-path-examples.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/images/dllx4-compact.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2b96f00

Please sign in to comment.