Adaptable Priority Queue
Addition operations on Priority Queue
remove(e)
:
remove an
arbitrary
entry e:
Example:
Initial Priority queue:
{
(3, "John"), (5, "Mary"), (8, "Peter")
}
Let
e
identifies the entry
(5, "Mary")
After
remove(e)
:
{
(3, "John"), (8, "Peter")
}
replaceKey(e, k)
:
replace the key of an
arbitrary
entry e with the key
k
Example:
Initial Priority queue:
{
(3, "John"), (5, "Mary"), (8, "Peter")
}
Let
e
identifies the entry
(5, "Mary")
After
replaceKey(e, 9)
:
{
(3, "John"), (8, "Peter"), (9, "Mary")
}
replaceValue(e, x)
:
replace the key of an
arbitrary
entry e with the value
x
Example:
Initial Priority queue:
{
(3, "John"), (5, "Mary"), (8, "Peter")
}
Let
e
identifies the entry
(5, "Mary")
After
replaceValue(e, "Merry")
:
{
(3, "John"), (5, "Merry"), (8, "Peter")
}