Question
A priority queue is a special type of queue where each
element has a priority. What is the typical time complexity for inserting an element into a priority queue implemented using a binary heap?Solution
A priority queue implemented using a binary heap maintains the heap property. Inserting an element involves adding it to the end and then "heapifying" it up the tree, which takes logarithmic time, O(log N), proportional to the height of the heap.
Train 'A' having a speed of 18 m/s can cross a man in 10 seconds. The length of train 'B' is 72 metres more than the length of 'A'. If the speed of 'B' ...
A train 420 metre long takes 72 sec to cross a man running at a speed of 4 km/hr in the direction opposite to that of train. What is the speed of the tr...
600 metre long train βAβ is running with a speed of 57.6 km/hr. Train βBβ which is 641 metre long is running with a speed of 90 km/h in opposite...
Train A and B can cross a 350 meters long platform in the same time. The length of Train A is 250 meters and the speed of Train B is 3/2 times the speed...
770 metres long train crosses a man who is moving in the same direction with a certain speed, in 35 seconds. If the same train can cross a tree in 22 se...
A train running at a speed of 90 km/h crosses a bridge in 45 seconds. If the length of the train is x meters, and length of the bridge is (6x+75) meters...
A goods train leaves a station at a certain time and at a fixed speed. After 9 hours, an express train leaves the same station and moves in the same dir...
Train A running with a sped of 18 km/h crosses a vertical pole in 7 seconds. Speed of train A is 6 m/s less than speed of train B, and length of train B...
Ratio of the lengths of two trains βXβ and βYβ is 5:7 respectively and the ratio of time taken by them to cross a pole is 2:3 respectively. If s...
Without stopping the speed of the train is 125 kmph, with stopping the speed of the train is 75 kmph.Find the stop time of the train?