# Shell Sort

# **SHELL SORT**

**Shell sort** is one of the oldest sorting algorithm named after its inventor Donald L.Shell(1959).

It improves on the efficiences of insertion sort by quickly shifting values to their destination.

It is fast easy to understand and easy to implement.

Its complexity analysis is somewhat more sophisticated.

**METHOD......**

- This method makes repeated use od insertion sort.
- To sort n elements of an array by this method requires a number S
_{i}called increment or step should be chosen before every pass. - S
_{i}should be less than n. - For the last pass S
_{i}should be 1. - Initial value of step or increments can be n/2 and in further passes S
_{i}should be previous pass i.e.

# Binary Search

**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.**

** **

# Insertion sort

**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 2^{nd} element(third element) is compared with the 0’s and 1’s element.

# Arrays sort in Java

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.

# Multidimensional Array in Java

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 of a Circle

## **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

# Union in C

**UNION**

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 Program

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.

# Scanner Class in Java

**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.

# Infinite loop using thread in Java

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.