PopMax returns and remove the element with maximum score, nil if the set is empty. Time complexity of this method is : O(log(N)).
()
| 504 | // |
| 505 | // Time complexity of this method is : O(log(N)). |
| 506 | func (sl *SkipList) PopMax() *SkipListNode { |
| 507 | x := sl.tail |
| 508 | if x != nil { |
| 509 | sl.Remove(x.hash) |
| 510 | } |
| 511 | return x |
| 512 | } |
| 513 | |
| 514 | // Put puts an element into the sorted set with specific key / value / score. |
| 515 | // |