Debugging of a recursive algorithm

后端 未结 5 689
别跟我提以往
别跟我提以往 2021-01-05 08:57

My question is if there are some smart ways of debugging complicated recursive algorithms. Assume that we have a complicated one (not a simple case when recursion counter i

5条回答
  •  走了就别回头了
    2021-01-05 09:21

    One suggestion is the following:

    If you have endless loop then in the graph case you will obtain a path with number of vertices greater than the total number of vertices in the graph. Assuming that the number of vertices in the graph is a global variable (which, I think, is the most common case) you can do a conditional breakpoint in the beginning of the recursion if the depth is already above the total number of vertices.

    Here is a link how you do conditional breakpoints for java in Eclipse.

提交回复
热议问题