Q9_40_20250728130302.webp
G

Q9_40_20250728130302.webp

☑Kizspy.me
Answer (Choose 1 answer)
☐ A
Back
Next
FUQ.sh
sh the exam.
Consider the function below that operates on a singly linked list with n nodes:
class Node:
def __init__(self, data):
self.data = data
self.next=None
def fn(head):
slow = head
fast = head
while fast is not None and fast.next is not None:
slow
fast
slow.next
fast.next.next
return slow.data
What does the fn() function do, and what is its time complexity?
A. It finds the middle node of the linked list in O(n) time.
B. It finds the middle node of the linked list in O(logn) time.
C. It finds the length of the linked list in O(n) time.
D. It finds the middle node of the linked list in O(n2) time.

Thông tin

Category
CSD203
Thêm bởi
gentle_rain
Ngày thêm
Lượt xem
1,086
Lượt bình luận
6
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom