andreepviviano andreepviviano
  • 04-03-2017
  • Computers and Technology
contestada

Write an algorithm in pseudocode or english that would describe how to use a stack to reverse any list.

Respuesta :

padawan
padawan padawan
  • 04-03-2017
int data[n];
int rev[n];

for (i=0; i < n; i++)
     stack.push(data[n]);
for (i=0; i <n; i++)
     rev[i] = stack.pop();

Answer Link

Otras preguntas

When do we celebrate Independence Day?
One beneficial use of radioisotopes is (1) detection of disease (2) neutralization of an acid spill (3) decreasing the dissolved O2(g) level in seawater (4) inc
When a sample of a gas is heated in a sealed, rigid container from 200. K to 400. K, the pressure exerted by the gas is (1) decreased by a factor of 2. (2) incr
Given the balanced equation representing a reaction: 4Al(s) + 3O2(g) ==> Al2O3(s) As the aluminum loses 12 moles of electrons, the oxygen (1) gains 4 moles o
Which formula represents an organic compound? ( l) CaH2 (3) H2O2 (2) C4H8 (4) P2O5
Under our Constitution, some powers belong to the federal government. What is one power of the federal government?
Who was President during World War I?
A triangle has two sides of length 6 and 9. What could the length of the third side be? Check all that apply, A. 10 B. 7 C.4 D.2 E.15 F.12
The Federalist Papers supported the passage of the U.S. Constitution. Name one of the writers.
Equal amounts or ethanol and water are mixed at room temperature and at 101.3 kPa. Which process is used to separate ethanol from the mixture? (1) distillation