Question

Java Program: Write an algorithm (steps) using pseudocode (no java code required) explaining steps for a...

Java Program:

Write an algorithm (steps) using pseudocode (no java code required) explaining steps for a method which will reverse an integer array (Integer[]) without using any other data structure. The method should return the reversed integer array.

E.g. If input array Integer[] integers = [1,2,3,4,5,6] should return [6,5,4,3,2,1]

0 0
Add a comment Improve this question Transcribed image text
Answer #1
algorithm:
-----------
int[] reverse(int[] input)
    int reversedArray[input.length]
    for(i = 0;i<input.length;i++)
        reversedArray[input.length-i-1] = input[i];
    end
    return reversedArray
end

Please upvote the solution if it helped. Thanks!

Note: Please comment below if you have any doubts

Add a comment
Know the answer?
Add Answer to:
Java Program: Write an algorithm (steps) using pseudocode (no java code required) explaining steps for a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • java pseudocode and source code help? Write a program that uses an array of high temperatures...

    java pseudocode and source code help? Write a program that uses an array of high temperatures for your hometown from last week (Sunday - Saturday). Write methods to calculate and return the lowest high temperature (minimum) and a method to calculate and return the highest high temperature (maximum) in the array. You must write YOUR ORIGINAL methods for minimum and maximum. You MAY NOT use Math class methods or other library methods. Write an additional method that accepts the array...

  • Write a program in Java that performs the Counting Sort algorithm. a) Create the countingSort method....

    Write a program in Java that performs the Counting Sort algorithm. a) Create the countingSort method. Use the pseudocode shown in the lecture. b) Test your codes by writing a program that uses the following input array: int[] array_A = {6, 0, 2, 0, 1, 3, 4, 6, 1, 3, 2}; c) Your output should display the following versions of the arrays: I. The original input array A II. The counting array C after the counting (lines 4-5 in pseudocode)...

  • Write a Java program with a single-dimension array that holds 11 integer numbers and sort the...

    Write a Java program with a single-dimension array that holds 11 integer numbers and sort the array using a bubble sort. Next, identify the median value of the 11 integers. Here are the steps your program must accomplish. algorithm (either flowchart or pseudocode) that you will use to write the program Step 1. Create an Place the algorithm in a Word document. 6. Ste the Step 2. Code the program in Eclipse and ensure the following steps are accomplished. 1....

  • 9.10: Reverse Array Write a function that accepts an int array and the array’s size as arguments

    9.10: Reverse Array Write a function that accepts an int array and the array’s size as arguments. The function should create a copy of the array, except that the element values should be reversed in the copy. The function should return a pointer to the new array. Demonstrate the function by using it in the main program that reads an integer N  (that is not more than 50) from standard input and then reads N  integers from a file named...

  • Do pseudocode in java Design (pseudocode) and implement (source code) a program (name it LargestOccurenceCount) that...

    Do pseudocode in java Design (pseudocode) and implement (source code) a program (name it LargestOccurenceCount) that read from the user positive non-zero integer values, finds the largest value, and counts it occurrences. Assume that the input ends with number 0 (as sentinel value to stop the loop). The program should ignore any negative input and should continue to read user inputs until 0 is entered. The program should display the largest value and number of times it appeared as shown...

  • Using your choice of Pseudocode, C# or Java write a program that displays the sum of...

    Using your choice of Pseudocode, C# or Java write a program that displays the sum of all of the even elements in a 3x3 matrix (e.g., a 2D array). If there is no such number in the matrix it will display 0.

  • java code Write a method called reverse that takes an array of integers as an input...

    java code Write a method called reverse that takes an array of integers as an input and returns the same values in reverse order as the output. Test your method in the main.

  • Need help answering the following using java 2a. Write a java program (just a “void main”)...

    Need help answering the following using java 2a. Write a java program (just a “void main”) that will reverse the digits of a user entered, positive three-digit number. You can assume the user enters an integer. Your code segment should first verify that the user has entered a number from 100 to 999 (error message if not). If the user has entered a three-digit number, output a new number with the original digits reversed. 2b. Instead of being limited to...

  • use java and write in text a. Rewrite the following code segment using if statements. Assume...

    use java and write in text a. Rewrite the following code segment using if statements. Assume that grade has been declared as of type char. char grade= 'B';; switch (grade) { case 'A': System.out.println("Excellent"); break case 'B': System.out.println("Good"); default: System.out.println("you can do better”); } - b. write Java code that inputs an integer and prints each of its digit followed by ** e.gif the integer is 1234 then it should print 1**2**3**4 e.g. if the integer is 85 then it...

  • C# ONLY INCLUDE BOTH PSUDEO CODE AND SOURCE CODE!!!! Design (pseudocode) and implement (source code) a...

    C# ONLY INCLUDE BOTH PSUDEO CODE AND SOURCE CODE!!!! Design (pseudocode) and implement (source code) a program (name it IndexOfLargest) to find the index of the first largest value in the array. Note that the largest value may appear more than once in the array. The program main method defines a single-dimensional array of size 10 elements and prompts the user to enter 10 integers to initialize the array. The main method then calls method findIndex() that takes a single-dimensional...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT