wisdompeak / LeetCode

This repository contains the solutions and explanations to the algorithm problems on LeetCode. Only medium or above are included. All are written in C++/Python and implemented by myself. The problems attempted multiple times are labelled with hyperlinks.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

关于heap分类的疑惑

XuRunheng opened this issue · comments

大佬,在下不是很明白为什么set的题目放到heap分类 c++的set是用红黑树实现的 priorityqueue才是用heap实现的

你的说法是正确的。这是历史遗留问题。最早我把pq和set的题都放在一起,归类为一系列涉及到自动排序的数据结构的题目。后来我把pq另外分出来了,heap这个词对set/map而言反而就不合适了。我还没想好怎么重命名这么多文件,就先这么凑活儿叫吧。