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

What is the range of the given function? {(–2, 0), (–4, –3), (2, –9), (0, 5), (–5, 7)}
Explain, in terms of Newton’s Laws of Motion, why it is important to wear your seatbelt. Please, if you can just tell me which law I can take it from there.
Geometry math question no Guessing and Please show work thank you
Find the sum which amounts to Rs 9261 at 10% per annum compound interest for 18 months ,interest payable half yearly
What is the point-slope equation of the line? Help me please):
plot the given point in a rectangular coordinate system (3,0)
Which summation formula represents the series below?
how many moles of calcuim oxide are needed to react with an excess of water to form 370g of calcuim hydroxide
Grandma Gertrude gave 13 pieces of jewelry and Grandma Fien gave y pieces of jewelry to the Carlson sisters to divide evenly among themselves. There are 5 Carls
Use substitution to combine equations. Rewrite so that one side is equal to 0.