A Max Heap is a complete binary tree data structure where the value of each node is greater than or equal to the values of its children. This property ensures that the maximum element is always at the root of the tree, making it efficient for implementing priority queues.
Time Complexity:
Insertion: O(log n) (to maintain the heap property)
Extract Max: O(log n) (restructuring the heap after removing the root)
Peek Max: O(1) (accessing the root)
Space Complexity:
O(n) (storing the elements in the heap, typically in an array or a tree structure)
Max Heaps are widely used in algorithms like Heap Sort and in data structures such as priority queues.