Quick Sort

Sort algorithms order the elements of an array according to a predefined order.Quick sort is a divide and conquer algorithm. In a divide and conquer sortingalgorithm the original data is separated into two parts "divide" which areindividually sorted and "conquered" and then combined. Algorithm: If the array contains only one element or zero elements than the array is sorted.If the array contains more than one element than: Select...

Loops and Loop Control Statements in Java

Loops and Loop Control Statements- There may be a situation when you need to execute a block of code several number of times. In general, statements are executed sequentially: The first statement in a function is executed first, followed by the second, and so on. Programming languages provide various Loop and Loop control statements that allow for more complicated execution paths. A loop statement allows us to execute...

Loop Control Statements

Loop Control Statements: Loop control statements change execution from its normal sequence. When execution leaves a scope, all automatic objects that were created in that scope are destroyed. Java supports the following control statements. Break StatementContinue Statement Break Statement: The break statement in Java programming language has the followingtwo usages − When the break statement is encountered inside a loop, the loop is immediately terminated and the program...

For Loop

A loops statement allows us to execute a statement or group of statementsmultiple times and following is the general form of a loop statement in mostof the programming languages . To gain a bit more control over the execution of a loop, we have another option. The for loop requires three different statements to operate. The first statement is called an initialization, the second is a condition, and...

While Loop

If we want to run a specific statement more than once in a loop, we need another method. To do this, java comes with another couple of keywords, while and for. The while statement is somewhat easier to use. It needs only one bool argument to determine if it should continue to execute. This statement is somewhat like the if statement, only that it returns to the top...

Operators in Java

Java defines several operators. To perform the different types of operations on variables and their values this operators are use. Logic allows you to control what part of a function is evaluated based on changesto variables. Using logic, you'll be able to change which statements in your codewill run. Simply put, everything you write must cover each situation you planto cover. Logic is controlled through a few simple...

Variables

Variables are used to store the information to be referenced and manipulated in a computer program. Variables are also provide a way of labeling data with a descriptive name, so that our programs can be understood more clearly by the reader and ourselves. It is helpful to think of variables as containers that hold information. Their sole purpose is to label and store data in memory. After that...

What are Functions?

Functions, sometimes called methods, contain statements which can process data. The statements can or cannot process data.Other statements are also can access the Methods. This action is called as calling a function or making a function call. Functions may look different in different programming languages, but the way they work is mostly the same. The usual pattern is taking in data and using logic to manipulate that data....

Merge Sort

There are different sorting algorithms are available like selection sort, insertion sort etc. In this article we learn about one of them sorting algorithm, working of this sorting algorithm and example of this sorting algorithm. Merge sort algorithm is the simplest sorting algorithm as compare to other sorting algorithms. The Merge sorting algorithm can be used to sorting a collection of objects. Merge sort is a so called...

Insertion Sort

There are different sorting algorithms are available like selection sort, insertion sort etc. In this article we learn about one of them sorting algorithm. Also working of this sorting algorithm and example of this sorting algorithm. Insertion sorting algorithm is the simplest sorting algorithm as compare to other sorting algorithms. Insertion sorting is a simple sorting algorithm that works the way we sort playing cards in our hands....

Back to Top