11/// The `Heap` protocol
2- protocol Heap {
2+ public protocol Heap {
33 /// The type to store in the `Heap`
44 associatedtype T
55 /// The storage array of the `Heap`
@@ -144,9 +144,9 @@ public struct MaxHeap<T: Comparable>: Heap {
144144 /// Public init
145145 public init ( ) { }
146146 /// The storage array of the `Heap`
147- internal var storage : [ T ] = [ ]
147+ public var storage : [ T ] = [ ]
148148 /// The `MaxHeap` iterative `heapifyUp` algorithm.
149- mutating internal func heapifyUp( ) {
149+ mutating public func heapifyUp( ) {
150150 var index = self . size - 1
151151 while ( hasParent ( index) && self . storage [ index] > getParent ( index) ) {
152152 let parentIndex = Self . getParentIndex ( index)
@@ -155,7 +155,7 @@ public struct MaxHeap<T: Comparable>: Heap {
155155 }
156156 }
157157 /// The `MaxHeap` iterative `heapifyDown` algorithm.
158- mutating internal func heapifyDown( ) {
158+ mutating public func heapifyDown( ) {
159159 var index = 0
160160 while ( hasLeftChild ( index) ) {
161161 var largest = Self . getLeftChildIndex ( index)
@@ -178,9 +178,9 @@ public struct MinHeap<T: Comparable>: Heap {
178178 /// Public init
179179 public init ( ) { }
180180 /// The storage array of the `Heap`
181- internal var storage : [ T ] = [ ]
181+ public var storage : [ T ] = [ ]
182182 /// The `MinHeap` iterative `heapifyUp` algorithm.
183- mutating internal func heapifyUp( ) {
183+ mutating public func heapifyUp( ) {
184184 var index = self . size - 1
185185 while ( hasParent ( index) && self . storage [ index] < getParent ( index) ) {
186186 let parentIndex = Self . getParentIndex ( index)
@@ -189,7 +189,7 @@ public struct MinHeap<T: Comparable>: Heap {
189189 }
190190 }
191191 /// The `MinHeap` iterative `heapifyDown` algorithm.
192- mutating internal func heapifyDown( ) {
192+ mutating public func heapifyDown( ) {
193193 var index = 0
194194 while ( hasLeftChild ( index) ) {
195195 var smallest = Self . getLeftChildIndex ( index)
@@ -212,9 +212,9 @@ public struct MaxHeapRecursive<T: Comparable>: Heap {
212212 /// Public init
213213 public init ( ) { }
214214 /// The storage array of the `Heap`
215- internal var storage : [ T ] = [ ]
215+ public var storage : [ T ] = [ ]
216216 /// The `MaxHeapRecursive` recursive `heapifyUp` starter method.
217- mutating internal func heapifyUp( ) {
217+ mutating public func heapifyUp( ) {
218218 heapifyUp ( at: self . size - 1 )
219219 }
220220 /// The `MaxHeapRecursive` recursive `heapifyUp` algorithm.
@@ -228,7 +228,7 @@ public struct MaxHeapRecursive<T: Comparable>: Heap {
228228 }
229229 }
230230 /// The `MaxHeapRecursive` recursive `heapifyDown` starter method.
231- mutating internal func heapifyDown( ) {
231+ mutating public func heapifyDown( ) {
232232 heapifyDown ( at: 0 )
233233 }
234234 /// The `MaxHeapRecursive` recursive `heapifyDown` algorithm.
@@ -257,9 +257,9 @@ public struct MinHeapRecursive<T: Comparable>: Heap {
257257 /// Public init
258258 public init ( ) { }
259259 /// The storage array of the `Heap`
260- internal var storage : [ T ] = [ ]
260+ public var storage : [ T ] = [ ]
261261 /// The `MinHeapRecursive` recursive `heapifyUp` starter method.
262- mutating internal func heapifyUp( ) {
262+ mutating public func heapifyUp( ) {
263263 heapifyUp ( at: self . size - 1 )
264264 }
265265 /// The `MinHeapRecursive` recursive `heapifyUp` algorithm.
@@ -273,7 +273,7 @@ public struct MinHeapRecursive<T: Comparable>: Heap {
273273 }
274274 }
275275 /// The `MinHeapRecursive` recursive `heapifyDown` starter method.
276- mutating internal func heapifyDown( ) {
276+ mutating public func heapifyDown( ) {
277277 self . heapifyDown ( at: 0 )
278278 }
279279 /// The `MinHeapRecursive` recursive `heapifyDown` algorithm.
0 commit comments