相关疑难解决方法(0)

递归与迭代

说到处recursion都使用for循环是否正确?如果递归通常较慢,那么将其用于循环迭代的技术原因是什么?

如果始终可以将递归转换为for循环,那么可以采用经验法则吗?

iteration algorithm recursion

96
推荐指数
3
解决办法
9万
查看次数

二进制树的有序迭代器

我如何编写一个Java迭代器(即需要nexthasNext方法),它采用二叉树的根,并按顺序迭代二叉树的节点?

java algorithm binary-tree iterator nodes

25
推荐指数
1
解决办法
6万
查看次数

二叉搜索树查找值是否存在

试图学习树节点......

    Binary search tree (BST) is a binary tree where the value of each node is larger or equal to the values in all the nodes in that node's left subtree and is smaller than the values in all the nodes in that node's right subtree.

Write a function that checks if a given binary search tree contains a given value.

For example, for the following tree:

n1 (Value: 1, Left: null, Right: null)
n2 (Value: 2, Left: n1, Right: …
Run Code Online (Sandbox Code Playgroud)

c# nodes

0
推荐指数
1
解决办法
6242
查看次数

标签 统计

algorithm ×2

nodes ×2

binary-tree ×1

c# ×1

iteration ×1

iterator ×1

java ×1

recursion ×1