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

Which lung structure is a tiny sac that functions as an interface for gas exchange between air and blood?
God gave these miracles to Moses as signs to Israel and to Pharaoh: changing his rod to a serpent and back to his rod making his hand leprous and whole again ch
Global marketers typically find distribution in developing countries is more complex because
For cognitive abilities, genes and the environment play what level of role
A friendly letter should generally contain at least _____ paragraphs. one three eight ten
Characters, dialogue, props, and other elements of drama work together to create an illusion of reality. What is this illusion called? 1. comedy 2. mag
what is the prefix suffix and root of sociology
Read the excerpt below from Antigone by Sophocles and answer the question that follows. ANTIGONE: Most of them have perished—Persephone has welcomed them among
How do product characteristics influence packaging and materials handling considerations?
.   Multiply (x + 3)(x – 3).        A. x2 + 6x – 9   B. x2 + 6x + 9   C. x2 – 9   D. x2 – 6x + 9 help some says its C and some says its not