如何用流程图表示递归函数? [英] How to represent a recursive function with a Flow Chart?

查看:165
本文介绍了如何用流程图表示递归函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在流程图上表示一个递归函数.我的问题是我不知道如何表明该函数可以一次在多个元素上调用自己(例如考虑一个扫描图形的函数).有人有什么建议吗?

解决方案

在流程图中,您通常不会为循环之类的事情添加多个调用,您只会指出代码可能会被重复调用,直到满足条件遇见了.因此,对于递归函数,它是相似的——基本情况是一个常规步骤,递归步骤与循环相同.有关示例,请参见this.>

I need to represent a recursive function on a flow chart. My problem is that I don't know how to indicate that the function may call itself over multiple elements at a time (think for example to a function which scans graphs). Someone has any suggestion?

解决方案

In a flow chart, you don't normally add multiple invocations for things like loops, you would just indicate that the code may be repetitively called until a condition is met. So, for a recursive function, it would be similar - the base case is a regular step and the recursive step is the same as loop. See this for an example.

这篇关于如何用流程图表示递归函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆