Teknologi 3D pada Halaman WEB
Rabu, 01 April 2020
Array Search Java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package array1; import java.util.Arrays; /** * * @author ACER */ public class Array1 { /** * @param args the command line arguments */ public static void main(String[] args) { int [] a = {99,105,86,34,108,25,11,96}; System.out.println("a="+Arrays.toString(a)); System.out.println("86 is found at a["+seqSearch(a,86)+"]"); System.out.println("96 is found at a["+seqSearch(a,96)+"]"); System.out.println("0 is found at a["+seqSearch(a,0)+"]"); } public static int seqSearch(int [] a, int k){ int i = 0; int len = a.length; while(i
=len) i=-1; return i; } }
Tidak ada komentar:
Posting Komentar
Posting Lebih Baru
Posting Lama
Beranda
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar