newSortedMapBranchNode returns a new branch node with the given child nodes.
(children ...sortedMapNode[K, V])
| 1772 | |
| 1773 | // newSortedMapBranchNode returns a new branch node with the given child nodes. |
| 1774 | func newSortedMapBranchNode[K, V any](children ...sortedMapNode[K, V]) *sortedMapBranchNode[K, V] { |
| 1775 | // Fetch min keys for every child. |
| 1776 | elems := make([]sortedMapBranchElem[K, V], len(children)) |
| 1777 | for i, child := range children { |
| 1778 | elems[i] = sortedMapBranchElem[K, V]{ |
| 1779 | key: child.minKey(), |
| 1780 | node: child, |
| 1781 | } |
| 1782 | } |
| 1783 | |
| 1784 | return &sortedMapBranchNode[K, V]{elems: elems} |
| 1785 | } |
| 1786 | |
| 1787 | // minKey returns the lowest key stored in this node's tree. |
| 1788 | func (n *sortedMapBranchNode[K, V]) minKey() K { |
searching dependent graphs…