正在加载图片...
Basic Heap Operations Insert:To insert an element Xinto the heap,we create a hole in the next available location,since otherwise the tree will not be complete. If xcan be placed in the hole without violating heap order,then we do so and are done. Otherwise we slide the element that is in the hole's parent node into the hole,thus bubbling the hole up towards the root. We continue this process until Xcan be placed in the hole.Basic Heap Operations ◼ Insert: To insert an element X into the heap, we create a hole in the next available location, since otherwise the tree will not be complete. ◼ If X can be placed in the hole without violating heap order, then we do so and are done. ◼ Otherwise we slide the element that is in the hole’s parent node into the hole, thus bubbling the hole up towards the root. ◼ We continue this process until X can be placed in the hole
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有