Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-228: Linked List in General #229

Merged
merged 3 commits into from
Mar 16, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
update
  • Loading branch information
rain1024 committed Mar 16, 2023
commit c7bcd9d8391a895357ddf9d2073afe13fca48201
35 changes: 35 additions & 0 deletions concepts/general/linked-list/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Linked List

From wikipedia

> In computer science, a linked list is a linear collection of data elements whose order is not given by their physical placement in memory. Instead, each element points to the next. It is a data structure consisting of a collection of nodes which together represent a sequence.

## Time Complexity Analysis of Linked List

INSERTION

| Operation | Singly Linked List | Double Linked List |
|-----------------|---------------------|---------------------|
| Insert head | $O(1)$ | $O(1)$ |
| Insert middle | $O(n)$ | $O(n)$ |
| Insert tail | $O(n)$ | $O(1)$ |

DELETION

| Operation | Singly Linked List | Double Linked List |
|-----------------|---------------------|---------------------|
| Delete head | $O(1)$ | $O(1)$ |
| Delete middle | $O(n)$ | $O(n)$ |
| Delete tail | $O(n)$ | $O(1)$ |

SEARCHING

| Singly Linked List | Double Linked List |
|---------------------|---------------------|
| $O(n)$ | $O(n)$ |

## 🔗 Further Reading

* [Linked Lists in Python](https://realpython.com/linked-lists-python/), realpython.com
* ▶️ [Linked Lists Introduction](https://www.youtube.com/watch?v=-Yn5DU0_-lw&t=7s&ab_channel=WilliamFiset), WilliamFiset, 2017
* ▶️ [CS50 2018 - Lecture 4 - Linked Lists](https://www.youtube.com/watch?v=wh4TS7RJDTA), CS50, 2018