Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defaultEquals } from '../util';
import LinkedList from './linked-list';
import { Node } from './models/linked-list-models';
import { defaultEquals } from "../util";
import LinkedList from "./linked-list";
import { Node } from "./models/linked-list-models";

export default class CircularLinkedList extends LinkedList {
constructor(equalsFn = defaultEquals) {
Expand Down Expand Up @@ -30,7 +30,7 @@ export default class CircularLinkedList extends LinkedList {
node.next = this.head;
} else {
node.next = current;
current = this.getElementAt(this.size());
current = this.getElementAt(this.size() - 1);
// update last element
this.head = node;
current.next = this.head;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defaultEquals, IEqualsFunction } from '../util';
import LinkedList from './linked-list';
import { Node } from './models/linked-list-models';
import { defaultEquals, IEqualsFunction } from "../util";
import LinkedList from "./linked-list";
import { Node } from "./models/linked-list-models";

export default class CircularLinkedList<T> extends LinkedList<T> {
constructor(protected equalsFn: IEqualsFunction<T> = defaultEquals) {
Expand Down Expand Up @@ -36,7 +36,7 @@ export default class CircularLinkedList<T> extends LinkedList<T> {
node.next = this.head;
} else {
node.next = current;
current = this.getElementAt(this.size());
current = this.getElementAt(this.size() - 1);
// update last element
this.head = node;
current.next = this.head;
Expand Down