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

What human body system could be most easily fossilized?
Is 4/9 greater than 1/3
is 14.5% equivalent to the decimal 14.5
when a large animals eats a plant eater what does it get
What is the LCD of 11/12 and 1/8?
Fred bought 6 new baseball trading cards to add to his collection. The next day his dog ate half of his collection. There are now only 29 cards left. How many c
The box office took in a total of $2905 in paid admissions for the high-school musical. Adult tickets cost $8 each, and student tickets cost $3 each. If 560 peo
Derive the equation of the parabola with a focus at (−5, 5) and a directrix of y = -1.
I'am thinking of two numbers. The difference of the two numbers is 36. Their sum is 286. What are the two numbers?
Another question... this was all the information I was given and I'm a tad confused as to how to go about solving it... help please??? Thank you so much!!! Juli