We have a contains() function in LazyList for concurrent datastructures which checks whether a particular item is contained inthe linked list and returns false if the matching node is marked asdeleted. The code for the same is given below:
bool LazyList:: contains (T * item)
{ Node * curr = head;
while (curr -> key < item ->key)
curr = curr ->next;
return current->key == item-> key &&!curr->marked
}
Write a contains() function for Concurrent Lists with FineGrained synchronization.
Expert Answer
An answer will be send to you shortly. . . . .