Question
In Java, which interface defines the basic operations
for a queue, and which class is a common concrete implementation that supports these operations with efficient O(1) time complexity for offer and poll?Solution
In Java, java.util.Queue is the interface that defines queue operations. java.util.LinkedList is a common concrete class that implements the Queue interface and provides O(1) time complexity for offer() (enqueue) and poll() (dequeue) operations when used as a queue.
The speed of a boat in still water is 30 km/hr. If the boat covers 240 km in upstream in 12 hours, then find the time taken by the boat to travel 120 km...
A boatman takes 10 hours to travel 360 km downstream and 15 hours to cover the same distance upstream. How much time would it take for the boatman to tr...
Speed of a boat in still water is 5times more than the speed of stream. If boat covers 72 km in downstream in 6 hours, then find the time taken by the b...
- The speed of a boat while moving downstream is 80% higher than its speed while moving upstream. If the boat covers a distance of 720 km downstream in 20 ho...
Speed of a boat in still water to speed of boat in upstream is 10:7. If the boat can travel 390 km in downstream in 5 hours, then find the time taken by...
Speed of a boat in still water to speed of boat in upstream is 8:5. If the boat can travel 440 km in downstream in 5 hours, then find the time taken by ...
A boat travels 48 km downstream in 4 hours and 24 km upstream in 6 hours. What is the speed of the boat in still water?
Speed of a boat in still water is 15 kmph and speed of stream is 12 kmph. A man rows to a place at a distance of 54 km and come back to starting point. ...
The ratio of the speed of boat in upstream to speed of boat in downstream is 7:9. If the boat can cover a total of 70 km upstream and 90 km downstream i...
- In still water, a boat travels 63 km in 3 hours. If the speed of the stream is 6 km/h, then what is the percentage increase of downstream speed compared to...