From the course: Nail Your Java Interview
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Using queues in technical interviews - Java Tutorial
From the course: Nail Your Java Interview
Using queues in technical interviews
- [Instructor] A queue represents an ordered list of objects, just like a list, but its intended use is slightly different. A queue is designed to have elements inserted at the end of the queue, and elements are removed from the beginning of the queue. If you think of a line at a supermarket, the first person in line is always the first person out of line. The last person that joins the line is also the last person out of line. To use queues in Java, we have the java.util.Queue interface. Since an interface is not concrete, we'll need to instantiate an implementation of the interface in order to use it. In Java, we can choose between a linked list and a priority queue. A linked list is a pretty standard queue implementation, so we're going to use this implementation in our example. Let's take a look at how this works in code. Here, we have an example where we want to process the requests of a series of people in line in…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
Leveraging stacks as a data structure4m 36s
-
(Locked)
Using queues in technical interviews4m 5s
-
(Locked)
Mastering hash-based structures4m 51s
-
(Locked)
Challenge: Generate binary numbers1m 19s
-
(Locked)
Solution: Generate binary numbers6m 35s
-
(Locked)
Challenge: Matching parentheses1m 5s
-
(Locked)
Solution: Matching parentheses3m 51s
-
(Locked)
Challenge: Find most repeated word2m 16s
-
(Locked)
Solution: Find most repeated word3m 28s
-
-
-