tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
18
Task/Priority-queue/Tcl/priority-queue.tcl
Normal file
18
Task/Priority-queue/Tcl/priority-queue.tcl
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
package require struct::prioqueue
|
||||
|
||||
set pq [struct::prioqueue]
|
||||
foreach {priority task} {
|
||||
3 "Clear drains"
|
||||
4 "Feed cat"
|
||||
5 "Make tea"
|
||||
1 "Solve RC tasks"
|
||||
2 "Tax return"
|
||||
} {
|
||||
# Insert into the priority queue
|
||||
$pq put $task $priority
|
||||
}
|
||||
# Drain the queue, in priority-sorted order
|
||||
while {[$pq size]} {
|
||||
# Remove the front-most item from the priority queue
|
||||
puts [$pq get]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue