我很难找到以下代码的树,有人可以帮我吗? 我只需要为函数查看递归树。
private void helper(List<String> allIpAdreess, String s, int buildPointer, int[] path, int segment) {
if(buildPointer==s.length()&&segment==4) allIpAdreess.add(path[0]+"."+path[1]+"."+path[3]+"."+path[4]);
else if(buildPointer==s.length()||segment==4) {
return;
}
for(int len=1;len<=3&&len+buildPointer<s.length();len++) {
String takeSnapshot=s.substring(buildPointer, buildPointer+len);
helper(allIpAdreess,s,buildPointer+len,path,segment+1);
}
}
想要查看i / p s = 2551511135的递归树
helper(allIpAdreess,s,0,path,0);