You just saved me hours of reasearch through barely understandable material, you're a life saver!!! Thank you! Your teaching style is really great and exactly what I need as a newbie!
This channel is so underrated. I just watched a video(won't name the channel) in which the guy just said, "The elements are hashed everywhere, so it's called HashSet". This freaked me out! Trevor knows what he is talking about, unlike some other guys who don't.
Thanks for paying attention to details and breaking down everything for us to understand. Not many instructors do that like you do. I just subscribed because of your analytical teaching.
@@CPY-ed in 2019 boy/dude is a gender neutral term meaning friend, fellow, comrade, associate, etc. Also means a member of a group having common characteristics, in this case programmers.
Hi and thank you for the video. I'm wondering why we don't write: HashSet mySet = new HashSet(); Is it just by convention that it's good practice to show that HashSet is an implementation of the Interface Set? And that it's not some other class?
Trevor, you are a true legend of all time. I am watching in 2019 and by far the old 2015 video still the one that helped me out. I like your style, please continue.
Yes, this is an old topic, but I still have some confusions. In Java, people say: 1)ArrayList is faster than LinkedList if I randomly access its elements. I think random access means "give me the nth element". Why ArrayList is faster? 2)LinkedList is faster than ArrayList for deletion. I understand this one. ArrayList's slower since the internal backing-up array needs to be reallocated. A code explanation: List list = new ArrayList(); list.add("a"); list.add("b"); list.add("c"); list.remove("b"); System.out.println(list.get(1)); //output "c" 3)LinkedList is faster than ArrayList for insertion. What does insertion mean here? If it means to move some elements back and then put the element in the middle empty spot, ArrayList should be slower than LinkedList. If insertion only means an add(Object) operation, how could this be slow?
1) When accessing an element in an array list, you specify the position of that element, so it can be accessed immediately, whereas the linked list has to iterate from its first element and all the way to the specified element. 3) If you add an element in the middle of the linked list, all it has to do is changing the pointers of its neighboring elements. However, if you do that in an array list, you will have to create an entirely new array and move the old values into this array. This will also have to be done if you add a new element to the end of the array list such that it now is bigger than its allocated size.
@@DariushMJ For future viewers, Martin's response to 3 is partially correct. Moving all of the old values to a new array is only necessary if the insertion of an element will result in the internal array being too small, meaning that a new array must be created. However, if the array has extra space that is unused, this is not the case. However, the insertion will still be O(n) because, in the worst case, the insertion happens at the beginning of the array, so all of the other elements to the right will need to be moved one spot over. Also, to be clear about the insertion process for a LinkedList, searching for the spot for the element to be inserted at is an O(n) process, but the actual insertion itself is O(1) for the reason Martin mentioned above.
Hey Trevor, whats the point in creating objects of hashset and storeing them in a more generic variable such as sets? We loose most of the hashset based methods???
Nice tutorial, but it would be a lot better if the mouse would not constantly be zipping back and forth. It makes the video somehow nervous and hard to follow. (So, just as a tip: Keep the mouse still when not writing.) Even circling something, especially fast is irritating. (At least for me ;) ). Otherwise. Keep up the good job!!!
You just saved me hours of reasearch through barely understandable material, you're a life saver!!! Thank you! Your teaching style is really great and exactly what I need as a newbie!
Glad I could help!
This channel is so underrated. I just watched a video(won't name the channel) in which the guy just said, "The elements are hashed everywhere, so it's called HashSet". This freaked me out! Trevor knows what he is talking about, unlike some other guys who don't.
Thanks for paying attention to details and breaking down everything for us to understand. Not many instructors do that like you do. I just subscribed because of your analytical teaching.
watch in 1.5 speed boys
Thank you
1.5 speed? Real programmers listen at 16X speed using Chrome extensions
@@CPY-ed in 2019 boy/dude is a gender neutral term meaning friend, fellow, comrade, associate, etc. Also means a member of a group having common characteristics, in this case programmers.
@@RichardCMongler does this extend to compound words? If I have a girlfriend, could I say she's the best boyfriend as well?
@@CPY-ed SIMP
Well done - simple to understand a concept in such a short amount of time.
Hi and thank you for the video. I'm wondering why we don't write: HashSet mySet = new HashSet();
Is it just by convention that it's good practice to show that HashSet is an implementation of the Interface Set?
And that it's not some other class?
Trevor, you are a true legend of all time. I am watching in 2019 and by far the old 2015 video still the one that helped me out. I like your style, please continue.
Awesome to hear. Thanks for the positive comment. It also helps that HashSets haven't changed since 2015 ;)
@@CodersCampus Absolutely...
Good video, now I know how HashSet works
can you please explain hashset algorithm that does not allow duplication and also it give us values in unorder form
You can use a TreeSet to go into order
Yes, this is an old topic, but I still have some confusions.
In Java, people say:
1)ArrayList is faster than LinkedList if I randomly access its elements. I think random access means "give me the nth element". Why ArrayList is faster?
2)LinkedList is faster than ArrayList for deletion. I understand this one. ArrayList's slower since the internal backing-up array needs to be reallocated. A code explanation:
List list = new ArrayList();
list.add("a");
list.add("b");
list.add("c");
list.remove("b");
System.out.println(list.get(1)); //output "c"
3)LinkedList is faster than ArrayList for insertion. What does insertion mean here? If it means to move some elements back and then put the element in the middle empty spot, ArrayList should be slower than LinkedList. If insertion only means an add(Object) operation, how could this be slow?
1) When accessing an element in an array list, you specify the position of that element, so it can be accessed immediately, whereas the linked list has to iterate from its first element and all the way to the specified element.
3) If you add an element in the middle of the linked list, all it has to do is changing the pointers of its neighboring elements. However, if you do that in an array list, you will have to create an entirely new array and move the old values into this array. This will also have to be done if you add a new element to the end of the array list such that it now is bigger than its allocated size.
@@DariushMJ For future viewers, Martin's response to 3 is partially correct. Moving all of the old values to a new array is only necessary if the insertion of an element will result in the internal array being too small, meaning that a new array must be created. However, if the array has extra space that is unused, this is not the case. However, the insertion will still be O(n) because, in the worst case, the insertion happens at the beginning of the array, so all of the other elements to the right will need to be moved one spot over.
Also, to be clear about the insertion process for a LinkedList, searching for the spot for the element to be inserted at is an O(n) process, but the actual insertion itself is O(1) for the reason Martin mentioned above.
Its not explaining internal implementation of HashSet
Thanks for explainging this datastucture really got a better understanding now of Set and Hash Algorithm.
what ide do you use? those little boxes with return types and parameters send really helpful.
It's eclipse I guess
Thank you. Your video is so great to me.
You helped me so much , Thanks Trevor!
what kind of tool you use for teaching?
amazing video and explanation to the point☺☺☺☺
very good tutorial thank you!
"As quick as a nutshell" - 20:11
The benefits of unscripted tutorials. Absolute majestic discord ensues!
Thank you so much. It is a simple and clear explanation.
Great video, i will be watching more!
so it basically gives the numbers a random position ?
+Ozziyness Yes, and also has no duplicates.
Crisp and clear!
Finally, find a non-Indian Tutorial
After theory, coding 12:00
I'm unable get the hashing algorithm
this helped me so much! thank you!
Thank you i found this video so helpful.
Thanks mate, really useful.
Thx a lot for the information
Thank you so much!!! Your video helps me a lot! You're awesome!
thank you sir
wow thanks this was very helpful!
What IDE is that
eclipse
Spring Tool Suite (which is just Eclipse with some Spring plugins pre-installed)
Great video!
Thank you!!!
You're most welcome Giacomo!
Pretty neat. Thank you.
Couldn't buy your tutorials. Would like to contribute with a thumbs up.
nice try man , thanks
explained well,tq.
Solid explanation. Thank you.
I try my best, glad you liked it
Hey Trevor, whats the point in creating objects of hashset and storeing them in a more generic variable such as sets? We loose most of the hashset based methods???
Thank You!
1.25 speed is ok for my sleepy brain. 1.5 sounds weird
17:27 hahahahahaha
thank u
Nice tutorial, but it would be a lot better if the mouse would not constantly be zipping back and forth. It makes the video somehow nervous and hard to follow. (So, just as a tip: Keep the mouse still when not writing.) Even circling something, especially fast is irritating. (At least for me ;) ). Otherwise. Keep up the good job!!!
indeed I noticed that as well
Khan Academy vibes
Thank you!
thank you!
You're welcome!