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

Tasha earns $400 per week plus a commission of 10% on her weekly sales. Each week she saves of her earnings. In the expression , what does the expression 400 +
How many molecules are present in 1.75 moles of carbon dioxide?
I have to write the following expression in simplest form 7p-1-9p+5
Read this topic sentence: Exercise is important to one's physical and mental health. Which piece of supporting evidence would best support the topic sentence?
What are the 3 part of the monomer
Rank the following salaries or wages from smallest to largest. A grocery store clerk A famous professional athlete A teacher The president of a small company
In French, the expression huit jours refers to a week. Quinze hours refers
The volume of a rectangular prism with a square base can be written as V = s² x h where V is the volume, s is one side of the square base, and h is the height.
U.S Olympic medalists must pay victory tax
How many cups in 2 gallons