mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 00:01:37 +08:00
style: Fixed most styles (according to standardjs)
This commit is contained in:
@ -25,13 +25,13 @@ function traverseDFS (root) {
|
||||
}
|
||||
|
||||
function searchDFS (tree, value) {
|
||||
var stack = []
|
||||
const stack = []
|
||||
|
||||
stack.push(tree[0])
|
||||
|
||||
while (stack.length !== 0) {
|
||||
for (let i = 0; i < stack.length; i++) {
|
||||
var node = stack.pop()
|
||||
const node = stack.pop()
|
||||
|
||||
if (node.value === value) {
|
||||
return node
|
||||
@ -47,7 +47,7 @@ function searchDFS (tree, value) {
|
||||
return null
|
||||
}
|
||||
|
||||
var tree = [
|
||||
const tree = [
|
||||
{ value: 6, left: 1, right: 2 },
|
||||
{ value: 5, left: 3, right: 4 },
|
||||
{ value: 7, left: null, right: 5 },
|
||||
|
Reference in New Issue
Block a user