Step 1: Understand Heap Construction.
To build a heap, the most efficient method involves starting from the last internal node and applying the heapify operation, which takes \( O(\log n) \) time. The heapify operation is applied to each node, and since there are \( n \) nodes, the total time complexity is \( O(n \log n) \).
Step 2: Conclusion.
Thus, the correct time complexity for building a heap of \( n \) elements is \( O(n \log n) \).
Find the least upper bound and greatest lower bound of \( S = \{X, Y, Z\} \) if they exist, of the poset whose Hasse diagram is shown below:
Suppose \( D_1 = (S_1, \Sigma, q_1, F_1, \delta_1) \) and \( D_2 = (S_2, \Sigma, q_2, F_2, \delta_2) \) are finite automata accepting languages \( L_1 \) and \( L_2 \), respectively. Then, which of the following languages will also be accepted by the finite automata:
(A) \( L_1 \cup L_2 \)
(B) \( L_1 \cap L_2 \)
(C) \( L_1 - L_2 \)
(D) \( L_2 - L_1 \)
Choose the correct answer from the options given below: