WGU C950 TASK 2 WGUPS WRITE-UP
COMPLETE SOLUTION GUIDE UPDATED
2026
⩥ 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 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)
COMPLETE SOLUTION GUIDE UPDATED
2026
⩥ 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 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)