maljoh7655 maljoh7655
  • 03-01-2020
  • Computers and Technology
contestada

Give pseudocode for an algorithm that removes all negative values from an array, preserving the order of the remaining elements.

Respuesta :

Algorithm
Algorithm Algorithm
  • 05-01-2020

Answer:

Begin.

WRITE  ''enter test array''

READ test array

test [ ] = new_int [ ] { enter test array here, separated by comma}

int [ ] positives = Arrays.stream(test). filter(x -> x >= 0).toArray();

System. out. println( " Positive array");

for (int i : positives) {

      System.out.print(i+ "\t");  }

WRITE  positive array

End

Explanation

The pseudocode for the  alogirithm has been simplified above, it is implemented in Java 8

Answer Link

Otras preguntas

Distance between -3,-2 and 5,2
State the second law of thermodynamics in words and express it mathematically defining all terms. (6 marks)​
A solution has a pOH of 2.40. Find out its pH
How do you calculate distance traveled from a speed/time acceleration graph?
FREE BRAINLIEST IF CORRECT: Write the following without the absolute value sign: |a^2| if a>0
What is the graph of each function? 4. y = -x² - 6x - 11​
A cylinder has a diameter of 10 inches and a height four times its radius. What is its volume?
Use the information from the Example. Complete the steps to find how many grams as great the mass of one oxygen atom is than the mass of one hydrogen atom.(2.66
1. Given: LMN ~ QPR, find RQ.
Jordan has 28 golf balls. 28 golf balls in 4 rows and 7 columns. Of the 28 golf balls, 17 are yellow. How many golf balls are yellow?