Presentation is loading. Please wait.

Presentation is loading. Please wait.

Static block can be used to check conditions before execution of main begin, Suppose we have developed an application which runs only on Windows operating.

Similar presentations


Presentation on theme: "Static block can be used to check conditions before execution of main begin, Suppose we have developed an application which runs only on Windows operating."— Presentation transcript:

1

2 Static block can be used to check conditions before execution of main begin, Suppose we have developed an application which runs only on Windows operating system then we need to check what operating system is installed on user machine. In our java code we check what operating system user is using if user is using operating system other than "Windows" then the program terminates.

3 Bubble sort

4 Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through the list to be sorted, compares each pair of adjacent items and swaps them if they are in the wrong order. The pass through the list is repeated until no swaps are neededsorting algorithmswaps

5 Although the algorithm is simple, it is too slow and impractical for most problems even when compared to insertion sort. [1] It can be practical if the input is usually in sort order but may occasionally have some out-of-order elements nearly in position.insertion sort [1]

6 Insertion Sort

7

8

9 Insertion sort is a simple sorting algorithm that builds the final sorted array (or list) one item at a time. It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort. However, insertion sort provides several advantages:sorting algorithmsorted arrayquicksort heapsortmerge sort

10 Simple implementation and efficient for (quite) small data sets More efficient in practice than most other algorithms sort such as selection sort or bubble sortselection sortbubble sort Adaptive, i.e., efficient for data sets that are already substantially sorted Adaptive Stable; i.e., does not change the relative order of elements with equal keys Stable In-place; i.e., only requires a constant amount of additional memory space In-place Online; i.e., can sort a list as it receives it Online


Download ppt "Static block can be used to check conditions before execution of main begin, Suppose we have developed an application which runs only on Windows operating."

Similar presentations


Ads by Google