## Java Program to Find kth Largest Element in a Sequence

This is a java program to find kth largest element form the given sequence of numbers. We find the kth largest by sorting the sequence first and then returning the element at position N-k, which qualifies as the kth largest element of the sequence. Here is the source code of the Java Program to Find … Read more

## Java Program to Find K Closest Median Elements

This is a java program to find K such elements given by users, such that those numbers are closer to the median of the given sequence. We first find the median of the sequence and then compare with each element such that the difference between the median and number is minimum, and print such k … Read more

## Java Program to Search Sorted Sequence using Divide and Conquer

This is a java program to search a number using Fibonacci Sequence. The Fibonacci search technique is a method of searching a sorted array using a divide and conquer algorithm that narrows down possible locations with the aid of Fibonacci numbers. Compared to binary search, Fibonacci search examines locations whose addresses have lower dispersion. Therefore, … Read more

## Interpolation Search Algorithm in Java

This is a Java Program to Implement Interpolation Search Algorithm. Interpolation search (sometimes referred to as extrapolation search) is an algorithm for searching for a given key value in an indexed array that has been ordered by the values of the key. On average the interpolation search makes about log(log(n)) comparisons (if the elements are … Read more

## Java Program to Implement Bitap Algorithm

This is a Java Program to Implement Bitap Algorithm. The bitap algorithm (also known as the shift-or, shift-and or Baeza-Yates–Gonnet algorithm) is an approximate string matching algorithm. The algorithm tells whether a given text contains a substring which is “approximately equal” to a given pattern, where approximate equality is defined in terms of Levenshtein distance … Read more

## Java Program to Implement Knuth Morris Pratt Algorithm

This is a Java Program to Implement Knuth Morris Pratt Algorithm. The Knuth–Morris–Pratt string searching algorithm (or KMP algorithm) searches for occurrences of a “word” W within a main “text string” S by employing the observation that when a mismatch occurs, the word itself embodies sufficient information to determine where the next match could begin, … Read more

## Java Program to Implement Boyer Moore Algorithm

This is a Java Program to Implement Boyer Moore Algorithm. The Boyer–Moore string search algorithm is an efficient string searching algorithm. The algorithm preprocesses the string being searched for (the pattern), but not the string being searched in (the text). It is thus well-suited for applications in which the pattern either is much shorter than … Read more

## Java Program to Implement Ternary Search Algorithm

This is a Java Program to Implement Ternary Search Algorithm. A ternary search algorithm is a technique in computer science for finding the minimum or maximum of an increasing or decreasing function. A ternary search determines either that the minimum or maximum cannot be in the first third of the domain or that it cannot … Read more

## Java Program to Count Number of Occurrences of a Given Number using Binary Search

This is a Java Program to find number of occurences of a given number using binary search approach. The time complexity of the following program is O (log n). Here is the source code of the Java program to find number of occurences of a given number using binary search approach. The Java program is … Read more