and Algorithms I Knowledge test Exam
Toolkit Questions and Verified Marking
Scheme 2024/2025
What are LinkedList class' two data members? - correct
answer Head and tail
In a circular doubly-linked list with at least 2 nodes, where does
the head node's previous pointer point to? - correct answer
Tail
T or F: In a circular linked list with 1 node, the tail node's next
pointer points to the tail. - correct answer True
T or F: The Stack class has both a LinkedList and Node data
member. - correct answer False. Only has a LinkedList data
member.
The Stack class' push() method uses the LinkedList ____ method
to place elements on a stack. - correct answer prepend()
T or F: The Stack class's push() method takes a Node as a
parameter. - correct answer False.
The push() method takes an int, not a Node, as a parameter. The
method creates a new node, whose data is the integer parameter,
and inserts the node into the linked list.
, Sorting algorithms that can be adapted for linked lists? -
correct answer Insertion sort, merge sort
Sorting algorithms that dont work well for linked lists? -
correct answer Shell sort, quicksort, heap sort
What aspect of linked lists makes adapting array-based sorting
algorithms to linked lists difficult? - correct answer Elements
in a linked list cannot be accessed by index.
Which sorting algorithm uses a gap value to jump between
elements, and is difficult to adapt to linked lists for this reason? -
correct answer Shell sort
Why are sorting algorithms for arrays generally more difficult to
adapt to singly-linked lists than to doubly-linked lists? - correct
answer Singly-linked lists do not support backward traversal.
The current node to be sorted is placed _____ the location
returned by find_insertion_position(). - correct answer after
The insertion_sort_singly_linked() method would also sort a
doubly-linked list. - correct answer False.
doubly-linked does not have the remove_after() method.
Singly-linked list insertion sort variant:
The current node to be sorted is placed _____ the location
returned by find_insertion_position(). - correct answer after