Question: Assume you are given a singly connected linked list. The first node is pointed by a pointer head. Each node v has a pointer v
Assume you are given a singly connected linked list. The first node is pointed by a pointer head. Each node v has a pointer v rightarrow next, pointing to the next node. The last node's next pointer pointed points to NULL. There are n nodes in the list. We run the following code while (head rightarrow next notcongruent NULL AND head rightarrow next rightarrow next notcongruent NULL) { p = head: while (p rightarrow next notequalto NULL AND p rightarrow next rightarrow next notequalto NULL) { p rightarrow next = p rightarrow next rightarrow next: p = p rightarrow next: } } What is its asymptotic running time, as a function of n? You should use (), ohm() and Theta() in your
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
