I have just started using PriorityQueue module in python from Queue module but i am having a hard time to check if an element exists in the PriorityQueue or not. Below is my Code snippet.
from queue import PriorityQueue
q = PriorityQueue()
q.put(3)
q.put(2)
q.put(1)
ok = 4
if ok in q:
print("Found")
but i am getting the below error.
TypeError: argument of type 'PriorityQueue' is not iterable
Please tell me how to iterate and check if an element is present in PriorityQueue module in python.
Doubt 2 :- In the above code snippet, PriorityQueue is MIN_HEAP by default, what syntax i should use i want a MAX_HEAP?