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

how do I do ratio tables?​
How do you world war one affect American women
In this excerpt, Tyson conveys his complex ideas by
If Jessica split 75 pencils between 8 people in her class and kept the leftovers, how many pencils did each classmate get?
What letter represents straight hair?
joanne cannot decide which of two washing machines to buy. The selling price of each is ​$660. The first is marked down by ​40%. The second is marked down by ​3
Reading To Do, I-Ready evel F Why did the author include details about the cooking show he saw? He wants to describe various cooking methods. D He wants to expl
ellus What is the measure of z? 4 16 z X Z = ✓ [?]
List at least THREE reasons some of the African American representatives were determined to be unable to serve​
Solve the inequality for v. 5v-9> 66