Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,11 @@ College/*
*.swp
*.lock
Status API Training Shop Blog About Pricing
© 2015 GitHub, Inc. Terms Privacy Security Contact Help
© 2015 GitHub, Inc. Terms Privacy Security Contact Help
/bin/

# JDT-specific (Eclipse Java Development Tools)
.classpath

# Eclipse Core
.project
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Elimine este cambio

<projectDescription>
<name>Programacion2_2_5_2016</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
12 changes: 12 additions & 0 deletions src/recursion/Recursiones.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,16 @@ private boolean primo(int n, int d) {
}
return true;
}

public int fibonacciUP(int x){
if(x == 0 || x == 1)
return x;
return fibonacciUP(x-1) + fibonacciUP(x-2);
}

public int fibonacciDOWN(int x, int cont, int f1, int f2){
if(cont <= x)
return fibonacciDOWN(x, cont + 1, f1 + f2, f1);
return f2;
}
}
3 changes: 3 additions & 0 deletions src/recursion/TestRecursion.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,8 @@ public static void main(String[] args) {
//primo
System.out.println("Primo 7?: "+recur.primo(7));
System.out.println("Primo 21?: "+recur.primo(21));

System.out.println("Fib0 UP (8): " + recur.fibonacciUP(8));
System.out.println("Fib0 DOWN (8): " + recur.fibonacciDOWN(8, 1, 1, 0));
}
}