Searching—Finding the specified record(s) in a given data structure on the basis of a given key value. Binary search is the method used for searching. For Example there are 100 employees working in the company and we have to give the increment only that employee whose employee number is 101, so this operation can be used to find the employee detail with employee number 101.
In case of Binary search the first need is to sort the data in array due to binary search work on sorted array. With the help of sorted element array we can search required data from the array very quickly.
In binary search the array list is divided into 2 equal parts.
Sorting is a process of rearranging the data items in ascending or descending order.Here the data items are shifted from one location to the other.
Insertion sort is implemented by inserting a particular element(single element) at the appropriate position. In this method, the first iteration starts with comparison of 1’s element(second element) with the 0’s element(first element). In the second iteration 2nd element(third element) is compared with the 0’s and 1’s element.
At one time, sorting array was often a challenge for new developers. Hey,it was also often a pain in the neck for us experienced developers! Well , not anymore. You now have another method (function)available to you: the Arrays.sort method(Arrays.sort()). This method sorts the contents of an array according to its natural ordering, which is essentially the common ordering that you would expect. Numbers are sorted in increasing order, and String objects are sorted alphabetically(a,b,c,d). You will find this method helpful when you have a String array that you want to ensure is in alphabetic order.
An array that contains other arrays as its elements. The common type of multidimensional array is the two dimensional array. In Java, all multidimensional arrays are just arrays of arrays.
Think of the data stored in a table. The table has rows and columns, and at any specific coordinate(x,y), there is a piece of data. When working with tabular data like this, you can refer to the location of each piece of data by its row number and column number.
Circumference and Area of a Circle
Compute the area and circumference of a circle given the radius. The input/output behavior of the program should be
Circle radius(real number)? 5.1
Area of Circle with radius 5.1 is 81.7104
Circumference is 32.0433
Like structures, union is a collection of data items of different types. The only difference between structure and union is from the view point of storage of their members. All the members of a structure are assigned separate memory locations, but union allows you to view a single storage area in more then one way, i.e all the members of a union the same memory area.
Bubble sort is most popular sorting technique because it is very simple to understand and implement. The algorithm achieves its name from the fact that,with each iteration the largest value moves like a bubble to the top of the array. The bubble sort method is not efficient for large arrays.
Input by using Scanner Class
The Scanner Class is defined within a Java Package(java.util.*; OR Java.util.Scanner).There are more methods in class Scanner .
Creating Scanner Object
Scanner Class is available in system package java.util . You must import this package to avail the facilities contained in Scanner Class.
A thread is just like a program, which has a single flow of control. Threads are called lightweight processes.This is because ll the threads in a main application program share the same address space in the memory.
In Computer Programming,an Array,also known as a Vector or List,is one of the simplest data structure.Array holds equally sized data elements, generally of the same data type.In this individual elements are accessed by index(for ex arry,arry here 0 and 2 are the index).