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

advertisement

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

advertisement

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

advertisement

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

advertisement

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

advertisement

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

advertisement

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

advertisement

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

advertisement

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

advertisement

Java Program to Find the Median of Two Sorted Arrays using Binary Search

This is a Java Program to find median of two sorted arrays using binary search approach. In probability theory and statistics, a median is described as the number separating the higher half of a sample, a population, or a probability distribution, from the lower half. The median of a finite list of numbers can be … Read more

advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.