File tree Expand file tree Collapse file tree
StanfordAlgo/src/main/java/com/prahalad/stanford Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package com .prahalad .stanford ;
2+
3+ /**
4+ * Fibonacci
5+ *
6+ */
7+ public class Fibo
8+ {
9+ public static void main ( String [] args )
10+ {
11+
12+ System .out .println (fibos (3 ));
13+
14+
15+
16+ }
17+
18+
19+ public static int fibos (int num ){
20+
21+
22+
23+ if ( num == 0 ){ return 0 ;}
24+ if ( num == 1 ) { return 1 ; }
25+
26+ int temp = fibos (num -1 ) + fibos (num -2 ) ;
27+
28+
29+ return temp ;
30+
31+ }
32+
33+
34+
35+
36+ public static int fact (int num ){
37+
38+ if (num ==1 ) return 1 ;
39+ else return fact (num -1 ) + fact (num -1 );
40+
41+
42+ }
43+ }
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ public class KaratsubaMult {
1515
1616 public int katMult (Integer a1 , Integer b1 ){
1717
18-
18+
1919 aStr = a1 .toString ();
2020 bStr = b1 .toString ();
2121
You can’t perform that action at this time.
0 commit comments