Question
Consider the following Java code snippet: Â Â
import java.util.ArrayList;   import java.util.Arrays;   import java.util.List;   import java.util.PriorityQueue;   public class HeapQuestion10 {     public static void main(String[] args) {       List numbers = Arrays.asList(7, 2, 9, 1, 5);       PriorityQueue pq = new PriorityQueue(numbers); // Initialize with a collection       System.out.println(pq.poll());       System.out.println(pq.poll());       System.out.println(pq.poll());     }   }   What will be the output of this program?Solution
When a PriorityQueue is initialized with a Collection (like numbers list here), it performs a "heapify" operation. This operation builds a min-heap (by default) from the given elements. The time complexity for building a heap from N elements is O(N).   1. List
Consider the following statements with respect to the information provided on the banks write off and NPA recovery by the Finance Ministry-
I.Ban...
Who has been selected as the new Chief Technologist of NASA?
When is the International Day of Persons with Disabilities (IDPD) observed every year?
- What is the name of the healthcare app launched by Jammu and Kashmir CM Omar Abdullah?
Which country does the film "Children of Nobody" represent, as it secured the Best Film award in the International Competition in Innovation Moving Imag...
For what period will the XVIFC recommendations apply, as per its submitted report?
Which three Indian cities, nominated under the Wetland City Accreditation (WCA) scheme, are seeking international recognition for their efforts to prote...
What proportion of global sea trade is represented by Europe, where the Adani Group plans to acquire ports?
Which of the following is the primary function of the 'e-Sakshya' app launched by Union Home Minister Amit Shah?
What was the share of UPI in India's total digital payments in 2024?