















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
⩥ What principle does a Queue data structure follow? Answer: First In First Out (FIFO) ⩥ What operation in a Stack inserts an element at the top? Answer: push(e) ⩥ What operation in a Stack removes the topmost element? Answer: pop() ⩥ What operation in a Queue inserts an element at the rear? Answer: enqueue(e) ⩥ What operation in a Queue removes and returns the front element? Answer: dequeue() ⩥ What operation in a Deque inserts an element at the front? Answer: addFirst(e)
Typology: Exams
1 / 23
This page cannot be seen from the preview
Don't miss anything!
















⩥ What principle does a Queue data structure follow? Answer: First In First Out (FIFO) ⩥ What operation in a Stack inserts an element at the top? Answer: push(e) ⩥ What operation in a Stack removes the topmost element? Answer: pop() ⩥ What operation in a Queue inserts an element at the rear? Answer: enqueue(e) ⩥ What operation in a Queue removes and returns the front element? Answer: dequeue() ⩥ What operation in a Deque inserts an element at the front? Answer: addFirst(e)
⩥ What operation in a Deque removes and returns the last element? Answer: removeLast() ⩥ What is the time complexity of the push() operation in an Array-based Stack? Answer: O(1) ⩥ What is the time complexity of the pop() operation in an Array-based Stack? Answer: O(1) ⩥ What is the time complexity of the enqueue() operation in a Circular Queue? Answer: O(1) ⩥ What is the time complexity of the dequeue() operation in a Circular Queue? Answer: O(1) ⩥ What operation checks if a Stack is empty? Answer: isEmpty() ⩥ What operation checks if a Queue is empty? Answer: isEmpty() ⩥ What is the memory usage of an Array-based Stack with n elements? Answer: O(n) ⩥ What happens when you push onto a full Array-based Stack? Answer: An exception is thrown.
⩥ What data structure allows inserting and deleting data elements at both the front and the rear? Answer: Deque ⩥ Which data structure can function both as a stack and a queue? Answer: Deque ⩥ What is the time complexity of the size() operation in a Stack? Answer: O(1) ⩥ What does the top() operation in a Stack do? Answer: Returns the top element without removing it. ⩥ What is the time complexity of the size() operation in a Queue? Answer: O(1) ⩥ What operation in a Queue returns the element at the front without removing it? Answer: front() ⩥ What is the main drawback of using an Array-based Queue implementation? Answer: Limited size. ⩥ What principle does a Stack data structure follow? Answer: Last In First Out (LIFO)
⩥ What principle does a Queue data structure follow? Answer: First In First Out (FIFO) ⩥ What operation in a Stack inserts an element at the top? Answer: push(e) ⩥ What operation in a Stack removes the topmost element? Answer: pop() ⩥ What operation in a Queue inserts an element at the rear? Answer: enqueue(e) ⩥ What operation in a Queue removes and returns the front element? Answer: dequeue() ⩥ What operation in a Deque inserts an element at the front? Answer: addFirst(e) ⩥ What operation in a Deque removes and returns the last element? Answer: removeLast() ⩥ What is the time complexity of the push() operation in an Array-based Stack? Answer: O(1)
⩥ What is a primary advantage of using a Singly Linked List to implement a Stack? Answer: Dynamic sizing. ⩥ What is a primary advantage of using a Singly Linked List to implement a Queue? Answer: Dynamic sizing without needing to set a maximum size. ⩥ What is the main use of a Deque in computer systems? Answer: Managing history in web browsers and implementing undo operations. ⩥ What is the primary memory concern when using a Doubly Linked List compared to a Singly Linked List? Answer: A Doubly Linked List uses more memory due to storing two pointers per node. ⩥ What operation in a Deque retrieves but does not remove the first element? Answer: first() ⩥ What is the time complexity of all operations in a Deque implemented with a Doubly Linked List? Answer: O(1) ⩥ What data structure allows inserting and deleting data elements at both the front and the rear? Answer: Deque ⩥ Which data structure can function both as a stack and a queue? Answer: Deque
⩥ What is the time complexity of the size() operation in a Stack? Answer: O(1) ⩥ What does the top() operation in a Stack do? Answer: Returns the top element without removing it. ⩥ What is the time complexity of the size() operation in a Queue? Answer: O(1) ⩥ What operation in a Queue returns the element at the front without removing it? Answer: front() ⩥ What is the main drawback of using an Array-based Queue implementation? Answer: Limited size. ⩥⩥ What principle does a Queue data structure follow? Answer: First In First Out (FIFO) ⩥ What operation in a Stack inserts an element at the top? Answer: push(e) ⩥ What operation in a Stack removes the topmost element? Answer: pop()
⩥ What operation checks if a Stack is empty? Answer: isEmpty() ⩥ What operation checks if a Queue is empty? Answer: isEmpty() ⩥ What is the memory usage of an Array-based Stack with n elements? Answer: O(n) ⩥ What happens when you push onto a full Array-based Stack? Answer: An exception is thrown. ⩥ What is the key advantage of using a Circular Queue over a normal Array-based Queue? Answer: It avoids the need to shift elements by wrapping indices around the end of the array. ⩥ What is a primary advantage of using a Singly Linked List to implement a Stack? Answer: Dynamic sizing. ⩥ What is a primary advantage of using a Singly Linked List to implement a Queue? Answer: Dynamic sizing without needing to set a maximum size. ⩥ What is the main use of a Deque in computer systems? Answer: Managing history in web browsers and implementing undo operations.
⩥ What is the primary memory concern when using a Doubly Linked List compared to a Singly Linked List? Answer: A Doubly Linked List uses more memory due to storing two pointers per node. ⩥ What operation in a Deque retrieves but does not remove the first element? Answer: first() ⩥ What is the time complexity of all operations in a Deque implemented with a Doubly Linked List? Answer: O(1) ⩥ What data structure allows inserting and deleting data elements at both the front and the rear? Answer: Deque ⩥ Which data structure can function both as a stack and a queue? Answer: Deque ⩥ What is the time complexity of the size() operation in a Stack? Answer: O(1) ⩥ What does the top() operation in a Stack do? Answer: Returns the top element without removing it.
⩥ What operation in a Queue removes and returns the front element? Answer: dequeue() ⩥ What operation in a Deque inserts an element at the front? Answer: addFirst(e) ⩥ What operation in a Deque removes and returns the last element? Answer: removeLast() ⩥ What is the time complexity of the push() operation in an Array-based Stack? Answer: O(1) ⩥ What is the time complexity of the pop() operation in an Array-based Stack? Answer: O(1) ⩥ What is the time complexity of the enqueue() operation in a Circular Queue? Answer: O(1) ⩥ What is the time complexity of the dequeue() operation in a Circular Queue? Answer: O(1) ⩥ What operation checks if a Stack is empty? Answer: isEmpty() ⩥ What operation checks if a Queue is empty? Answer: isEmpty()
⩥ What is the memory usage of an Array-based Stack with n elements? Answer: O(n) ⩥ What happens when you push onto a full Array-based Stack? Answer: An exception is thrown. ⩥ What is the key advantage of using a Circular Queue over a normal Array-based Queue? Answer: It avoids the need to shift elements by wrapping indices around the end of the array. ⩥ What is a primary advantage of using a Singly Linked List to implement a Stack? Answer: Dynamic sizing. ⩥ What is a primary advantage of using a Singly Linked List to implement a Queue? Answer: Dynamic sizing without needing to set a maximum size. ⩥ What is the main use of a Deque in computer systems? Answer: Managing history in web browsers and implementing undo operations. ⩥ What is the primary memory concern when using a Doubly Linked List compared to a Singly Linked List? Answer: A Doubly Linked List uses more memory due to storing two pointers per node.
⩥ What is the main drawback of using an Array-based Queue implementation? Answer: Limited size. ⩥ What principle does a Stack data structure follow? Answer: Last In First Out (LIFO) ⩥ What principle does a Queue data structure follow? Answer: First In First Out (FIFO) ⩥ What operation in a Stack inserts an element at the top? Answer: push(e) ⩥ What operation in a Stack removes the topmost element? Answer: pop() ⩥ What operation in a Queue inserts an element at the rear? Answer: enqueue(e) ⩥ What operation in a Queue removes and returns the front element? Answer: dequeue() ⩥ What operation in a Deque inserts an element at the front? Answer: addFirst(e)
⩥ What operation in a Deque removes and returns the last element? Answer: removeLast() ⩥ What is the time complexity of the push() operation in an Array- based Stack? Answer: O(1) ⩥ What is the time complexity of the pop() operation in an Array- based Stack? Answer: O(1) ⩥ What is the time complexity of the enqueue() operation in a Circular Queue? Answer: O(1) ⩥ What is the time complexity of the dequeue() operation in a Circular Queue? Answer: O(1) ⩥ What operation checks if a Stack is empty? Answer: isEmpty() ⩥ What operation checks if a Queue is empty? Answer: isEmpty() ⩥ What is the memory usage of an Array-based Stack with n elements? Answer: O(n) ⩥ What happens when you push onto a full Array-based Stack? Answer: An exception is thrown.
⩥ What data structure allows inserting and deleting data elements at both the front and the rear? Answer: Deque ⩥ Which data structure can function both as a stack and a queue? Answer: Deque ⩥ What is the time complexity of the size() operation in a Stack? Answer: O(1) ⩥ What does the top() operation in a Stack do? Answer: Returns the top element without removing it. ⩥ What is the time complexity of the size() operation in a Queue? Answer: O(1) ⩥ What operation in a Queue returns the element at the front without removing it? Answer: front() ⩥ What is the main drawback of using an Array-based Queue implementation? Answer: Limited size. ⩥ What principle does a Stack data structure follow? Answer: Last In First Out (LIFO)
⩥ What principle does a Queue data structure follow? Answer: First In First Out (FIFO) ⩥ What operation in a Stack inserts an element at the top? Answer: push(e) ⩥ What operation in a Stack removes the topmost element? Answer: pop() ⩥ What operation in a Queue inserts an element at the rear? Answer: enqueue(e) ⩥ What operation in a Queue removes and returns the front element? Answer: dequeue() ⩥ What operation in a Deque inserts an element at the front? Answer: addFirst(e) ⩥ What operation in a Deque removes and returns the last element? Answer: removeLast() ⩥ What is the time complexity of the push() operation in an Array- based Stack? Answer: O(1)