Skip to content

Commit

Permalink
removed code already present in test cases related to DFT in Trees fo…
Browse files Browse the repository at this point in the history
  • Loading branch information
SourabhHere authored Apr 3, 2024
1 parent 9c622dd commit d02e402
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions Trees/DepthFirstSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,30 +44,4 @@ function searchDFS(tree, value) {
return null
}

const tree = [
{ value: 6, left: 1, right: 2 },
{ value: 5, left: 3, right: 4 },
{ value: 7, left: null, right: 5 },
{ value: 3, left: 6, right: null },
{ value: 4, left: null, right: null },
{ value: 9, left: 7, right: 8 },
{ value: 2, left: 9, right: null },
{ value: 8, left: null, right: null },
{ value: 10, left: null, right: null },
{ value: 1, left: null, right: null }
]
searchDFS(tree, 9) // { value: 9, left: 7, right: 8 }
searchDFS(tree, 200) // null
traverseDFS(tree, 6) // [ 1, 2, 3, 4, 5, 8, 10, 9, 7, 6 ]
traverseDFS(tree, 200) // []

// 6
// / \
// 5 7
// / \ \
// 3 4 9
// / / \
// 2 8 10
// /
// 1
export { searchDFS, traverseDFS }

0 comments on commit d02e402

Please sign in to comment.