PopMin returns and remove the element with minimal score, nil if the set is empty. Time complexity of this method is : O(log(N)).
()
| 486 | // |
| 487 | // Time complexity of this method is : O(log(N)). |
| 488 | func (sl *SkipList) PopMin() *SkipListNode { |
| 489 | x := sl.header.level[0].forward |
| 490 | if x != nil { |
| 491 | sl.Remove(x.hash) |
| 492 | } |
| 493 | return x |
| 494 | } |
| 495 | |
| 496 | // PeekMax returns the element with maximum score, nil if the set is empty. |
| 497 | // |