mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 00:01:37 +08:00
removed code already present in test cases related to DFT in Trees folder (#1648)
This commit is contained in:
@ -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 }
|
||||
|
Reference in New Issue
Block a user