# insert(PriorityQueue,Thing) -- insert a new element into the queue

## Synopsis

• Function: insert
• Usage:
Q = insert(Q,x)
• Inputs:
• Outputs:
• Q, an instance of the type PriorityQueue, the same PriorityQueue as the input, now with a new element inserted

## Description

 i1 : Q = priorityQueue {1,2,3} o1 = PriorityQueue{...4...} o1 : PriorityQueue i2 : insert(Q,0) o2 = PriorityQueue{...4...} o2 : PriorityQueue i3 : insert(Q,4) o3 = PriorityQueue{...4...} o3 : PriorityQueue i4 : min Q o4 = 0

## Caveat

The priority queue Q is mutable and is altered by insert. Q is also the output of the function.