1. Data Structures & Algorithms Heapsort 2. Heaps A heap is data structure that can be viewed as a nearly complete binary tree Each node corresponds to an element…