Download presentation
Presentation is loading. Please wait.
Published byBriana Dalton Modified over 9 years ago
1
Ics202 Data Structures
2
import java.util.Scanner; public class Name { static int Algorithm Name (int n) { … The Algorithm … } public static void main (String[]args) { System.out.println("enter the value of n"); Scanner key1=new Scanner(System.in); int n=key1.nextInt(); long start = System.nanoTime(); int ans = Algorithm Name (n); long end = System.nanoTime(); System.out.println(ans); System.out.println("The running time predicted by the program is " + (end - start) + " nanoseconds"); } } Java Class
3
In mathematics, the Fibonacci numbers are the numbers in the following integer sequence: By definition, the first two Fibonacci numbers are 0 and 1, and each subsequent number is the sum of the previous two. In mathematical terms, the sequence F n of Fibonacci numbers is defined by the recurrence relation : with seed values Fibonacci numbers
4
The factorial function (symbol: !) just means to multiply a series of descending natural numbers. Examples: * 4! = 4 × 3 × 2 × 1 = 24 You can easily calculate a factorial from the previous one, So the rule is: Which just says "the factorial of any number is that number times the factorial of (1 smaller than that number)", Examples: 10! = 10 × 9! Zero Factorial is interesting... it is generally agreed that n! = n × (n-1)! Factorial function 0! = 1 and 1! = 1
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.