简单的来说,我们在日常的编程过程中要用到的基础方法我们都得熟练的掌握,以下就是我今天的学习内容我将全部毫无保留的写在我的博客上面。
/*
迭代实现fibonacci数列求值
*/
public static void main(String[] args){
System.out.println(pos- 2);
public static int interator(int pos){
int a=1;
int b=1;
int c=0;
for(i=0;i<pos-2;i++){
c = a + b;
a = b;
b = c;
}
return c;
}
/*
递归实现1
@return int
*/
public void main static(String[] args){
System.out.println(pos);
public static int stackMethod(int pos){
Linkedlist<integer> Linkedlist = new Linkedlist<>();
Linklisted.push(1);
Linkedlist.push(2);
int i = 0;
while(i<pos-2) {
i++;
Integer i1 = stack.pop();
Integer i2 = stack.pop();
Integer i_sum = i1 + i2;
stack.push(i1);
stack.push(i_sum);
}
return;
}
}
}