4.8k views
2 votes
The sequence's insert member function normally puts a new item before the current item. What should insert do if there is no current item?A) The insert precondition is violated.B) The new item is put at the beginning of the sequence.C) The new item is put at the end of the sequence.D) None of the above.

User NathanPB
by
5.5k points

1 Answer

5 votes

Answer:

B) The new item is put at the beginning of the sequence

Step-by-step explanation:

The stack data structure is an example of the type for insert method as the current items are replaced at the top by a new item and the previous items move down the stack. If there no current item in the stack, the new item is put in the first index (beginning point) of the stack data structure.

User Ryan Naccarato
by
5.0k points