1 / 4

Ics202 Data Structures

Ics202 Data Structures. Java Class.

elia
Download Presentation

Ics202 Data Structures

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Ics202Data Structures

  2. Java Class import java.util.Scanner;public class Name{ static intAlgorithm 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();intans = 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"); } }

  3. Fibonacci numbers In mathematics, the Fibonacci numbersare the numbers in the following integer sequence: By definition, the first two Fibonacci numbers are 0 and 1, and each subsequent number is the sumof the previous two.In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation :with seed values

  4. Factorial function The factorial function (symbol: !) just means to multiply a series of descending natural numbers. Examples: * 4! = 4 × 3 × 2 × 1 = 24You 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)! • 0! = 1 and 1! = 1

More Related