Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c992ea8

Browse files
author
Swastikyadav
committed
Add code reuse
1 parent 667d8c4 commit c992ea8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

‎18-linkedList.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class LinkedList {
2525
// Insert first (Assign the resulting node to the head)
2626
insertFirst(data) {
2727
this.head = new Node(data, this.head);
28+
// this.insertAt(data, 0);
2829
}
2930

3031
// Size method - Return the number of nodes in the linked list.
@@ -43,6 +44,7 @@ class LinkedList {
4344
// GetFirst - Returns the first node (the head) in the linked list.
4445
getFirst() {
4546
return this.head;
47+
// return this.getAt(0);
4648
}
4749

4850
// GetLast - Return the last node (the tail) in the linked list.
@@ -58,6 +60,8 @@ class LinkedList {
5860
}
5961

6062
return listNode;
63+
64+
// return this.getAt(this.size() - 1);
6165
}
6266

6367
// Clear - Clears all the node, size becomes 0.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /