I have constantly tried to find ways to make my videos better. Coupling them with learning apps felt like a great way to do that. I make enough money. I don't need anymore. I'm just happy that people are finding the videos useful
Agree with this for other videos but not this, major issue in code for queue size handling among other things. Size x, insert x elements, remove y elements and try inserting. (Ideally space should be there because we removed y elements but the code would throw exception)
You are just THE BEST source for programming stuff on this planet, forget about the lectures given by our profs and tutors - you are the real deal. It's amazing how you just don't miss a thing, everything anyone could think of simply exists in your video collection. I wouldn't have it through my exam without this!
I'm studying for my Data Structures midterm and I'm SO glad I found your channel! You have tons of videos on subjects that I'm super interested in and you are very good at explaining things clearly and quickly. Also, your videos are great and easy to follow. Thanks!
Just want to echo the many users over now several years: thank you so much for sharing your knowledge. You really do have a unique talent for clear instruction and example. I'm working my way through a few Java-based courses right now and each new chapter seems difficult or confusing until I watch and follow along with your video covering the topic.
I finished school two years ago and sadly I haven't been in a programming role at my current job. I honestly feel like the saying "if you don't use it, you lose it" is true. Your tutorials have been a huge help in getting me back on my feet. Thank you!!
I use your videos for studying. Very well made. So much easier than re-reading slides and chapters from books. I appreciate all the time you put into making these.
Derek I really appreciated all the time, that you have been taking from your personal life to provide us such as great tutorials, I have not a lot of money to pay for teachers and all that stuff and you had been the greatest source of information regarding Java programing. God bless sir
Thank you :) I'll show exactly how to do that when I cover how to make stacks and queues with Linked Lists. You made a great point, but you are getting a bit ahead of me.
Thank you so much for all of these Java tutorials! You are honestly a lifesaver! :) In the past two hours I have learnt soooooo much, just from watching your videos!
Derek, I must tell you this, you are doing a real good work with your videos, your way of explaining such complex concepts are simply the best. I like all your videos, thank you so much. Take care and god bless!
Thank you :) Some day maybe I'll cover different topics again. I love to teach different topics. The programming stuff just come easy to me though because I have been doing this stuff all my life.
Thank you :) I have been playing around with how I could provide homework and tools to reinforce the information. I'm working on a framework that I plan to use to make tablet / phone apps that will provide those tools. Don't worry they will be free. I'm planning to start making them over the coming months. It should be fun
man, u did a really excellent job to illustrate every details! super helpful, I certainly cant understand if i only saw each video once, ;) thank u so much!
I think for this the 'sysout("PUSH " + input + " added to stack")' should be inside the if statement. If not what would happen hypothetically is that if the stack is full it's still going to print that the input was pushed, even though it's full.
Your push method will display two messages in case that the stack is full. One that the stack is full and one that the input was added. You had to put the last line inside the condition.
You are huge inspiration to me. Thank you for everything. Your programming skills, editing skills and a powerfull voice I can just dream about, make this videos perfect :)
Yes I will cover most everything. The only issue I'm having is that some topics require knowledge of discrete mathematics. I'll do my best to make all of that understandable without making a tutorial on discrete math
i keep thinking what happens when the front and rear keep moving down the array and eventually go out of bounds? If the Front starts at index 4 of a array that has the size 5, then when you add an element to it wouldn't it go out of bounds
Hey man thanks for the video. It helped me a lot to get into stacks and queues. So it came, that I noticed a MAJOR mistake in your stack pop method. In line 45 you set the TopOfTheStack to -1 and also increment one down in line 47. In this case, it does not matter because you get your value printed out before but if you actually want to work with the method for advanced applications you always get the wrong output of always -1.
You are great. I'm in my second semester of grad school, and after taking one semester of part 1 and 2 of core Java, and watching a few of your tutorials, you have given me confidence that I'll be OK in my Algorithms class this semester! Thank you. Please keep this going. Any advice you might have? Again, thanks! Also do you cover Discrete math?
Derek Banas Got it! Another question, do you have any videos where you actually compare algorithms using graphs and the "Big Oh" notation? Or Algo analysis in general? Again, the code is great stuff!!!!
What are you looking for? Like exercises in text books? The only problem is that I don't have time to solve all of them, but I could give exercises that you should be able to solve if that works
one advice although a small one if you are taking input from the terminal using scanner use scanner object on nextLine() instead of next() method call as next will only pick the first word however we would want the entire line to be used and hence should use nextLine().
Thanks for all the tutorials! Its crisp, clear and excellent. Btw, what is the first sentence you always say in your videos? I couldn't decode that completely :)
If you leave out the condition for the Queue to be full, Would you then have in the remove method : rear++; then rear = rear % maxNumOfItems. Similarly for insert would you then have front++; then front = front % maxNumOfItems? That way you can keep adding and removing stuff?
First off, let me say, great videos!! I'm refreshing my knowledge in the subjects because I essentially flushed em after my courses to make room for new info lol. I just had a small question... why not move all of the elements up after removing an item in the queue, to maximize space for new inserts?
Perhaps the pop() method should be returning the oldValue prior to setting it to "-1"; hence: public String pop(){ if (topOfStack >= 0) { // display and print e.t.c String value = stackArray[topOfStack]; stackArray[topOfStack--] = "-1"; return value; } //else print and report stack is empty e.t.c } ** I didn't check all the comments below to see whether anyone mentioned this **
I also thought the same thing. public String pop() { String rep=""; if(topOfStack>=0) { display(); System.out.print(" POP: The value at the top of the Stack "+stackArray[topOfStack]+" was removed from the Stack"); rep=stackArray[topOfStack]; stackArray[topOfStack]="-1"; topOfStack--; } else { System.out.print("POP: the Stack is empty apparently. Unable to pop any Value."); }
but what if we added elements ,and then we removed them like that from the queue " front++; numberOfItems-- ; " , and then we added elements with the size of the array is reached by front ,even thought the condition of insertion still true ; here the numbers of elements is less than the size "if(numberOfItems + 1
Thank you :) Basically I have everything in playlists. This is the order I would teach : Java Video Tutorial, Design patterns, UML, Object Oriented Design, Code Refactoring, Algorithms. I have everything in order on this page : newthinktank. com/2011/10/every-article/#java
Forgive my ignorance as I am very new but in your pop method, the stack is displayed prior to the -1 assignment. This causes the display to show the value removed. I moved the under the "-1" assignment, just above the return and now it displays the stack without the popped value. Am I correct in doing this or is there something I missed. Again, you rule! New version: public String pop(){ if(topOfStack >= 0){ System.out.println("POP " + stackArray[topOfStack] + " Was Removed From the Stack "); // Just like in memory an item isn't deleted, but instead is just not available stackArray[topOfStack] = "-1"; // Assigns -1 so the value won't appear displayTheStack(); return stackArray[topOfStack--]; }
Thanks for your video, but I have a problem about pop() in stacks. When I pop the item from stacks, It still in stacks? But I think pop means remove the item and return it. Not only "not available or not be seen"
Hola entrenador, Gracias por este video muy conceptual. Es una base. También se alegrarán de saber que tengo en el cuadro de medallas. Silver para mí!! Ahora sé que el vídeo en tiempo es 11 pm EST :)
Derek, I believe that there is a bug with the insert method in TheQueue class. I was testing the class, and I'm getting an ArrayIndexOutOFBounds exception at the boundary condition when the underlying array has been "used up" . To fix, I replaced the insert method logic with .... if (numberofItems +1
Derek, 'priorityInsert()' methods has a serious bug. Quick check, remove an item and call this method. Reason is, for-loop condition in this method is wrong.
Thanks. Great tutorial. But shouldn't you wrap the rear and the front to the beginning of the array if they are equal to the arraySize? I mean just increasing them will cause a null pointer exception at some point.
i have one doubt derek bans regarding the insertion operation that inside the insertion operation should we keep the if condition like this if(numberOfItems < queuesize) then we should go further i guess the condition if(numberOfItems +1
Hi Derek thanks a lot of your videos. The insert method you use in the queue class is it the same as enqueue() which adds new items to the end of the queue. thanks in advance
Hey just a quick question: I thought we aren't supposed to move the first pointer when deleting, instead shift all elements once to the left. And I know in order to do that, the time-consumption is O(n^2), but wouldn't you have more problems in the future when your wasting space at the front? When do you recover the space?
This may be a stupid question but: In your pop method you set stackArray[topOfStack] = "-1" then return stackArray[topOfStack--] wouldn't that just return -1, not the value that was removed?
Hi Derek, greetings from İstanbul city. My training will be finished on next Tuesday then I'll fly to Jakarta and start to work there. Hope you're doing alright
I actually have a question! Say I want to remove an item from the queue and I do. I wanted my front to stay at index 0, and every other value to shift down... :/
These tutorials are a savior to my life! Being a Comp Sci major with bad teachers and TAs these teach me more then my classes!
Thank you :) I'm very happy I can help to explain what your teachers missed
Jeramy smith can we chat private?
I have constantly tried to find ways to make my videos better. Coupling them with learning apps felt like a great way to do that. I make enough money. I don't need anymore. I'm just happy that people are finding the videos useful
Thank you for the marvelous work, Derek. Your style, speed and code accuracy is just amazing.
+abdalla elmedani Thank you for the compliment :) You're very welcome
Agree with this for other videos but not this, major issue in code for queue size handling among other things. Size x, insert x elements, remove y elements and try inserting. (Ideally space should be there because we removed y elements but the code would throw exception)
You are just THE BEST source for programming stuff on this planet, forget about the lectures given by our profs and tutors - you are the real deal.
It's amazing how you just don't miss a thing, everything anyone could think of simply exists in your video collection. I wouldn't have it through my exam without this!
Thank you very much for the kind message :) People like you are the reason why I continue making videos.
I second what he said.
I've been using you through the whole semester, almost every single day.
Nick Steiner Thank you :) That is very nice to hear that I helped.
Queues starts at 9:06
I'm studying for my Data Structures midterm and I'm SO glad I found your channel! You have tons of videos on subjects that I'm super interested in and you are very good at explaining things clearly and quickly. Also, your videos are great and easy to follow. Thanks!
MAGonzzManifesto Thank you for all the nice compliments :) Many more videos are coming.
Just want to echo the many users over now several years: thank you so much for sharing your knowledge. You really do have a unique talent for clear instruction and example. I'm working my way through a few Java-based courses right now and each new chapter seems difficult or confusing until I watch and follow along with your video covering the topic.
Thank you for taking the time to write such a nice message :) I greatly appreciate it !!!
I'm so glad you exist in the world. My instructors give me tasks but you teach me how to learn java. Thank you for doing what you do!
Thank you for the nice compliment :) I'm very happy that I helped
I finished school two years ago and sadly I haven't been in a programming role at my current job. I honestly feel like the saying "if you don't use it, you lose it" is true.
Your tutorials have been a huge help in getting me back on my feet. Thank you!!
Thank you :) Keep at it. The world needs plenty of programmers. You'll find the job you're looking for.
You are better than all of my C.S professors at college. Thanks man for these tutorials. You made this seem so much easier.
+Ankur Lohiya Thank you for the nice compliment :) You're very welcome
I use your videos for studying. Very well made. So much easier than re-reading slides and chapters from books. I appreciate all the time you put into making these.
Derek I really appreciated all the time, that you have been taking from your personal life to provide us such as great tutorials, I have not a lot of money to pay for teachers and all that stuff and you had been the greatest source of information regarding Java programing. God bless sir
Thank you very much for the compliments :) There is no money required. I'm happy I could help. May God bless you as well.
Thank you :) I'll show exactly how to do that when I cover how to make stacks and queues with Linked Lists. You made a great point, but you are getting a bit ahead of me.
Thank you for taking the time to write such a nice message :) You're very welcome and may God bless you and your loved ones as well.
Thank you :) I do my best to present the information in new ways. I'm glad they are helping.
Stacks like a stack of drying dishes; You take the one on top off first. Queues are like a queue for a bus. First come first served.
Thanks for helping others :)
Derek Banas and thank you for helping me through university!
Love your Coding Skills Sir,
Especially the Easy Variables you use Solve half the Problem and the display methods just LOVE !
hotmandead1 Thank you :) I'm glad you enjoy them
Thank you :) As the tutorial continues I use them for sorting and other things. I hope they help
Thank you for putting up these tutorials. You deserve to be commended for this.
You're very welcome :) The pleasure is all mine. I have met many wonderful people all over the world from doing this.
Your presentations are very good and well put together.... You deserve an award for this...
Thank you :) Appreciation is more then enough for me.
He subido el video antes de acostarse. Estoy haciendo videos tan pronto como sea posible. Yo no esperaría que una todos los días a las 11 :)
This is just what i needed. It's way more direct than my dry programming book. Subscribing!
Thank you :)
Thank you so much for all of these Java tutorials! You are honestly a lifesaver! :)
In the past two hours I have learnt soooooo much, just from watching your videos!
Very helpful, Derek.
Learned a lot, and I deeply appreciate your contribution to the learning.
Thank you very much :) I'm glad you found it useful.
Thank you so much ! You're an inspiration for new tutors like me🙏
Thank you :) I wish you all the best
@@derekbanas thanks a lot😊
Thank you :) many more are coming as quickly as possible
Derek, I must tell you this, you are doing a real good work with your videos, your way of explaining such complex concepts are simply the best. I like all your videos, thank you so much. Take care and god bless!
Thank you :) Some day maybe I'll cover different topics again. I love to teach different topics. The programming stuff just come easy to me though because I have been doing this stuff all my life.
Thank you so much Sir for doing all these your are providing best video tutorials in the planet
Thank you very much for the nice compliment :)
One night to finish my lab. YOU made it possible! Thank you so much! :)
Kalle Great I'm glad I could help :)
Your programming is amazingly proficient! I like all the algorithms videos.
I wish you the best on your travels. The only traveling I've ever done is in books pretty much :)
Thank you :) I have been playing around with how I could provide homework and tools to reinforce the information. I'm working on a framework that I plan to use to make tablet / phone apps that will provide those tools. Don't worry they will be free. I'm planning to start making them over the coming months. It should be fun
Thank you :) Everyone is very nice to me and that is all I need.
Thank you for taking the time to put up these tutorials, they are awesome and very appreciated!!
You're very welcome :) I'm glad you like them.
You're very welcome :) I'm glad you enjoyed the video
Thank you so much for your great videos. You explain everything in such a clear manner. I look forward to watching all your videos.
Thank you very much :) I appreciate the nice message.
man, u did a really excellent job to illustrate every details! super helpful, I certainly cant understand if i only saw each video once, ;) thank u so much!
rujia hao Thank you for the nice compliment :) You're very welcome
Great Idea. Make exercises after the tutorial. Just like in schools :P after the discussion there's an exercises about the lecture. Great tuts Derek.
I just can't thank you enough for such knowledge packed videos
You're appreciation is all I require. I'm very happy that you enjoy the videos :)
I think for this the 'sysout("PUSH " + input + " added to stack")'
should be inside the if statement. If not what would happen hypothetically is that if the stack is full it's still going to print that the input was pushed, even though it's full.
Lone Star VII Good point :)
You are awesome Derek. These videos are a boon for interview preparations. 6 hour revision for the basic data structures!!..Thumbs UP..:-)
Your push method will display two messages in case that the stack is full. One that the stack is full and one that the input was added. You had to put the last line inside the condition.
Literally an entire semester in Computer Science summarized perfectly in 16 minutes.
You are huge inspiration to me. Thank you for everything.
Your programming skills, editing skills and a powerfull voice I can just dream about, make this videos perfect :)
Thank you for the nice compliment :)
Yes stacks are very much part of how computers and compilers work on a basic level
Yes I will cover most everything. The only issue I'm having is that some topics require knowledge of discrete mathematics. I'll do my best to make all of that understandable without making a tutorial on discrete math
This is sure to help in my Data Structures & Algorithms class. Thanks.
I hope it helps :)
Holy crap, I kind of understand java now! Thank you sir.
I'm happy I could help :)
i keep thinking what happens when the front and rear keep moving down the array and eventually go out of bounds? If the Front starts at index 4 of a array that has the size 5, then when you add an element to it wouldn't it go out of bounds
Hey man thanks for the video. It helped me a lot to get into stacks and queues. So it came, that I noticed a MAJOR mistake in your stack pop method. In line 45 you set the TopOfTheStack to -1 and also increment one down in line 47. In this case, it does not matter because you get your value printed out before but if you actually want to work with the method for advanced applications you always get the wrong output of always -1.
What would be a fix to this error then? I’m genuinely curious.
I'm very happy that I could help :)
You are great. I'm in my second semester of grad school, and after taking one semester of part 1 and 2 of core Java, and watching a few of your tutorials, you have given me confidence that I'll be OK in my Algorithms class this semester! Thank you. Please keep this going. Any advice you might have? Again, thanks! Also do you cover Discrete math?
Thank you very much :) I'm happy the videos are helping. Sorry, but I haven't covered discrete mathematics yet
Derek Banas Got it! Another question, do you have any videos where you actually compare algorithms using graphs and the "Big Oh" notation? Or Algo analysis in general? Again, the code is great stuff!!!!
Yes I cover Big O here th-cam.com/video/V6mKVRU1evU/w-d-xo.html
What are you looking for? Like exercises in text books? The only problem is that I don't have time to solve all of them, but I could give exercises that you should be able to solve if that works
Thank you :) I try to do my best.
one advice although a small one if you are taking input from the terminal using scanner use scanner object on nextLine() instead of next() method call as next will only pick the first word however we would want the entire line to be used and hence should use nextLine().
Thank you :) I have to cover other common interview questions that I don't cover here and in the design patterns tutorial
You saved this CS students butt, thanks dude. I'm never procrastinating on my CS projects again. Let me tell you that. : D
This is extremely helpful, job well done !
+Dean Bartolo Thank you very much :)
You are very good at this! You deserve a hug and HUGE pile of money :)
Thanks for all the tutorials! Its crisp, clear and excellent. Btw, what is the first sentence you always say in your videos? I couldn't decode that completely :)
+Manohar Sripada You're very welcome :) I say "Well Hello Internet"
Stack starts at 16:16
java.lang.NullPointerException
Sorry, but I don't understand all of the changes without seeing the actual code
I just used an array because everyone understands arrays. I'll provide more examples as the tutorial continues
Always a pleasure listening to your lectures. Continue the good work bro. : )
If you leave out the condition for the Queue to be full, Would you then have in the remove method : rear++; then rear = rear % maxNumOfItems. Similarly for insert would you then have front++; then front = front % maxNumOfItems? That way you can keep adding and removing stuff?
First off, let me say, great videos!! I'm refreshing my knowledge in the subjects because I essentially flushed em after my courses to make room for new info lol. I just had a small question... why not move all of the elements up after removing an item in the queue, to maximize space for new inserts?
Thank you so much you saved my finals
I'm happy I could help :)
You're very welcome :)
I think in insertPriority, ur for loop must span from rear to front instead, as numberOfItems may get decreased after some elements are deleted.
Perhaps the pop() method should be returning the oldValue prior to setting it to "-1"; hence:
public String pop(){
if (topOfStack >= 0) {
// display and print e.t.c
String value = stackArray[topOfStack];
stackArray[topOfStack--] = "-1";
return value;
}
//else print and report stack is empty e.t.c
}
** I didn't check all the comments below to see whether anyone mentioned this **
I also thought the same thing.
public String pop() {
String rep="";
if(topOfStack>=0) {
display();
System.out.print("
POP: The value at the top of the Stack "+stackArray[topOfStack]+" was removed from the Stack");
rep=stackArray[topOfStack];
stackArray[topOfStack]="-1";
topOfStack--;
}
else {
System.out.print("POP: the Stack is empty apparently. Unable to pop any Value.");
}
return rep;
}
dude you are awesome
Thank you for the compliment :)
J-Walker Official Truth!
is there anything you don't do teach!
great revision guide, thanks Derek.
but what if we added elements ,and then we removed them like that from the queue " front++; numberOfItems-- ; " , and then we added elements with the size of the array is reached by front ,even thought the condition of insertion still true ; here the numbers of elements is less than the size "if(numberOfItems + 1
it would be better if we do that right ?
for(int i=0;i
Sat in 1+ hour lecture on stacks at college. Came here to actually learn it and in 15 minutes.
I'm happy I could help :)
Thank you :) Basically I have everything in playlists. This is the order I would teach : Java Video Tutorial, Design patterns, UML, Object Oriented Design, Code Refactoring, Algorithms. I have everything in order on this page : newthinktank. com/2011/10/every-article/#java
Your are awesome teacher, Thank You.
Thank you very much :)
Yes I have linked lists tutorials in the algorithm tutorial on my TH-cam channel
Forgive my ignorance as I am very new but in your pop method, the stack is displayed prior to the -1 assignment. This causes the display to show the value removed. I moved the under the "-1" assignment, just above the return and now it displays the stack without the popped value. Am I correct in doing this or is there something I missed. Again, you rule!
New version:
public String pop(){
if(topOfStack >= 0){
System.out.println("POP " + stackArray[topOfStack] + " Was Removed From the Stack
");
// Just like in memory an item isn't deleted, but instead is just not available
stackArray[topOfStack] = "-1"; // Assigns -1 so the value won't appear
displayTheStack();
return stackArray[topOfStack--];
}
Thanks for your video, but I have a problem about pop() in stacks. When I pop the item from stacks, It still in stacks? But I think pop means remove the item and return it. Not only "not available or not be seen"
Hola entrenador,
Gracias por este video muy conceptual.
Es una base.
También se alegrarán de saber que tengo en el cuadro de medallas.
Silver para mí!!
Ahora sé que el vídeo en tiempo es 11 pm EST :)
thank you sir, i really glad to watch your tutorials :)
Derek, I believe that there is a bug with the insert method in TheQueue class. I was testing the class, and I'm getting an ArrayIndexOutOFBounds exception at the boundary condition when the underlying array has been "used up" . To fix, I replaced the insert method logic with .... if (numberofItems +1
Derek,
'priorityInsert()' methods has a serious bug. Quick check, remove an item and call this method. Reason is, for-loop condition in this method is wrong.
+Ethashamuddin Mohammed yeah, need to check if queue is full. otherwise queueArray[i + 1] doesnt exist
Thanks. Great tutorial. But shouldn't you wrap the rear and the front to the beginning of the array if they are equal to the arraySize? I mean just increasing them will cause a null pointer exception at some point.
i have one doubt derek bans regarding the insertion operation that inside the insertion operation should we keep the if condition like this if(numberOfItems < queuesize) then we should go further i guess the condition if(numberOfItems +1
Hello sir can you do a stack and queue combined
Hi Derek thanks a lot of your videos. The insert method you use in the queue class is it the same as enqueue() which adds new items to the end of the queue. thanks in advance
Really great videos, I've learned so much so quickly!!! :)
Joseph Kremer Thank you very much :)
Hey just a quick question: I thought we aren't supposed to move the first pointer when deleting, instead shift all elements once to the left. And I know in order to do that, the time-consumption is O(n^2), but wouldn't you have more problems in the future when your wasting space at the front? When do you recover the space?
Thank you :)
WELLHELLODEREK! Thank you for the video from 2019!
Well Hello :) I'm happy to be of help
This may be a stupid question but: In your pop method you set stackArray[topOfStack] = "-1" then return stackArray[topOfStack--] wouldn't that just return -1, not the value that was removed?
When you design the queue using the array. The from and rear doesn't rotate which does not make sense. This queue doesn't work well I think
Great explanation! Thank you!
Really nice content dude... keep doing the great job!
Btw, nice reference to the Stephen King's master piece on the code... It was "shining" !
Thank you very much :) You got it
Hi Derek, greetings from İstanbul city. My training will be finished on next Tuesday then I'll fly to Jakarta and start to work there. Hope you're doing alright
How did you create the console output on the right with the values in the stack? He would be good at teaching. Can you help me in this?
Great job!
I actually have a question! Say I want to remove an item from the queue and I do. I wanted my front to stay at index 0, and every other value to shift down... :/
I don't understand why in Queue remove you make front++ (line 51 12:22)? Logically we should decrease front by one, no?