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

Fritz drives to work his trip takes 36 ​minutes, but when he takes the train it takes 20 minutes. Find the distance Fritz travels to work if the train travels a
If Joan read 75 pages in 4 hours how long will it take her to read 250 pages
t is the midpoint of rq if r=12 t=-3 what is q
Which europeans had the most positive trading relationship with the native americans?
Individuals who have high self-esteem are most likely to
how to factor a(y-4) + t(y-4)
What major factor in the anti-apartheid movement in south africa and the civil rights movement in the united states runs counter to the idea in resource mobiliz
What is another name for infectious diseases? chronic diseases communicable diseases insulin-dependent diseases acute diseases
Northern humans are known by there Latin name?
A 62-year-old man suddenly experienced difficulty speaking and left-sided weakness. he meets initial criteria for fibrinolytic therapy, and a ct scan of the bra