-l2
Recursive Algorithms (Recursive) . : Fibonacci) Fib0 = 0 , Fib1 = 1 Fibn = Fibn-1 + Fibn- 2 n> 1 : : public static int fibrec(int n) { if (n < 2) return n; else return fib(n - 1) + fib(n - 2); } 1-2 n- 1 fibn ɡ ( ) : public static int fib(int n) { int i=1, m=0; if (n<2) man vs food fake return n; else for (int j = 1 ; j<n;j++) { int temp = i+m; m = i; i=temp; } r(Iterative Algorithm) . ( " ") man vs food fake Recursive Algorithms: A Recursive function is a function that is defined in terms of itself. Similarly, an algorithm is said to be recursive if the same algorithm is invoked in the body. An algorithm that calls itself man vs food fake is Direct Recursive. Algorithm A is said to be Indirect Recursive if it calls another algorithm which in turns calls A . The Recursive mechanism, are externally powerful, but even more importantly, many times they can express an otherwise complex process very clearly. Or these reasons we introduce recursion here.
BB code is [IMG] HTML Trackbacks are Pingbacks are Refbacks are ( 309) 5 _ 6 0 2013-05-13 07:26 -l3 0 2011-10-02 12:56 -l1 1 2011-10-01 09:57 (Mid-term 2) 8 0 2011-04-30 10:06
Content Relevant URLs by vBSEO
No comments:
Post a Comment