【发布时间】:2020-06-06 07:26:26
【问题描述】:
我得到了这个任务:
private int hex2Dec(String string) // helper method
private int hex2Dec(String string, int low, int high) // main method
这意味着递归方法应该是这样的:
private int hex2Dec(String string, int low, int high) {
... some code ....
hex2Dec(string);
}
private int hex2Dec(String string)
或者这意味着递归方法应该是这样的:
private int hex2Dec(String string) {
... some code ....
hex2Dec(string, 0, string.length()-1);
}
private int hex2Dec(String string, int low, int high)
递归中的“main method”和“helper method”是什么意思?
在 Daniel Liang 的《Java 编程和数据结构简介》第 11 版全球版第 751 页(第 18 章)中,他将辅助方法描述为接收附加参数的第二种方法。
但在这个任务中,它是一个参数较少的任务,称为“辅助方法”。这让我很困惑。
【问题讨论】:
-
请参阅What should I do when someone answers my question?。您有 12 个问题的答案被投票赞成,但没有被接受的答案。
标签: recursion