0

Python has this library heapq, which we can use to perform heap operations. What does "q" stand for?

2 Answers2

3

It literally means what it sounds like: heap queue. The doco confirms this:

8.4. heapqHeap queue algorithm

paxdiablo
  • 854,327
  • 234
  • 1,573
  • 1,953
0

So, Heap queue (or heapq) means the same. It is basically written in an easy way 'heapq' can we written as 'heap queue'. For your better understanding q = 'queue'. This library provides an implementation of the heap queue algorithm, also known as the priority queue algorithm.

Aditya Malviya
  • 1,907
  • 1
  • 20
  • 25