Demo entry 3550157

daushdiand

   

Submitted by anonymous on Jan 22, 2016 at 05:41
Language: Python 3. Code size: 505 Bytes.

	def ExtractThirdLargest(H):
	    int value1 = ExtractMax(H)
	    #Extracting the biggest of heap
	    value2 = ExtractMax(H)
	    #Extracting the new biggest (second largest overall)
	    value3 = ExtractMax(H) 
	    #Extracting the new biggest (third largest overall)
	    Insert(H, value1)      
	    #Inserting the first extracted item back in 
	    Insert(H, value2)      
	    #Inserting the second extracted item back in 
	    return value3
	    #Returning the third largest of the heap

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).