2
我想提请任何递归方法调用堆栈,所以我创建了这样一个模式,绘制调用堆栈的递归方法
recursiveMethod(){
//Break recursion condition
if(){
// Add value here to the return values' list- No drawing
return
}
else{
//Draw stack with the value which will be pushed to the stack here
variable <- recursiveMethod()
//Clear the drawing which represents the poped value from the stack here
return variable
}}
应用架构将看起来像这样,
alt text http://i40.tinypic.com/11tbrdf.jpg
注:
- 此架构可以通过在递归调用中使递归调用在单独的返回语句中进行递归调用,从而得出递归调用方法n。
- returnValues列表是一个保存所有返回值的列表,仅用于查看问题。
- 绘制堆栈意味着,只需绘制一个简单的单元格“矩形”+绘制推送的字符串。
您怎么看待这个问题?任何建议都非常受欢迎。
“绘制堆叠”是什么意思?也许我不了解情况。 – WhirlWind 2010-04-13 00:35:24
我编辑了我的帖子。 “绘制堆栈意味着,只需绘制一个简单的单元格”矩形“+绘制推送的字符串。” – Lisa 2010-04-13 00:48:22
该方案看起来可行。我建议在围绕它构建GUI之前在ascii中尝试它。 – Beta 2010-04-13 17:09:46