Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f9715de

Browse files
Merge pull request SharingSource#34 from SharingSource/ac_oier
✨feat: Modify 451
2 parents 91d0571 + 152a318 commit f9715de

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎LeetCode/451-460/451. 根据字符出现频率排序(中等).md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class Solution {
9595
}
9696
}
9797
```
98-
* 时间复杂度:使用「哈希表」统计词频的复杂度为 $O(n)$;最坏情况下每个字符出现一次,最多有 $n$ 个节点要添加到「优先队列(堆)」中,复杂度为 $O(n\log{n})$;构造答案需要从「优先队列(堆)」中取出元素,复杂度为 $O(n\log{n})$。整体复杂度为 $O(n\log{n})$
98+
* 时间复杂度:令字符集的大小为 $C$。使用「哈希表」统计词频的复杂度为 $O(n)$;最坏情况下字符集中的所有字符都有出现,最多有 $C$ 个节点要添加到「优先队列(堆)」中,复杂度为 $O(C\log{C})$;构造答案需要从「优先队列(堆)」中取出元素并拼接,复杂度为 $O(n)$。整体复杂度为 $O(\max(n, C\log{C}))$
9999
* 空间复杂度:$O(n)$
100100

101101
---
@@ -130,8 +130,8 @@ class Solution {
130130
}
131131
}
132132
```
133-
* 时间复杂度:$O(n)$
134-
* 空间复杂度:使用 `charAt` 替换 `toCharArray` 的话为 $O(C + \log{C}),ドル$C$ 为常数,固定为 128ドル * 2$;否则为 $O(n + C + \log{C})$
133+
* 时间复杂度:令字符集的大小为 $C$。复杂度为 $O(\max(n, C\log{C}))$
134+
* 空间复杂度:$O(n + C + \log{C})$
135135

136136
---
137137

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /