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

Linked list shift #168

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
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
Prev Previous commit
deploy
  • Loading branch information
name committed Nov 22, 2022
commit f5f9fde537930679cb321f3d041ad6c1ce46281f
21 changes: 21 additions & 0 deletions linked list/shift.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Shift

What we will do first is remove the first element of the Linked List.

```js
class Node {
constructor(data) {
this.data = data
this.next = null
}
}

class LinkedList {
constructor(head) {
this.head = head
}

shift = () => {
this.head = this.head.next
}
}