Question

1. When implementing a stack on an array, where is a new item added? Select one:...

1. When implementing a stack on an array, where is a new item added?

Select one:

a. At index 0 and the rest of the stack is moved up.

b. The next available slot (index n when there are already n items).

c. The next available slot (index n+1 when there are already n items).

d. The end of the array.

2. When implementing a queue on an array, consider one item already in in the queue. What happens to it when a new item is added or deleted?

Select one:

a. Nothing, it stays in the same index in the array.

b. It moves to a higher array index when items are added.

c. It moves to a higher array index when items are deleted.

d. It moves to a lower array index when items are added.

3.

The term priority in priority queue means that

Select one:

a. the highest priority items are inserted first

b. the programmer must prioritize access to the underlying array

c. the underlying array is sorted by the priority of the items

d. the lowest priority items are deleted first

0 0
Add a comment Improve this question Transcribed image text
Answer #1
1)  b. The next available slot (index n when there are already n items).
2)  b. It moves to a higher array index when items are added.
3)  c. the underlying array is sorted by the priority of the items

Add a comment
Know the answer?
Add Answer to:
1. When implementing a stack on an array, where is a new item added? Select one:...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Lab 3 – Array-Based Stack and Queue Overview In this assignment, you will be implementing your...

    Lab 3 – Array-Based Stack and Queue Overview In this assignment, you will be implementing your own Array-Based Stack (ABS) and Array-Based Queue (ABQ). A stack is a linear data structure which follows the Last-In, First-Out (LIFO) property. LIFO means that the data most recently added is the first data to be removed. (Imagine a stack of books, or a stack of papers on a desk—the first one to be removed is the last one placed on top.) A queue...

  • Where does top point, when implementing a stack with a LLL? Queue ADT: 1· 2. Where...

    Where does top point, when implementing a stack with a LLL? Queue ADT: 1· 2. Where does front point, when implementing a queue with a LLL? Where does rear point, when implementing a queue with a LLL? Where does rear point, when implementing a queue with a CLL? a. b. c. 3. If you were to enqueue 10, 20, and 30 onto a queue in this order and then dequeue them off, in what order will they be removed from...

  • 11.) Suppose you have a linked list of Node objects from the Textbook Collections Framework and...

    11.) Suppose you have a linked list of Node objects from the Textbook Collections Framework and currentNode has been initialized to refer to the head node in the list. Which of these statements needs to appear in a loop that goes through the list's items one-by-one? Select one: a. currentNode++ b. currentNode = currentNode.next c. currentNode = previous() d. currentNode += 1 e. currentNode = next() 12.) A singly linked node contains which of these fields? Select one: a. data...

  • help me answer the following questions please 1. Stack (LIFO) & its application 1. Stack overflow...

    help me answer the following questions please 1. Stack (LIFO) & its application 1. Stack overflow & underflow 2. Implementation: partially filled array & linked list 3. Applications: reverse string, backtracking Exercises: 1) Which of the following applications may use a stack? A. parentheses balancing program. B. Keeping track of local variables at run time. C. Syntax analyzer for a compiler. D. All of the above. 2) Consider the usual algorithm for determining whether a sequence of parentheses is balanced....

  • Where are intermediate values stored when a recursive function is recursing? Select one: a. system stack...

    Where are intermediate values stored when a recursive function is recursing? Select one: a. system stack b. random memory c. heap d. data segment of memory

  • In c++ Section 1. Stack ADT – Overview  Data Items The data items in a stack...

    In c++ Section 1. Stack ADT – Overview  Data Items The data items in a stack are of generic DataType. This means use should use templating and your Node class. Structure  The stack data items are linearly ordered from the most recently added (the top) to the least recently added (the bottom). This is a LIFO scheme. Data items are inserted onto (pushed) and removed from (popped) the top of the stack.  Operations  Constructor. Creates an empty stack.  Copy constructor....

  • C++ LAB 19 Construct functionality to create a simple ToDolist. Conceptually the ToDo list uses a...

    C++ LAB 19 Construct functionality to create a simple ToDolist. Conceptually the ToDo list uses a structure called MyToDo to hold information about each todo item. The members of the MyToDo struct are description, due date, and priority. Each of these items will be stored in an array called ToDoList. The definition for the MyToDo struct should be placed in the header file called ToDo.h Visually think of the ToDoList like this: There are two ways to add items to...

  • Please Write Pseudocode or Python code! Thanks! P1. b) is the following: W1. (6 marks) Write...

    Please Write Pseudocode or Python code! Thanks! P1. b) is the following: W1. (6 marks) Write the pseudocode for removing and returning only the second element from the Stack. The top element of the Stack will remain the top element after this operation. You may assume that the Stack contains at least two items before this operation. (a) Write the algorithm as a provider implementing a Stack using a contiguous memory implementation. You can refer to the implementation given in...

  • Hello, I have some errors in my C++ code when I try to debug it. I...

    Hello, I have some errors in my C++ code when I try to debug it. I tried to follow the requirements stated below: Code: // Linked.h #ifndef INTLINKEDQUEUE #define INTLINKEDQUEUE #include <iostream> usingnamespace std; class IntLinkedQueue { private: struct Node { int data; Node *next; }; Node *front; // -> first item Node *rear; // -> last item Node *p; // traversal position Node *pp ; // previous position int size; // number of elements in the queue public: IntLinkedQueue();...

  • When outputting the path found in the proposed program, the direction of movement is output. Howe...

    When outputting the path found in the proposed program, the direction of movement is output. However, the direction of movement to the last movement, EXIT, is not output. To print this out, please describe how to modify the proposed program. #include <stdio.h> #define NUM_ROWS 5 #define NUM_COLS 3 #define BOUNDARY_COLS 5 #define MAX_STACK_SIZE 100 #define FALSE 0 #define TRUE 1 ​ ​ ​ typedef struct { short int row; short int col; short int dir; } element; ​ element stack[MAX_STACK_SIZE];...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT