题目
题目

FIT1008-FIT1054-FIT2085 Fundamentals of algorithms - S2 2025

单项选择题

Consider an implementation of a hash table with linear probing where the hash function runs in constant time and the cost of comparison is also constant. What is the best-case time complexity of the __getitem__ method? Consider n is the number of items in the hash table.

选项
A.a. O(log n)
B.b. O(n)
C.c. O(n2)
D.d. O(1)
题目图片
查看解析

查看解析

标准答案
Please login to view
思路分析
To approach this question, I’ll evaluate the time complexity of a hash table lookup under linear probing when certain operations are constant. Option a: O(log n). This would imply that the get operation grows logarithmically with the number of items. In a well-designed hash table with constant-time hash function and constant-time comparisons, lookups do not require traversing data in a way that s......Login to view full explanation

登录即可查看完整答案

我们收录了全球超50000道考试原题与详细解析,现在登录,立即获得答案。

类似问题

更多留学生实用工具

加入我们,立即解锁 海量真题独家解析,让复习快人一步!