English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Using an ARRAY BASED Implementation, how do write a function that will accept a queue of
any length and convert it to a stack. When the stack is returned to the main program, the
front of the queue is the top of the stack, and the rear of the queue is the base of the stack.
In addition, the queue must remain unchanged

2007-02-07 02:14:36 · 1 answers · asked by whowantit32 1 in Computers & Internet Programming & Design

everything is BASED OFF an array.

2007-02-07 03:25:29 · update #1

1 answers

Everything uses only array?

public Object[] poo(Object[] all) {
Object[] result = new Object[all.length];
for (int x = 0; x < all.length; x++) result[all.length - 1 -x] = all[x];
return result;
}

2007-02-07 02:27:13 · answer #1 · answered by Andy T 7 · 0 0

fedest.com, questions and answers