From b28ba70ee1464fbd915c5d655bd6865a7d2d66e0 Mon Sep 17 00:00:00 2001 From: Yuhao Ju Date: Sat, 1 Apr 2023 12:57:24 +0800 Subject: [PATCH] =?UTF-8?q?update=20=200347.=E5=89=8DK=E4=B8=AA=E9=AB=98?= =?UTF-8?q?=E9=A2=91=E5=85=83=E7=B4=A0=EF=BC=9A=E6=B7=BB=E5=8A=A0=E5=A4=8D?= =?UTF-8?q?=E6=9D=82=E5=BA=A6=E5=88=86=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0347.前K个高频元素.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/problems/0347.前K个高频元素.md b/problems/0347.前K个高频元素.md index d8eabef4..0d268d9b 100644 --- a/problems/0347.前K个高频元素.md +++ b/problems/0347.前K个高频元素.md @@ -79,8 +79,6 @@ ```CPP -// 时间复杂度:O(nlogk) -// 空间复杂度:O(n) class Solution { public: // 小顶堆 @@ -120,6 +118,10 @@ public: } }; ``` + +* 时间复杂度: O(nlogk) +* 空间复杂度: O(n) + # 拓展 大家对这个比较运算在建堆时是如何应用的,为什么左大于右就会建立小顶堆,反而建立大顶堆比较困惑。