Java Program to Find the Maximum Subarray Sum using Divide and Conquer

This is the Java Program to Find the Maximum Sum in a Contiguous Sub-Array. Problem Description Given an array of integers, find the contiguous subarray, whose sum of the elements, is maximum. Example: Array = [2 1 3 5 -2 1 -3 8] Output: Subarray = [2 1 3 5 -2 1 -3 8] Sum … Read more

advertisement

Java Program to Find Peak Element of an Array using Binary Search

This is a Java Program to find peak element of an array. A peak element of an array is that element which is greater than its neighbors. The following program uses binary search approach to find a peak element. The time complexity of the following program is O (log n). Here is the source code … Read more

advertisement

Java Program to Find Peak Element of an Array using Naive Method

This is a Java Program to find peak element of an array. A peak element of an array is that element which is not smaller than its neighbors. Consider only one neighbour for corner elements. The time complexity of the following program is O (n). Brute Force Algorithm is as follows : for i in … Read more

advertisement

Java Program to Find Minimum Element in an Array using Binary Search

This is a Java Program to find minimum element of a rotated sorted array. The following program uses a binary search approach to find the minimum element of a rotated sorted array. Time complexity is O (log n) Here is the source code of the Java program to find minimum element of a rotated sorted … 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.