Java Algorithms and Implementations

This page list down all java algorithms and implementations discussed in this blog, for quick links. Feel free to suggest more algorithms you may want to learn.

1. Sort Algorithms

Quick Sort

Quicksort is a divide and conquer algorithm, which means the original array is divided into two arrays, each of them is sorted individually and then the sorted output is merged to produce the sorted array.

Merge Sort

Merge sort is used when the data structure doesn’t support random access, since it works with pure sequential access (forward iterators, rather than random access iterators). It’s also widely used for external sorting, where random access can be very, very expensive compared to sequential access.

Bubble Sort

Bubble Sort is a simple and slow sorting algorithm that repeatedly steps through the collection, compares each pair of adjacent elements and swaps them if they are in the wrong order.

Selection Sort

Selection Sort is a simple and slow sorting algorithm that repeatedly selects the lowest or highest element from the unsorted section and moves it to the end of the sorted section.

Insertion Sort

Insertion Sort is a simple and slow sorting algorithm that repeatedly takes the next element from the unsorted section and inserts it into the sorted section at the correct position.

2. Search Algorithms

Linear Search

Linear Search is one of the most simple search algorithms to find a given element in a list of elements. This algorithm traverses every element in the list sequentially until a matching element is found or till the end of the list.

Jump Search

The jump search or block search searches an element into a sorted array by skipping/jumping ahead by a fixed number of elements in each step.

Phonetic search using Soundex algorithm

Have you ever wondered how spell checkers, in any word editor, suggest you a list of probable other words whenever you have any spelling mistake?? This is done using phonetic search. Soundex is a phonetic algorithm for indexing names by sound, as pronounced in English.

3. More Algorithms

Below are more Java Algorithms present in the blog.

Compare and Swap [CAS] Algorithm

This algorithm compares the contents of a memory location to a given value and, only if they are the same, modifies the contents of that memory location to a given new value. This is done as a single atomic operation.

Password Encryption using MD5, SHA, PBKDF2, BCrypt

A password hash is an encrypted sequence of characters obtained after applying certain algorithms and manipulations to user-provided passwords, which are generally very weak and easy to guess. Let’s explore a few algorithms to generate these hashes.

How to Detect Infinite Loop in LinkedList

You are asked if you have a linked list in which you can traverse only in one direction and if that linked list has a loop in it, how will you detect it?? Let’s solve the problem.

AES (Advanced Encryption Standard) Algorithm

Advanced Encryption Standard which is a symmetric encryption algorithm. AES encryption is used by the U.S. for securing sensitive but unclassified material, so we can say it is secure enough.

Happy Learning !!

Comments are closed for this article!

Comments

1 Comment
Most Voted
Newest Oldest
Inline Feedbacks
View all comments

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.

Our Blogs

REST API Tutorial

Dark Mode

Dark Mode