After a year hiatus (sorry, got busy with work!) this series is continuing! Check the next video out here: kzitem.info/news/bejne/mJ2NrIZ3aYhhgno
@danyahsan3958
6 ай бұрын
Please moreee nd in java
@alanyates6377
5 ай бұрын
Thanks bro, eagerly waiting for your content.
@NeetCode
2 жыл бұрын
Great stuff! Super underrated channel (but not for long i bet =) )
@Codebagel
2 жыл бұрын
NO WAY YOU COMMENTED! Thank you so much, you’re actually the reason I was inspired to start this channel so I really appreciate you commenting! PS: everyone go sub to this man, single-handedly helped me get a job :)
@eternalpanic1
2 жыл бұрын
Yooo NeetCode is here yay!!!!
@hamoodhabibi7026
2 жыл бұрын
!!! Ur both great 👍
@kvelez
11 ай бұрын
Good chanel
@mohammadkaif2534
9 ай бұрын
bhai saxx tha aur bnao
@servantofthelord8147
Жыл бұрын
Wow. It makes sense now. It finally makes sense. Thank you!
@Codebagel
Жыл бұрын
You're welcome! I'll finish up the series in the coming weeks!
@samm4258
Жыл бұрын
After 4 days of struggling, this video finally gave me the breakthrough to understand hash maps in my self taught journey. Concise and coherent, this is the best tutorial video I've seen so far!
@Peter-hz3vs
3 ай бұрын
Yes. It can be dry to learn about hashmap suddenly. But this video took me from only knowing those several datatypes to understanding it. This is just crazy.
@drstrangeluv1680
5 ай бұрын
The video was great! However, if you use the SORT method, the best time complexity you would get is O(nlogn). If you want to solve it in O(n), a clever approach is to first check every word and create a key value pair of every letter. For example, you go through the first word and get 3 'a', 2 't' and 4 'e'. Now you save this in a dict { 'a':3,' t':2, 'e':4 }. Then, you go through every other word and do the same. If you find any other word with 3 'a', 2 't' and 4 'e', you have found an anagram. So just comparing the dicts at the end would give you the anagrams. You would go through the list only once so you have time complexity O(n). P.S. you should first check if two words are the same length. If not, you can automatically cancel them as anagrams.
@BAMBAMBAMBAMBAMval
Жыл бұрын
This is what should be ranked #1 when searching for "python hashmap"
@Codebagel
Жыл бұрын
Thank you!! I’ll be making the full series soon so don’t worry!
@kaiser5026
Жыл бұрын
Not even half way through this video and I just want to give props to how concise the information is. I hope to see some machine learning content soon :)
@bogdan8204
8 ай бұрын
this is first video, but i'm already excitement about learn next algoritm in this series. The best.
@Codebagel
8 ай бұрын
Just uploaded the newest one after a long break!
@realbutters
Жыл бұрын
Great video. It’s hard to strike the balance between keeping things concise while also exploring them fully, but you did an incredible job of it here.
@vazp3
4 ай бұрын
great video :)
@auzee4925
8 ай бұрын
city_map = {} cities = ["Calgary", "Vancouver","Toronto"] city_map["Canada"]= cities # This works so much better
@PatrickFliervander
Жыл бұрын
dude like wtf, dthe moment you said city_map = dict() i was like wtf, i've be working with hashmaps for the past 6 months and i had no clue
@CLove511
2 ай бұрын
Been hearing DS&A nerds talk about these for ages, so disappointed to learn they're just Dicts
@salaudeenilyas3680
Ай бұрын
@@CLove511 i'm today's years old too just knowing that hashmaps are the regular dictionary that i've been using for a while smh
@angelicking2890
Жыл бұрын
Why the funny names in programming? This always happens whenever I try to resolve a problem. Why can't they just say it how it is ? I was intimidating hearing a crazy word like HashMaps only to find out I've been using them the whole time, dictionaries. Same goes for relational databases. I've been using them the whole time but because I didn't know what the interviewer meant by relational, I messed it up and she gave me an eyeball like I was a fraud. I still remember the "oooOOk Kaaaay". Just say , "you know the database with manytomanyfield or onetoonefield?" instead of these nonsensical words. Talk practical not theory. Idiots.. Sorry for the rant, it's just these funny names can trip up people.
@johnsonw
25 күн бұрын
currently taking DSA, nice explanation and pacing. thanks so much dude
@charlie5764
2 ай бұрын
I have a question about sort(). From what Ive read, using sort() runs at O(nlog(n)), is this still the case for using it on a string even though strings are limited to a small number of letters? Thanks in advance!
@trideeproy1080
Ай бұрын
Next video of this series? I need it badly for learning DSA from scratch...
@kvelez
11 ай бұрын
**Keep uploading more LeetCode, NeetCode, DataStructures and Algos. cities = ["Calgary", "Vancouver", "Toronto"] city_map = {"Canada":[]} city_map.update({"Canada":cities}) print(city_map) ============================ from collections import defaultdict class Anagram: def group_anagrams(self, strs): anagram_map = defaultdict(list) for s in strs: anagram_map[tuple(sorted(s))].append(s) return list(anagram_map.values()) anagrams = Anagram() print(anagrams.group_anagrams(["eat", "tea", "tan", "ate", "nat", "bat"]))
@xa6859
8 ай бұрын
I like the `return list(anagram_map.values())` instead of doing a second loop.
@sidandhawa
Жыл бұрын
The explanation on this was so clear. Absolutely brilliant. You have gained a new subscriber and I can't wait to see this channel grow the way it deserves to!
@siddharthasankarray2354
9 күн бұрын
your way of explaining was way good and felt like easiest question.
@ooogabooga5111
8 ай бұрын
how simple, i didn't it was this simple to think. Find two numbers which gives the sum 10 from a list of number lets says [ 1, -3, 4, 6 , 9 ]. So here I would say for 1 the number is 9, -3 its 13 so on. So essentially I created a dictionary (hash map) with key as the result of 10-1, so when I want to check for the next number is the one, i can just check arr[9] and if its present then I have the first solution. Damn.. To make it even more simple, you take your question process it for every element in the array in a way that the dictionary benifits from the result you generate. Ig thats hashmap, its just making dictionary. In that logic an array is a hashmap where the key is already defined. so its O(1) from start, but for hashmaps sinse you need to check every element to create a hashmap the the program is O(n) or more as it depends on question but once the hashmap is created the order its exec is O(1)
@misslaurenbecca
6 ай бұрын
Great video. After I watched your video, I tried to code it myself without looking and tried to do it without defaultdict(), just adding my first val as a list and then appending to the list for the following ones. After I had done that, I converted it to be like yours. Besides the obvious benefits, something else I realized was doing it your way removed the need to check if a key was already in the dictionary. In my version, I had to make that check, otherwise, I would be attempting to append to a list that hadn't been created yet.
@albertnaa8770
2 ай бұрын
On timeline 5:33, you initialized city_map with list, can you add other data structures such as tuple in it? Am new to python, I hope my question makes sense
@notmimul
7 ай бұрын
for the results, you could just use result = list(anagram_map.values()) correct me if this is not the correct way. tq
@bhavybhatt4571
8 ай бұрын
hey bro thank you so much don't focus on views just post and you'll make historical content as your vids are easy to understand because of the analogies you use thank you so much buddy lots of love from india
@abhisheksharma10600
7 ай бұрын
Please complete this playlist, its really helpful. Btw i just subscribed so keep up the work please.
@gurusamymari4586
2 ай бұрын
sir instead of using we can use return anagram_map.values() this will be more efficiant
@futhedude4848
Жыл бұрын
great hash map explaination, plus it have leetcode example and explaination for the answer in detail at the end of the video which is really great.
@pauolive7239
Жыл бұрын
But isn't sorting each of the strings inside the loop making the time complexity O(n * nlogn)?
@TimurKupaev
5 ай бұрын
I don’t think you can use import for the most of the interviews
@VhhJjj-c7g
2 ай бұрын
How are hash maps faster if they are built on top of arrays and use index to find the value?
@Bond00.7
Жыл бұрын
Bro why didnt you continued this series 😢 plz tell us if u moved to another channel we need you
@c11r11
3 ай бұрын
Without the defaultdict is a bit more complex to solve :`)
@sheryarbaloch67
6 ай бұрын
Kinda felt happy to see Pakistan in the example, i don't know why😂
@DevoutJourney
Жыл бұрын
I love the fact you go through an actual problem at the end. That made it “click” for me. New sub here, please keep it coming!
@AdityaRaj-xm6oi
Жыл бұрын
This was a really amazing learning video, I like your style of teaching that first of all you made the concept clear and then a question to make it more clear. Btw I was here because I didn't get clarity with the neetcode channel of the same question. so I request you to upload these types of videos more thanks 🙏
@Codebagel
Жыл бұрын
Glad you enjoyed it! I'll see what I can do!
@SashoSuper
7 ай бұрын
And I had to search in Japanese to find the video, even better.
@yoman6367
5 ай бұрын
can we use long long type and do bit-masking?
@coolsidofficial
2 жыл бұрын
Your content is way better than any paid one ,but you seriously need to do marketing ,make some content related to india and your channel will get some instant boost , make a video on "Top 10 common python algorithms asked by Maang in India" ,btw love from India
@Codebagel
2 жыл бұрын
Thank you so much! I have a bit of a long-term plan in mind regarding this, I’ll definitely add that video to the list though! :)
@najeebshaik9064
Ай бұрын
I didn't understand the part where the strings got assigned to the respective key automatically. How did that happen? Is it the work of defaultdict?
@najeebshaik9064
Ай бұрын
I understood after practicing. After sorting ate and eat will have same key (a,e,t). So they get assigned automatically. Nice one.
@boomantv8271
Ай бұрын
Let me start off saying i really appreciate the content. It really filled in a gap in my own understanding in how i can use hashmaps. Question, correct me if I'm wrong please, I'm still learning code and computer science in general, but if the key is being transformed by a hash function, which to my knowledge, doesn’t care what order the input is, meaning it will give the same hash value and map to the same array index regardless of the order, do we need to sort it at all? I guess in terms of readability it helps, i guess im just am looking at the fact there is an additional operation being performed to sort the characters into a new list. I know it wont affect performance significantly in a example where there are three characters being sorted and im being a little weird like "what if i had a list of regular expressions?" or something where the data can be arbitrarily long. Also, would that eliminate the need to cast the result of sorted_s as a tuple? I dont know if python under the hood treats strings as a list or something else. If it does, wouldnt that also eliminate another operation. Again, i want to thank you for your time and effort and its great content for sure and it helped me learn more about something im deeply passionate about. Just want clarification if im misunderstanding something.
@boomantv8271
Ай бұрын
Nevermind the order does matter for hashes and the tuple implementation seems to make sense to me now but the other question still stands. Again, im a scrub here just looking to learn.
@prao2tapper
11 ай бұрын
why did such a small code at the end take such a long time for me to understand
@ManojMallisetti
5 ай бұрын
where did you created the module collection
@aninditabatra3810
Жыл бұрын
great content and will continue to watch in the future :)
@L00p69
5 ай бұрын
thanks WholeHeartedLy !!
@francois-xaviermenage4531
7 ай бұрын
Are hash maps and hash tables really the same?
@samstar1290
Жыл бұрын
Please make videos often , stuff is great and smooth
@Codebagel
Жыл бұрын
Have one coming out tomorrow!
@fabriziomarchetti7030
Ай бұрын
I am just starting to study DSA by myself and this video was EXACTLY what I needed. You explained it so well that I thought the leetcode problem was EASY. Great video!!!!!
@PrasadPatil-eg1lo
2 ай бұрын
Underrated quality channel , note:- [add more interaction in video(llike use pencil or notepad for raw explain ), cause people like interaction.]
@pixiepastels1070
8 ай бұрын
why do another for loop why not just return anagram_map.values() ? it already returns a list and the values are in a list so its already a list of lists
@xa6859
8 ай бұрын
Because of the `defaultdict(list)` => "TypeError: 'list' object is not callable". You will need `list(anagram_map.values())`
@amarnani3501
Ай бұрын
Guddhabagala cheppinaw❤❤❤
@kadspy
10 ай бұрын
Dude, you have used sorted inside a loop, isn't it increases a time complexity.. Here, you are claiming O(n) but i think its greater than that because sorting function of python also taking some time complexity based on "n".
@Locus616
5 ай бұрын
you make good coffee wao wao wao wao
@saideep7510
Ай бұрын
Brother I literally saw 8 videos about hashmap and was always getting confused at one part or the other. Your video literally is a goldmine. Thanks for adding an example problem helps a lot!
@krishnapathak9362
7 ай бұрын
Hey codebagel i request you to please upload complete dsa playlist using c++ and loved your amazing content
@InDaHoops
8 ай бұрын
So, ive been programming in python for a little over a year, and i've always seen those hashmap memes, and how they're the solution to everything, but the name Hashmap just seems intimidating, so i never bothered thinking about using one or looking up what it is...until this day, when i realized its just a dictionary, and I've been using them all the time lol Great video, keep it up!
@spiritual5750
2 жыл бұрын
Seriously man, i could see your hard work through this video.
@Codebagel
2 жыл бұрын
Thank you so much! That means a lot :)
@chamarr
2 жыл бұрын
Goat vid codebagel, do more implementation vids!!!
@Codebagel
2 жыл бұрын
Thanks so much! I’ll keep on making them!
@colinsimon777
2 ай бұрын
A+ instruction video. Clear and concise. Just subscribed.
@MysteryIlusion
Жыл бұрын
Can I just return anagram_map.values() instead of the result list? I'm not sure if there's some kind of issue later on but is it faster to do it by returning values since it is already in list form rather than adding 1 more for loop?
@ooogabooga5111
8 ай бұрын
sorting has its time complexity right, how is this optimal? who decides that?
@PierreCarette
Ай бұрын
list comprehension
@rayaqin
6 ай бұрын
using the equal sign to denote a key -> value connection is not a good choice imo
@denatolix
Жыл бұрын
Thanks! You really help me! Wish you 1m subs and more
@DishaSharma-mm3zo
2 ай бұрын
Great explanation
@jaganmayeesahoo4210
10 ай бұрын
wow, still wrapping my head, I am new to it, but its very concise and all good content, man.
@blackshadowproductions5144
7 ай бұрын
Your explanation is simply the best one I found, thank you so much man!
@markopancic6060
Жыл бұрын
For the result you should have just called .values no?
@chwenjun225
Жыл бұрын
That's incredible, I understand it right now. Thanks you, it really simple explaination and easy to understand
@dhirajsahu2026
Жыл бұрын
Great Work! Nice Explanation Dude. Really helpful
@panwilku6146
6 ай бұрын
I watched this video like 3 times over a month ago, and I was struggling with understanding the logic even though you tried so hard to explain it. Now, after some practice, I watched this video once again and I can say I understand the code perfectly now. I just wrote the code before seeing the solution. Thank you for yours videos, one of the best channels out there!
@Locus616
5 ай бұрын
wao wao wao
@vellankiindeevar5530
Жыл бұрын
bro do more vids about all dsa pls , this vid is really good
@livelikeawarrior9180
Жыл бұрын
Damn, that's a very good video ...
@jamalghatit
Жыл бұрын
Great job! thanks for your video
@CarlosLopez-fg3fl
7 ай бұрын
You're great, good explanations
@Salmo_103
9 ай бұрын
The best explanation I found about this topic yet! Thank you so much, God bless you
@ashraf_isb
6 ай бұрын
thank you
@bogdan8204
8 ай бұрын
the best ....
@nalininadupalli3131
Жыл бұрын
Hello, thanks for a great video! Can you also please explain if Hash Tables and Hash Maps are the same (in general) ? If different, how does python dictionary Data structure handle them? thanks so much in advance !
@willmccauley22
11 ай бұрын
Appreciate the video, well explained 👍
@alejandroolaria
Жыл бұрын
This is awesome! thank you very much for making this video!
@saatvik1
7 ай бұрын
Lovely Vid!! Great Work
@1hkd29
Ай бұрын
5:33
@speedoi-bh7kg
Жыл бұрын
nice job keep going =)
@Codebagel
Жыл бұрын
Thank you!
@dsa0decoded
Жыл бұрын
Great Explanation you should make more videos
@Codebagel
Жыл бұрын
Thank you! I plan on doing it a lot more frequently over the coming months!
@mansikumari4954
11 ай бұрын
Simply Wow - from a noob!!
@mrzhambyl
Жыл бұрын
IMO, best explanation on YT
@KanjiBBB
Жыл бұрын
ngl ur actaully a good teacher
@lahoussinezeggwagh608
2 жыл бұрын
Please dsa in cpp
@Codebagel
2 жыл бұрын
Will do in the near future!
@futhedude4848
Жыл бұрын
Man, this channel only have 19 videos at this time. I wish you could do more about algorithms and data structure.
@Codebagel
Жыл бұрын
Been getting lots of positive feedback on it, so I'll get back to working on the series in the coming weeks!
@futhedude4848
Жыл бұрын
@@Codebagel thanks. i'm waiting for it.
@Codebagel
8 ай бұрын
@@futhedude4848just uploaded, took a lot longer than I expected but it’s out now!
@futhedude4848
8 ай бұрын
@@Codebagel thanks, i'll check it
@zohayer.mehtab
9 ай бұрын
Thank you so much!
@shortandshine8279
Жыл бұрын
Awesome, keep it up
@brianc.3609
Жыл бұрын
love this video!!!!!
@manickamm2671
Жыл бұрын
Great channel
@md.mahbubanamtanim9081
4 ай бұрын
Excellent!!
@sak.4001
9 ай бұрын
underrated
@freecontent2438
Жыл бұрын
Dammm🎉
@gy7230
Жыл бұрын
Amazing Man, you and @Neetcode are the best channels for learning python
@Codebagel
Жыл бұрын
Thank you for the kind words! I'll finish up the series in the coming weeks!
Пікірлер: 134