complete solutions
Which of the following does not need to be checked when inserting an element into a simple linear list: -
correct answer ✔✔is list empty
Which is true for a contiguous list? - correct answer ✔✔it doesn't have any 'holes' (the only blank cells, if
any, are at the very end of the array)
In a typical linear list setup: - correct answer ✔✔f you want to show the elements you need to set up a
for loop
When inserting an element in the middle of the list the following needs to be done (not necessarily in
this order):
1) check if list is full and insert index valid
2) update the count
3) place the new element in the array
4) move the elements from insert index one cell up
What is a possible correct order of these operations? - correct answer ✔✔1,4,3,2
Silent error reporting: - correct answer ✔✔enables the main program (calling the error-detecting
function ) to handle the error as it sees fit
, What typically happens when the last element of a queue is in the MAX array cell, and we need to add
yet another element? - correct answer ✔✔place the new element in array cell [1]
To properly advance through all elements of a queue (e.g. to show them) we will most likely employ a(n):
- correct answer ✔✔while loop in which we handle the index change abstractly (e.g. via next_ix ()
function)
In a queue when the last_ix (pointing to the last element added to the queue), comes up right behind
the first_ix (e.g. last_ix == first_ix-1), this is an indication that the queue is: - correct answer ✔✔full
In our parentheses checking program which of the following errors cannot be detected in the scanner
loop? - correct answer ✔✔Too many open parentheses
Which of the static data structures we covered employs two indexes: - correct answer ✔✔queue
Evaluate the following postfix expression:
4 5 + 7 2 - * - correct answer ✔✔45
If the above was evaluated via stack, what would be the final two elements on the stack before the final
result was evaluated? - correct answer ✔✔9,5
Convert A * (B + C) + D * E to postfix notation. - correct answer ✔✔A B C + * D E * +
For expression such as this :
12+3^14-2
in order to convert it to postfix to perform stack calculation, we need the following extension to the basic
algorithm (your homework). - correct answer ✔✔add exponentiation operation
introduce extra parentheses before conversion to postfix