3.19

From The Algorithm Design Manual Solution Wiki
Revision as of 18:04, 20 September 2020 by Algowikiadmin (talk | contribs) (Created page with "Store two values, the maximum and minimum. These need to be checked and potentially updated on every delete. If the minimum is being deleted, call the successor, update the...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Store two values, the maximum and minimum. These need to be checked and potentially updated on every delete. If the minimum is being deleted, call the successor, update the minimum and delete the old item. Similarly, if the maximum is being deleted, call the predecessor, update the maximum and delete the old item. On insert, compare the new item to min/max, if it replaces either one update the min/max accordingly.

Back to Chapter 3