declare proc {BFS T} fun {TreeInsert Q T} if T\=leaf then {Insert Q T} else Q end end proc {BFSQueue Q1} if {IsEmpty Q1} then skip else X Q2 Key Val L R in Q2={Delete Q1 X} tree(Key Val L R)=X {Browse Key#Val} {BFSQueue {TreeInsert {TreeInsert Q2 L} R}} end end in {BFSQueue {TreeInsert {NewQueue} T}} end