cmsc 132 runtime stuff(Correctly solved)
What is the average runtime for adding an element to the end of a singly linked list with a tail reference? correct answers O(1) What is the worst-case runtime for removing an element from a singly linked list if you are given a cursor to the node containing that element? correct answers O(n) What is the best-case runtime for adding an element to the end of a singly linked list with NO tail reference? correct answers O(n) What is the average runtime for searching a doubly linked list? correct answers O(n) What is the average runtime for adding an element to the head of a singly linked list? correct answers O(1) Search of a well balanced binary search tree (average case) correct answers O(logn) search on a binary search tree (worst case) correct answers O(n) search on a hash table with uniformly distributed elements (average case) correct answers O(1) accessing an element of an array by index number (worst case) correct answers O(1) accessing an element of a linked list by index number (average case) correct answers O(n) insert an element into an array at a given index (average case) correct answers O(n) Insert at the head of a linked list (Worst case) correct answers O(1) add element to.a heap (worst case) correct answers O(logn) remove at tail of doubly linked list (worst case) correct answers O(1) remove at tail of linked list while maintaining tail element (average case) correct answers O(n) Which is better for accessing an element at index i? correct answers array Which is better for performing a binary search (when already sorted)? correct answers array Which is better for inserting at the front of the list? correct answers linked list Which is better for inserting at index i? correct answers both array & linked list are O(n)
Document information
- Uploaded on
- May 29, 2024
- Number of pages
- 1
- Written in
- 2023/2024
- Type
- Exam (elaborations)
- Contains
- Questions & answers