对数时间:指算法的运行时间随输入规模 (n) 增长得很慢,通常记为 **(O(\log n))**。常见于每次操作都能把问题规模“减半/按比例缩小”的过程(如二分查找、平衡二叉搜索树的查找/插入)。
/ˌlɑːɡəˈrɪðmɪk taɪm/
Binary search runs in logarithmic time on a sorted array.
二分查找在有序数组上以对数时间运行。
Because the tree stays balanced, each lookup takes logarithmic time even as the dataset grows to millions of records.
由于树保持平衡,即使数据增长到数百万条记录,每次查找仍只需要对数时间。
logarithmic 来自 logarithm(对数),而 logarithm 源于希腊语成分:logos(比例、计算)+ arithmos(数)。在计算机科学中,“logarithmic time” 用来强调:复杂度随规模增长呈“对数级”,增长速度远慢于线性时间。