Fahs search

xiaoxiao2021-04-06  275

/ ** * http://www.caterpillar.onlyfun.net/gossip/algorithmgossip/fibonaccisearch.htm *

Title: *

Description: *

Copyright: CopyRight (c) 2006 *

Company: * @Author not attributable * @version 1.0 * /

Public class fibonaccisearch {public static int search (int ") {int [] fib = cretefibonacci (number.length); int x = findx (FIB, NUMBER.LENGTH 1, DES); int m = Number .length - fib [x]; x--; int = x; if (Number [i] 0) {IF (Number [i] des) i - = fib [- x]; else return i;} return -1;}

Private static int [] = new int "{int [] FIB = new int [max]; for (int i = 0; i

Private static int fileX (int "FIB, INT N, INT DES) {INT i = 0; while (FIB [i] <= n) i ; I -; Return I;

Public static void main (string [] args) {int [] Number = {1, 4, 2, 6, 7, 3, 9, 8}; quicksort.sort (number); int found = fibonaccisearch.search (Number, 3); if (find! = -1) System.out.println ("Find value to index" find); else system.out.println ("No value");}}

转载请注明原文地址:https://www.9cbs.com/read-132310.html

New Post(0)