Queue in Python, Java, Typescript and Go

Python FIFO (First In First Out) Queue

import queue
q = queue.Queue()
q.put(9)
print(q.get()) #to print the item that we are removing

Output:9
print(q.empty()) #make queue empty, we can use the empty function

Python LIFO (Last In Last Out) Queue

import queue
q = queue.LifoQueue()
q.put(5)
print(q.get())

Python Priority Queue

Java FIFO (First In First Out) Queue

Comments

Popular posts from this blog

AWS S3 MRAP

SLO Compliance