that is at least as large as its parentin max-heapeach item has priority that is no larger than its parent notes the minimum priority item in min-heap (or the maximum priority item in max-heapmay always be found at position of the array to remove this item from the priority queuethe last item in the array is moved into its placeand the length of the array is decreased by one thenwhile item and its children do not satisfy the heap propertyitem is swapped with one of its children (the one with the smallest priority in min-heapor the one with the largest priority in max-heap)moving it downward in the tree and later in the arrayuntil eventually the heap property is satisfied the same downward swapping procedure may be used to increase the priority of an item in min-heapor to decrease the priority of an item in max-heap to insert new item into the heapthe item is appended to the end of the arrayand then while the heap property is violated it is swapped with its parentmoving it upward in the tree and earlier in the arrayuntil eventually the heap property is satisfied the same upward-swapping procedure may be used to decrease the priority of an item in min-heapor to increase the priority of an item in max-heap to create new heap from an array of itemsone may loop over the items in reverse orderstarting from the item at position and ending at the item at position applying the downward-swapping procedure for each item to implement prim' algorithm efficientlywe need data structure that will store the vertices of in way that allows the vertex joined by the minimum cost edge to be selected quickly heap is data structure consisting of collection of itemseach having key the basic operations on heap are insert( , ,hadd item to heap using as the key value deletemin(hdelete and return an item of minimum key from changekey( , ,hchange the key of item in heap to key( ,hreturn the key value for item the heap is among the most widely applicable non-elementary data structure heaps can be implemented efficientlyusing heap-ordered tree each tree node contains one item and each item has real-valued key the key of each node is at least as large the key of its parent (excepting the rootfor integer > -heap is heap-ordered -ary tree that is "heapshaped let be an infinite -ary treewith vertices numbered in breadth-first order subtree of is heap-shaped if its vertices have consecutive numbers item number key the depth of -heap with nodes is <[logdnlovely professional university