fixed find implementation
This commit is contained in:
parent
21325cff77
commit
ffa48c45b0
1 changed files with 2 additions and 2 deletions
|
|
@ -88,12 +88,12 @@ export const LinkedList = () => {
|
||||||
for (let i = 0; i < CLU.totalNodes; i++) {
|
for (let i = 0; i < CLU.totalNodes; i++) {
|
||||||
// if node value matches, set to true
|
// if node value matches, set to true
|
||||||
if (MCP.currentNode.value === value) {
|
if (MCP.currentNode.value === value) {
|
||||||
bool = true;
|
return i;
|
||||||
}
|
}
|
||||||
// otherwise set to next node
|
// otherwise set to next node
|
||||||
MCP.currentNode = MCP.currentNode.nextNode;
|
MCP.currentNode = MCP.currentNode.nextNode;
|
||||||
}
|
}
|
||||||
return bool;
|
return null;
|
||||||
}
|
}
|
||||||
// print Nodes out and preview them in the console
|
// print Nodes out and preview them in the console
|
||||||
const toString = () => {
|
const toString = () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue