8000 Merge pull request #8 from varunu28/master · Gekk0r/Algorithms-Explanation@3ca01bc · GitHub
[go: up one dir, main page]

Skip to content

Commit 3ca01bc

Browse files
Merge pull request TheAlgorithms#8 from varunu28/master
Added Linked List.md
2 parents c8a73ab + 0467c32 commit 3ca01bc

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Singly Linked List
2+
3+
#### Description
4+
5+
A linear & connected data structure
6+
7+
#### How is it different from a typical array?
8+
9+
- Size of a linked list is not fixed
10+
- Deleting and adding an element in the middle is not expensive compared to an array
11+
- Elements can be accessed sequentially not dynamically compared to an array
12+
- Extra memory allocation needs to be done for pointers which connects elements in a linked list
13+
14+
15+
#### Example
16+
17+
```
18+
class LinkedList
19+
{
20+
Node head;
21+
22+
class Node
23+
{
24+
int data;
25+
Node next;
26+
Node(int d) {data = d;}
27+
}
28+
}
29+
30+
Here every node has a value and a pointer to the next node. The head node signifies the first element in
31+
the list
32+
```
33+
34+
#### Code Implementation Links
35+
36+
- [Java](https://github.com/TheAlgorithms/Java/blob/master/data_structures/Lists/SinglyLinkedList.java)
37+
- [C++](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/Linked%20List.cpp)
38+
- [Python](https://github.com/TheAlgorithms/Python/blob/master/data_structures/LinkedList/singly_LinkedList.py)
39+
40+
#### Video Explanation
41+
42+
[A CS50 video explaining the Linked List Data Structure](https://www.youtube.com/watch?v=5nsKtQuT6E8)

0 commit comments

Comments
 (0)
0