Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
16
Task/Queue-Usage/Mathematica/queue-usage.math
Normal file
16
Task/Queue-Usage/Mathematica/queue-usage.math
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
Empty[a_] := If[Length[a] == 0, True, False]
|
||||
SetAttributes[Push, HoldAll]; Push[a_, elem_] := AppendTo[a, elem]
|
||||
SetAttributes[Pop, HoldAllComplete]; Pop[a_] := If[EmptyQ[a], False, b = First[a]; Set[a, Most[a]]; b]
|
||||
|
||||
Queue = {}
|
||||
-> {}
|
||||
Empty[Queue]
|
||||
-> True
|
||||
Push[Queue, "1"]
|
||||
-> {"1"}
|
||||
EmptyQ[Queue]
|
||||
->False
|
||||
Pop[Queue]
|
||||
->1
|
||||
Pop[Queue]
|
||||
->False
|
||||
Loading…
Add table
Add a link
Reference in a new issue