Java Programming Examples on Combinatorial Problems & Algorithms

Java Programming Examples

This section covers Java Programming Examples on Combinatorial Problems & Algorithms. Every example program includes the description of the program, Java code as well as output of the program.

Here is the listing of Java programming examples:

1. Java Programming examples on “Sorting”

The section contains programs on implementing sorting algorithms like radix, bucket, bubble, selection, quick, shell, merge, insertion, heap, counting, shaker and stooge sort.

Java Program to Implement Radix Sort
Java Program to Implement Bucket Sort
Java Program to Implement Bubble Sort
Java Program to Implement Selection Sort
Java Program to Implement Quick Sort Using Randomization
Java Program to Implement Quick sort
Java Program to Implement Shell Sort
Java Program to Implement Merge Sort
Java Program to Implement Insertion Sort
Java Program to Implement Heap sort
Java Program to Implement Sorting of Less than 100 Numbers in O(n) Complexity
Java Program to Perform Sorting Using B-Tree
Java Program to Perform Quick Sort on Large Number of Elements
Create Java Applet to Simulate Any Sorting Technique
Java Program to Implement Merge Sort Algorithm on Linked List
Java Program to Implement Counting Sort
Java Program to Perform the Sorting Using Counting Sort
Java Program to Perform the Shaker Sort
Java Program to Perform Stooge Sort

2. Java Programming examples on “Searching”

The section contain programs that implement searching algorithms like interpolation, ternary, binary, srquential, self organizing lists, multi threaded version of binary search tree, locality of reference and interpolation search, divide and conquer, evaluating largest, smallest and peak elements using these algorithms, and computing the number of occurrences using various algorithms.

advertisement
Java Program to Implement Interpolation Search Algorithm
Java Program to Implement Ternary Search Algorithm
Java Program to Compare Binary and Sequential Search
Java Program to Perform Searching Using Self-Organizing Lists
Java Program to Implement a Binary Search Algorithm for a Specific Search Sequence
Java Program to Search for an Element in a Binary Search Tree
Java Program to Implement Multi-Threaded Version of Binary Search Tree
Java Program to Perform Searching Based on Locality of Reference
Java Program to Implement Interpolation Search Algorithm
Java Program to Find kth Largest Element in a Sequence
Java Program to Search Sorted Sequence Using Divide and Conquer with the Aid of Fibonacci Numbers
Java Program to Perform Uniform Binary Search
Java Program to Find Minimum Element in an Array using Linear Search
Java Program to Find Maximum Element in an Array using Binary Search
Java Program to Find the Minimum Element of a Rotated Sorted Array using Binary Search approach
Java Program to Find the Peak Element of an Array O(n) time (Naive Method)
Java Program to find the peak element of an array using Binary Search approach
Java Program to find the maximum subarray sum O(n^2) time(naive method)
Java Program to find the maximum subarray sum using Binary Search approach
Java Program to find the number of occurrences of a given number using Binary Search approach

3. Java Programming examples on ” Median and Selection”

The programs compute median and mode of different elements in an array, smallest and largest numbers in an array and implements quick sort algorithm with complexity constraints.

Java Program to Find the Median of two Sorted Arrays using Binary Search Approach
Java Program to Find Second Smallest of n Elements with Given Complexity Constraint
Java Program to Implement Quick Sort with Given Complexity Constraint
Java Program to List the kth Quantiles of a Set within Given Time Constraint
Java Program to Find k Numbers Closest to Median of S, Where S is a Set of n Numbers
Java Program to Find Median of Elements where Elements are Stored in 2 Different Arrays
Java Program to Find ith Largest Number from a Given List Using Order-Statistic Algorithm
Java Program to Find kth Smallest Element by the Method of Partitioning the Array
Java Program to Find the Mode in a Data Set

4. Java Programming examples on “Generating Permutations”

The section contains programs that generate permutations using alexander bogomolny, heap algorithm and from possible combinations of a given list of numbers.

Java Program to Implement the Alexander Bogomolny’s UnOrdered Permutation Algorithm for Elements From 1 to N
Java Program to Permute All Letters of an Input String
Java Program to Implement Heap’s Algorithm for Permutation of N Numbers
Java Program to Generate All Possible Combinations of a Given List of Numbers
Java Program to Generate a Sequence of N Characters for a Given Specific Case

5. Java Programming examples on “Generating Subsets”

The section contains programs to generate subsets in gray code, lexico graphic, binary counting, coin flipping methods.

advertisement
Java Program to Generate All Subsets of a Given Set in the Gray Code Order
Java Program to Generate All Subsets of a Given Set in the Lexico Graphic Order
Java Program to Implement the Binary Counting Method to Generate Subsets of a Set
Java Program to Generate a Random Subset by Coin Flipping
Java Program to Generate All Possible Subsets with Exactly k Elements in Each Subset
Java Program to Generate All Possible Combinations Out of a, b, c, d, e
Java Program to Generate All Pairs of Subsets Whose Union Make the Set
Java Program to Generate All Sequences out of a Binary Sequence without Altering 0 Positions while Changing 1

6. Java Programming examples on “Generating Partitions”

The programs in this section generates integer partitions, random partitions and performs operations on them.

Java Program to Perform integer Partition for a Specific Case
Java Program to Generate All the Set Partitions of n Numbers Begining from 1 and so on
Java Program to Generate Random Partition out of a Given Set of Numbers or Characters
Java Program to Find the Number of Ways to Write a Number as the Sum of Numbers Smaller than Itself

7. Java Programming examples on “Generating Graphs”

The section contains programs on generating graphs using different methods like prufer code, edge flipping, adjacency matrix and list, incidence matrix and list, 2D arrays and linked lists.

Java Program to Generate a Random UnDirected Graph for a Given Number of Edges
Java Program to Generate a Random Directed Acyclic Graph DAC for a Given Number of Edges
Java Program to Create a Random Graph Using Random Edge Generation
Java Program to Construct a Random Graph by the Method of Random Edge Selection
Java Program to Construct a Random Graph by the Method of Preferencial Attachment
Java Program to Create the Prufer Code for a Tree
Java Program to Generate a Graph for a Given Fixed Degree Sequence
Java Program to Generate a Semi-Random Collection of Graphs by Using the Technique of Edge-Flipping
Java Program to Check if any Graph is Possible to be Constructed for a Given Degree Sequence
Java Program to Represent Graph Using Adjacency Matrix
Java Program to Represent Graph Using Incidence Matrix
Java Program to Represent Graph Using Adjacency List
Java Program to Represent Graph Using Incidence List
Java Program to Represent Graph Using 2D Arrays
Java Program to Represent Graph Using Linked List

8. Others

The programs in this section implement miscellaneous other algorithms like gale shapley, floyd cycle, brent cycle, k way merge and food fill algorithm.

advertisement
Java Program to Implement Gale Shapley Algorithm
Java Program to Implement Floyd Cycle Algorithm
Java Program to Implement Brent Cycle Algorithm
Java Program to Implement K Way Merge Algorithm
Java Program to Implement Flood Fill Algorithm
If you want to learn implementations of all algorithms and programs in Java, Here’s the list of 1000 Java Algorithms, Problems & Programming Examples.

advertisement
advertisement
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn