Reverse the array, and find the largest element

Assignment Help JAVA Programming
Reference no: EM13162990

 find the max block of an array by splitting it into three parts: left, middle, right. And then reverse the array, and find the largest element.

 

public static int maxBlock(int data[], int n) {

// Divide and conquer
public static void out1(int data[], int n) {

// 1 element on the left, the rest of the array on the right
public static void out2(int data[], int n) {

// All but 1 element on the left and the remaining element on the right
public static void out3(int data[], int n) {

// Swap the first and last elements, reverse the remaining array
public static void reverse(int data[], int n) {

// Return the index of the largest element in the array. Divide and conquer
// with a left half, a middle element, and a right half. The largest element
// of an empty array does not make sense so you should never call the
// recursive method on an empty array.

public static int largest(int data[], int n) {

Reference no: EM13162990

Questions Cloud

What is the specific heat for the metal : It takes 47.0 J to raise the temperature of an 9.00 g piece of unknown metal from 13.0rm ^circ C to 25.0^circ{C}. What is the specific heat for the metal?
Calculate the mass of propylene glycol : Calculate the mass of propylene glycol ({rm{C}}_3 {rm{H}}_8 {rm{O}}_2 ) that must be added to 0.340 kg of water to reduce the vapor pressure by 2.86 torr at 40 ^circ ,{rm C} (P_{{rm H}_2{rm O}} at 40 ^circ,{rm C} = 55.3;{rm torr}).
What volume will the helium occupy at standard : A cylinder of helium has a volume of 8.00 L. The pressure of the gas is 388 lb in-2 at 25C. What volume will the helium occupy at standard atmospheric pressure (14.7 lb in-2) assuming there is no temperature change?
What is the equilibrium partial pressure of so3 : at 900K the following reaction has kp=.345: 2SO2(g)+O2(g)-->2SO3(g) Partial pressures of SO2 is .150 and of O2 is .455. What is the equilibrium partial pressure of SO3?
Reverse the array, and find the largest element : find the max block of an array by splitting it into three parts: left, middle, right. And then reverse the array, and find the largest element.
What mass of methanol is likely to be produced : methanol, CH3OH can be produced through the reaction of CO and H2. if 75.o grams of CO is used and the typical yield is 79.8%, what mass of methanol is likely to be produced.
Describe why magnetic metals are found : Explain why magnetic metals are found only among the 3d and 4f elements. Why are Sc and Ti, which are also 3d elements, diamagnetic?
Write a complete java program assuming that the variables gp : Write a complete java program Assuming that the variables gpa, deanList and studentName have been declared, you should read in the studentName and gpa from keyboard. Write an if statement that adds 1 to deansList and prints studentName to the standar..
Compute the new temperature of the gas : A sample of CO2 gas at 795 torr is cooled from 25°C until the new pressure is 125 torr. Calculate the new temperature of the gas.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Classes and pointers experience using dynamic memory

To practice defining classes using separate compilation using classes, vectors, and pointers experience using dynamic memory.

  Write a program called word guessing game.

Write a program called Word Guessing Game. Open the file FourLetterWords.txt and write the contents into an array of Strings (the file has 87 words in it).

  Write java program to accept two words as input

Write a Java program that accepts two words as input and determines if one of them is resulting from changing the order of the others' letters.

  It should have an if statement

The following are hints given: It should have an if statement. This add method determines what number greater than or less than the other number, than it adds the positive or negative. I think this should be a private method.

  Write java program to find calories-conditional operator

Write down the answer for this program? Write down Java program (use Conditional (? Operator) which suggests number of calories a person must eat each day.

  Determine the type of moped

Write a driver class called MopedRental. This class should perform the following: asks the user to enter the size of the moped, the day of the week and the number of hours rented, creates the Moped object, based on the size, and displays the input..

  Method named isallvowels that returns

Write a method named isAllVowels that returns whether a String consists entirely of vowels (a, e, i, o, or u, case-insensitively). If every character of the String is a vowel, your method should return true. If any character of the String is a non-vo..

  Robot preparing for competition

Create an event so that the skateboard can be controlled by game player

  Write java program to read present basic hourly wage

Write down a java program which will input 1. Read present basic hourly wage. Read in workers fist name and socond name.

  Implementation the two classes

Program Specifications: In the new implementation, the two classes, Student and Grades, are defined with the following operations/methods.

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Implement the finite field gf

Write a program called "GF2.java" to implement the finite field GF(p n )where p is a prime number andn is a positive integer.You also need to write four methodsto realize.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd