View/Edit #67:delete_minimum

Switch to edit mode.

Name(s): delete_minimum
1:  {heap} = args
2:  for x in [1..length(heap)]
3:    heap[x] && heap[x][1] <= heap[`min ! E_VARNF => x'][1] && (min = x)
4:  endfor
5:  try
6:    (min_tree = heap[min])[1]
7:  except (E_VARNF)
8:    return heap
9:  endtry
10: "Adopt orphans"
11: heap[min] = {}
12: "return this:unite(heap, orphans);"
13: return heap
14: "Last modified by Lao-Tzu (#8084) on Tue Dec 11 05:15:14 2001 MST."

Verb arguments: this none this
Verb perms: Readable eXecutable NOT-Debug
Verb owned by: Hacker (#60)

You are not logged in.

[home | help | who | search | setup | code]