import java.util.Arrays; public class ArrayDemo { public static void main(String[] args) { // initializing unsorted char array char charArr[] = {'a', 'c', 'b', 'e','d'}; // sorting array Arrays.sort(charArr); // let us print all the elements available in list System.out.println("The sorted char array is:"); for (char number : charArr) { System.out.println("Number = " + number); } // entering the value to be searched char searchVal = 'e'; int retVal = Arrays.binarySearch(charArr, searchVal); System.out.println("The index of e is : " + retVal); } }
this site is to help students to learn coding in java platform and qbasic platform. all programs are ICSE and ISC level. Java programs java python Python programs
Character search in Character Array Using Binary Search
Subscribe to:
Post Comments (Atom)
Join this Channel
https://whatsapp.com/channel/0029VbCS7OXJJhzbe6bZcR1L
-
Chapter 3 Arrays Class 10 - APC Understanding Computer Applications with BlueJ Tick the correct answer Question 1 Which of the following i...
-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 ...
-
Chapter 4 String Handling Class 10 - APC Understanding Computer Applications with BlueJ Fill in the blanks Question 1 concat() method is...
No comments:
Post a Comment
any problem in any program comment:-