Great animations, clear and understandable! thanks! Also: Any way to not have to throw the Exception when rear == null? because then get "cannot find symbol" on this exception which means I have to create my own exception which is annoying. thanks!
Thanks for the kind comment, SkonerTM. Well, it seems to me like your code is not compiling because you need to import java.util.NoSuchElementException at the top of your file. That would pretty much fix your problem. Now, if you want to exclude that import in general, another way I would do this is to use the Integer class instead of the 'int' primitive as a return type for the Dequeue and Peek methods. That would allow you to return 'null' instead of throwing an Exception as a way to indicate that the queue is empty. Hope this helps :)
Can we build a Queue using the regular linked list instead of a circular one? We can implement addLast and removefirst methods in a regular linked list. Correct me if I'm wrong.
Hey Everyone! Thanks for checking out my video! Don't forget to Like, Subscribe, and MOST IMPORTANTLY click that Notification Bell for updates! :)
Great quality. I don't understand why this channel is underrated.
Hi Mathi Alagan, thank you so much. If you enjoy this content, please feel free to share these videos.
Great animations, clear and understandable! thanks! Also:
Any way to not have to throw the Exception when rear == null? because then get "cannot find symbol" on this exception which means I have to create my own exception which is annoying. thanks!
Thanks for the kind comment, SkonerTM. Well, it seems to me like your code is not compiling because you need to import java.util.NoSuchElementException at the top of your file. That would pretty much fix your problem. Now, if you want to exclude that import in general, another way I would do this is to use the Integer class instead of the 'int' primitive as a return type for the Dequeue and Peek methods. That would allow you to return 'null' instead of throwing an Exception as a way to indicate that the queue is empty. Hope this helps :)
Thanks bro I would’ve failed my data structure course if it wasn’t for your videos
You're very welcome! I'm glad you passed your Data Structures course! Don't forget to like and share as it helps out the channel.
Can we build a Queue using the regular linked list instead of a circular one?
We can implement addLast and removefirst methods in a regular linked list. Correct me if I'm wrong.
Hi Hari, you can definitely use a non-circular linked list. Enqueue and dequeue will still be O(1) time. Hope this helps :)
this is easy unlike circular queue in array
Very nice...
Thank you, Gayatri!
how do I omplement double linked list circular queue?
can u show me a toString method for this
how do i make a method to print this queue
Opp