#28 - What is PriorityQueue in Java with Examples (using Comparator)

  Рет қаралды 16,996

Naveen AutomationLabs

Naveen AutomationLabs

2 жыл бұрын

In this video, I have explained - What is PriorityQueue with Examples (using Comparator).
Java Collection Series (2021) Latest videos on ArrayList, HashMap, Concurrent HashMap and full collection APIs.
• Latest Java Collection...
~~~Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:
kzbin.info%20Au...
Follow me on my Facebook Page:
/ naveenqtpexpert
Let's join our Automation community for some amazing knowledge sharing and group discussion on Telegram:
t.me/joinchat/9FrG-KzGlvxjNmQ1
Naveen AutomationLabs Paid Courses:
Java & Selenium:
naveenautomationlabs.com/manua...
Java & API +POSTMAN + RestAssured + HttpClient:
naveenautomationlabs.com/selen...

Пікірлер: 24
@MrFahimansari
@MrFahimansari 2 жыл бұрын
This is the best video I ever found on Priority queue. Keep up the good work and thanks for the video.
@nitityagi3517
@nitityagi3517 2 жыл бұрын
Really helpful series to understand Java collections. Thankyou Naveen
@shobhitranjan3957
@shobhitranjan3957 Жыл бұрын
brilliantly explained!
@vengateshm2122
@vengateshm2122 2 жыл бұрын
Thanks much. Really useful.
@amirzojaji482
@amirzojaji482 2 жыл бұрын
thnx a lot dear. this video made my day.
@hiteshdarji9925
@hiteshdarji9925 7 ай бұрын
Great work bhai.
@sureshgarine
@sureshgarine 2 жыл бұрын
Thank you Naveen, this is a really helpful video. rather than, poll(), it would be nice to use peek(), it just returns the object rather than return and removes the object from the priority queue
@amine_fadssi
@amine_fadssi Жыл бұрын
It depends on the situation.
@equinox6467
@equinox6467 Жыл бұрын
This may seem like a really, really dumb question, but how does the process work when you wrote the code of "e1.salary - e2.salary"? How does it arrange it in a way that you can get the lowest salary using such logic? For some reason, I just couldn't wrap my head over it.
@yawenwang7397
@yawenwang7397 Жыл бұрын
same question
@asganaway
@asganaway 7 ай бұрын
From the Java Docs of Comparable: " Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object." So he just subtract the two values he's interested in and he inverted the objects order when he want to give priority to the biggest salary.
@user-xq8pv6es5x
@user-xq8pv6es5x 6 ай бұрын
@@asganaway yeah, but it did not explain why e1.salary - e2.salary is ascending and e2.salary - e1.salary is descending.
@rajeshyadav-cw6vc
@rajeshyadav-cw6vc Жыл бұрын
Thank sir👌
@pavangowda1418
@pavangowda1418 2 жыл бұрын
In java which version u r doing
@user-kv6bl8ct9g
@user-kv6bl8ct9g 7 ай бұрын
Hello, thanks for this. I wonder if you also do tutorials, one on one?
@vikashshrivastav1051
@vikashshrivastav1051 2 жыл бұрын
please make a video of comparator and comparable
@Maheshkumar-iq4bi
@Maheshkumar-iq4bi 2 жыл бұрын
👍👍
@PriyankaShinde-mp6lt
@PriyankaShinde-mp6lt 2 жыл бұрын
it won't sort - I am adding 20 3 7 8 10 4 after I print the PQueue I get output as [3, 8, 4, 20, 10, 7] how it is sorting, could you please explain?
@vinayjangra1401
@vinayjangra1401 2 жыл бұрын
@Abina Joshi can you show your code? May be i can help
@kaushik.aryan04
@kaushik.aryan04 Жыл бұрын
as its a heap not a sorted array heap is not sorted
@gauri_korde
@gauri_korde Жыл бұрын
same here
@prasoonlall9432
@prasoonlall9432 10 ай бұрын
PQ gives you either the least element (minheap) or the greatest element(maxheap) when you poll the values one by one. It auto-arranges the rest based on the comparator provided. It does not sort the whole arrays altogether at one go. So if you poll the least element once, if you go on to poll again - it'll give you the second lowest element and it goes on. Similarly for max heap (greatest values).
@pqsk
@pqsk 2 жыл бұрын
No love for employee *E* and *D*
Java JDk 8 to JDK 15 - All Important Features || A Must Watch For Interview
38:41
Wait for the last one! 👀
00:28
Josh Horton
Рет қаралды 173 МЛН
КАК ДУМАЕТЕ КТО ВЫЙГРАЕТ😂
00:29
МЯТНАЯ ФАНТА
Рет қаралды 1,2 МЛН
Important HTML TAGS || Every UI Automation QA must know
15:28
Naveen AutomationLabs
Рет қаралды 9 М.
Java Tutorial #51 - Java PriorityQueue Class with Examples (Collections)
10:07
Programming For Beginners
Рет қаралды 14 М.
Matrix Multiplication - Product of two Matrices
26:09
Naveen AutomationLabs
Рет қаралды 4,5 М.
Generics in Java - Full Tutorial
20:08
Daily Code Buffer
Рет қаралды 27 М.
Set and HashSet in Java - Full Tutorial
20:43
Coding with John
Рет қаралды 202 М.
Interview Question: Priority Queue
31:01
Byte by Byte
Рет қаралды 31 М.
String to Number without using Integer.parseInt() method
17:04
Naveen AutomationLabs
Рет қаралды 15 М.
Queue In Java Tutorial #66
7:46
Alex Lee
Рет қаралды 135 М.
Cheapest gaming phone? 🤭 #miniphone #smartphone #iphone #fy
0:19
Pockify™
Рет қаралды 1,9 МЛН
Choose a phone for your mom
0:20
ChooseGift
Рет қаралды 7 МЛН
Я УКРАЛ ТЕЛЕФОН В МИЛАНЕ
9:18
Игорь Линк
Рет қаралды 102 М.