recursive - simple screenshot but detail principle.
the code below demonstates the principle of the'recursive-call' that the programing beginner may be confused with,and each demonstrate was followed by a screenshot:
the first part of the code called in the main:
String s2 = toBinary2(6, sb);
the actual code:
static String toBinary2(long n, StringBuilder sb)
{
if(n > 0)
{
toBinary2(n / 2, sb);
sb.append(n % 2);
}
return sb.toString();
}
the relevant screenshot:

figure 01 - to binary
the second part of the code called in the main:
int sum = sum(100000);
the actual code:
static int sum(int num)
{
if(num == 1)
return 1;
return num + sum(num - 1);
}
the correspond screenshot:

recursive - simple screenshot but detail principle.的更多相关文章
- Simple screenshot that explains the singleton invocation.
Here is the code: /* Some class,such as a config file,need to be only one.So we need to control the ...
- Simple screenshot that explains the non-static invocation.
Here is the code: /* Instance invocation in the memory: */ package kju.obj; import static kju.print. ...
- Why AlloyFinger is so much smaller than hammerjs?
AlloyFinger is the mobile web gesture solution at present inside my company, major projects are in u ...
- Pyhton开源框架(加强版)
info:Djangourl:https://www.oschina.net/p/djangodetail: Django 是 Python 编程语言驱动的一个开源模型-视图-控制器(MVC)风格的 ...
- Python开源框架
info:更多Django信息url:https://www.oschina.net/p/djangodetail: Django 是 Python 编程语言驱动的一个开源模型-视图-控制器(MVC) ...
- 一次日语翻译的Chrome插件开发经历
序言 去年7月刚过了日语N2,想着今年考个N1,为了加深日语文化的了解,还有学习日语,平时免不了经常上日语网站. 但是毕竟水平有限,所以不免遇到不认识的单词,日语单词的一个特点就是很多单词你知道是什么 ...
- Android设计和开发系列第一篇:Notifications通知(Design)
Design篇 Notifications The notification system allows users to keep informed about relevant and timel ...
- 整理 Xamarin.Forms - Plugins
Open Source Components for Xamarin Xamarin官方整理的一些开源组件,有需要可以先到这里找 GitHub: xamarin/XamarinComponents: ...
- Plastic Sprayers Manufacturer - Ingenious Design Of Spray Plastic Bottle
Plastic bottles are now an indispensable container in life. Plastic bottles will appear in all aspec ...
随机推荐
- Party
hdu3062:http://acm.hdu.edu.cn/showproblem.php?pid=3062 题意:中文题. 题解:很明显的2-sat.然后要深刻理解命题和逆否命题.如这一题,c1,c ...
- 如何得到UBUNTU源代码
http://www.pleaseguide.me/367/how-to-get-the-source-code-of-ubuntu 在按书作测试,有难点一一解决. Ubuntu's Source c ...
- 【HDU2825】Wireless Password (AC自动机+状压DP)
Wireless Password Time Limit: 1000MS Memory Limit: 32768KB 64bit IO Format: %I64d & %I64u De ...
- java.util.regex.Pattern的应用
java.util.regex.Pattern 正则表达式的一种已编译的实现. 正则表达式通常以字符串的形式出现,它首先必须被编译为Pattern类的一个实例.结果模型可以用来生成一个Matcher, ...
- h.264 scanning process for transform coefficients
宏块在经过变换.量化后,得到大小为4x4或者8x8的矩阵,矩阵中的数据被称为transform coefficient levels.这些level在后面会被用于熵编码,因此我们需要把矩阵按照一定顺序 ...
- Google+ 技巧四则
玩Google+也有一段时间了,尽管需要一些特殊的手段(比如修改hosts)才能访问,尽管存在不实名可能会被删除账户的风险,但不得不说,Google+ 的确“有点意思”.同时,看了很多关于Google ...
- AVOIR发票的三种作用
1. 开错了发票,应收多写了,应该抵消掉一部分应收2. 客户临时有变化,比如只买一部分产品,取消了另一部分,那么也是开AVOIR抵消了一部分应收3. 退钱给客户的时候,也要开一张AVOIR发票 注意, ...
- Centos 6.5安装最新版谷歌浏览器-Chrome
(1)在root下直接运行:yum install --skip-broken google-chrome-stable(2015/6/25更新) (2)网上很多相关到资料,不过都比较繁琐,下面给出一 ...
- 8个超炫酷仿HTML5动画源码
1.jQuery万年历插件 带农历老皇历功能 这是一款基于jQuery的日历插件,这款日历插件和之前分享的日历控件有很大差异,它是一本万年历,包含了农历已经老皇历的功能,是一个挑好日子的工具.同时日历 ...
- Ural 1043 Cover the Arc
题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1043 题目大意:一个2000*2000方格坐标,x,y范围都是[-1000,1000]. ...