tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
17
Task/Priority-queue/OCaml/priority-queue-1.ocaml
Normal file
17
Task/Priority-queue/OCaml/priority-queue-1.ocaml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
module PQ = Base.PriorityQueue
|
||||
|
||||
let () =
|
||||
let tasks = [
|
||||
3, "Clear drains";
|
||||
4, "Feed cat";
|
||||
5, "Make tea";
|
||||
1, "Solve RC tasks";
|
||||
2, "Tax return";
|
||||
] in
|
||||
let pq = PQ.make (fun (prio1, _) (prio2, _) -> prio1 > prio2) in
|
||||
List.iter (PQ.add pq) tasks;
|
||||
while not (PQ.is_empty pq) do
|
||||
let _, task = PQ.first pq in
|
||||
PQ.remove_first pq;
|
||||
print_endline task
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue