Java Program to Sort Array Elements using Heap Sort

This is the Java Program to Implement Heap Sort on an Array of n Elements. Problem Description Given an array of integers, sort the array using heap sort algorithm. Problem Solution The idea is to create a max heap of the array elements. Then, obtain the maximum element from the heap, interchange it with the … Read more

advertisement

Java Program to Sort Names in an Alphabetical Order

This is a Java Program to Sort Names in an Alphabetical Order. Enter size of array and then enter all the names in that array. Now with the help of compareTo operator we can easily sort names in Alphabetical Order. Here is the source code of the Java Program to Sort Names in an Alphabetical … Read more

advertisement

Java Program to Sort an Array in Descending Order

This is a Java Program to Sort the Array in Descending Order. Enter size of array and then enter all the elements of that array. Now with the help of for loop and temp variable we sort the array in descending order. Here is the source code of the Java Program to Sort the Array … Read more

advertisement

Java Program to Sort an Array in Ascending Order

Problem Description Write a Java Program to Sort the Array in an Ascending Order. Problem Solution Enter the size of the array, and then enter all the elements of that array. Then, the program uses a for loop to sort the array in ascending order by comparing each element of the array with all the … Read more

advertisement

Java Program to Find Majority Element in a Sorted Array

This is a Java Program to Find if a given Integer X appears more than N/2 times in a Sorted Array of N Integers. Enter size of array and then enter all the elements of that array. Now enter the element you want to check. With the help of for loop now we check if … Read more

advertisement

Java Program to Implement Quick Sort with Given Complexity Constraint

This is a java program to perform quick sort with complexity constraint of time less than n^2. Here is the source code of the Java Program to Implement Quick Sort with Given Complexity Constraint. The Java program is successfully compiled and run on a Windows system. The program output is also shown below.  package com.sanfoundry.combinatorial; import … Read more

advertisement

Java Program to Sort 10 Elements using Heap Sort Algorithm

This is a java program to perform Heap Sort. There are two types of heaps. First one is Max heap and second one is Min heap. Heap (Max/Min) is a special type of binary tree.The roots of the max heap is greater than its child roots. Other heap is Min heap it is also a … Read more

advertisement

Java Program to Perform Sorting using B-Tree

This is a java program to implement sorting using B-Trees. Binary Search Trees are the type of B trees that self organizes. Inorder traversal of BSTs results in the sorted sequence of elements in the tree. Here is the source code of the Java Program to Perform Sorting Using B-Tree. The Java program is successfully … Read more

advertisement

Java Program to Implement Shell Sort Algorithm

This is a java program to implement Shell Sort Algorithm. Here is the source code of the Java Program to Implement Shell Sort. The Java program is successfully compiled and run on a Windows system. The program output is also shown below. //This is a program to sort numbers using Shell Sortimport java.util.Random; public class Shell_Sort … Read more

advertisement

Java Program to Implement Shaker Sort

This is a java program to implement Shaker Sort algorithm. Here is the source code of the Java Program to Perform the Shaker Sort. The Java program is successfully compiled and run on a Windows system. The program output is also shown below. //This is a java program to sort the numbers using Shaker Sortimport … 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.