1 Assume that s is a stack of MAXSIZE characters and stop is

1- Assume that s is a stack of MAX_SIZE characters and s_top is the subscript of the element at the top of the stack s. Perform the following sequence of operations. Draw the new stack after each operation if the operation changes the stack content. You must indicate where is the top of the stack.

2- Trace the selection sort on the following two lists. Show the arrays after each exchange occurs. Note: Your answers should be 2 figures like Figure 7.15 on Page 406.

3- Howmanyelementsdoesarraynumbershave? Show how to reference each element.

Solution

1) The stack will be:

(top of the stack)*

(top of the stack)# *

(top of the stack)*

3) There are 15 elements in array numbers.

1 element is accessed by b[0][0]
2 element is accessed by b[0][1]
3 element is accessed by b[0][2]
4 element is accessed by b[0][3]
5 element is accessed by b[0][4]
6 element is accessed by b[1][0]
7 element is accessed by b[1][1]
8 element is accessed by b[1][2]
9 element is accessed by b[1][3]
10 element is accessed by b[1][4]
11 element is accessed by b[2][0]
12 element is accessed by b[2][1]
13 element is accessed by b[2][2]
14 element is accessed by b[2][3]
15 element is accessed by b[2][4]

1- Assume that s is a stack of MAX_SIZE characters and s_top is the subscript of the element at the top of the stack s. Perform the following sequence of operat

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site