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

Why are the Appalachian mountains smooth and rounded
THE AVERAGE DISTANCE FROM THE SUN TO VENUS IS 67,237,910 MILES. THE AVERAGE DISTANCE FROM THE SUN TO EARTH IS 92,955,807. WHICH STATMENT IS TRUE? A. THE VALUE O
how to write 20.65 in word form
is 7.031 greater than 7.03
An adult ticket to the zoo cost $20,and a child's ticket cost $10.how much will it cost for mr. And mrs.brown and their four children to get into the zoo?
1000-900+50 1000+50=150 Thats your answer
What is 110 mi/h converted to mi/day
What are the Factors of -18
Which is an equation for the given word problem? After Joel deposits $25.50 into his savings account, his balance is $275.00. Which equation can be used to find
The cafertia line was so crowded that I was _________ past the desserts before I could take one