Answer to Question #281709 in Python for xxx

Question #281709

8 How many nodes are  searched in the worst case when the search() method is called on a Linked List?

A Searching a Linked List is done in O(log n) time because you can use tree search

B One of the benefits of a Linked List is that it can be searched in constant time

C In the worst case, the method returns an error if the data to search for is not found

D In the worst case, the data to be found is the last node of the Linked List, so all the nodes must be searched

 

9 The remove() method we coded in the course removes _________

A All occurences of nodes containing the data to be removed

B Only the last occurrence of a node containing the data to be removed

C The first Occurrence of a node containing the data to be removed

 

10 The size() and search() mthods of the Doubly-Linked List are the same as the size() and search() methods for the Singly-Linked List

A True

B False


1
Expert's answer
2021-12-21T06:15:55-0500
  1. In all three cases the methods, in the worst case, scan all the nodes in a linked list, making their complexity class O (N). For all these methods, we assume that they are declared in a class with a front instance variable. Generally, there will be a special case for removing nodes at the front of the list. So the answer is D.
  2. A.
  3.  False

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS