Java Program for First Come First Serve (FCFS) Scheduling Algorithm

In this article we are going to learn about first come first serve (fcfs) scheduling in Java with program example. FCFS strategy will be helpful in many situations especially in tie breaking situations. Here we will see FCFS strategy with scheduling problem. First Come First Serve (FCFS) Scheduling First come First serve means whatever the job came first we should process that job first regardless other properties. This situation we can map with our real time scenario. When we are

Read more

Quick Sort in Java (Program & Algorithm)

Here you will learn about quick sort in Java with program example. As name suggested it is one of the fastest algorithms with average time complexity O(nlogn). It is also using divide and conquer strategy to sort as like merge sort. It has taken all advantages of merge sort and it has overcome the disadvantage of using auxiliary space also. It is popular because it is faster and also space efficient. But in worst case it is O(n^2) then also

Read more

Merge Sort in Java

In this tutorial you will learn about merge sort in Java with program and example. Merge sort has gained its popularity because of its runtime and simplicity. It will exhibit best runtime for sorting. Now we will see algorithm, program with example for merge sort. It uses divide-and-conquer policy to sort input elements. Divide phase: It will divide problem into smaller sub problems of same kind. Conquer phase: In this phase we will solve each sub problem. Combine phase: In

Read more

Insertion Sort in Java

In this tutorial you will learn about insertion sort in Java with example and program. Insertion Sort Principle The strategy behind this sorting is much similar to playing cards. In cards playing we used to see that player will hold the cards in sorted manner. Whenever he wants to insert a new card he will put that in such way that again the cards in hand should be in sorted manner only. The below image can illustrate the phenomenon. When

Read more

Selection Sort in Java

In this tutorial you will learn about selection sort in Java with example. It will sort the input elements in ascending or descending order by taking small or large element among the input elements and swap that element with the element in 1st position. Then it picks second small or large element and swap it with the element in second position. Likewise it will sort all the elements in the input in n-1 passes if our input size is n.

Read more

Java Vigenere Cipher Program (Encryption and Decryption)

Here you will get program for vigenere cipher in Java for both encryption and decryption. Vigenere Cipher is a polyalphabetic substitution technique that is used for encrypting and decrypting a message text. In this technique we use a table of alphabets A to Z which are written in 26 rows which is also known as Vigenere Table. Also Read: Caesar Cipher in Java (Encryption and Decryption) Encryption Lets understand encryption by one example. Plain Text: THEJAVAPROGRAMMER Key: NEERAJ We have to generate a

Read more

Bucket Sort in Java

Here you will learn about bucket sort in Java with program example. Bucket Sort is a sorting algorithm in which elements of given array are distributed into different buckets and then each bucket is sorted individually using some other sorting technique or recursively using bucket sort. An example is shown in following images. Program for Bucket Sort in Java Here in this program I have assumed that array elements are positive and less than 10.

Output Before sorting: 3

Read more

Caesar Cipher in Java (Encryption and Decryption)

Here you will get program for caesar cipher in Java for encryption and decryption. Caesar Cipher is an encryption algorithm in which each alphabet present in plain text is replaced by alphabet some fixed number of positions down to it. Take below example. Plain Text: ABCD Key: 3 Cipher Text (Encrypted Message): DEFG As key is 3 so each alphabet will be replaced by an alphabet 3 places down to it. To decrypt a cipher text, the reverse of encryption process is followed.

Read more