No video

STL std::unordered_set (std::algorithm generate_n for creation of sets) | Modern Cpp Series Ep. 122

  Рет қаралды 2,154

Mike Shah

Mike Shah

Күн бұрын

►Full C++ Series Playlist: • The C++ Programming La...
►Find full courses on: courses.mshah.io/
►Join as Member to Support the channel: / @mikeshah
►Lesson Description: In this lesson I give you an introduction to the std::unordered_set data structure which is an unsorted data structure storing unique elements. The advantage is in this case the ability to have average time constant lookup, insertion, and removal. I'll spend some time introducing the concept of a hash table at the start of the lesson, and then I'll also show you how to generate sets using the stl algorithm generate_n.
►KZfaq Channel: / mikeshah
►Please like and subscribe to help the channel!
►Join our free community: courses.mshah....

Пікірлер: 10
@tanveerasif5978
@tanveerasif5978 2 ай бұрын
Thank you so much for wonderful underneath concept.
@MikeShah
@MikeShah 2 ай бұрын
Cheers, you are most welcome!
@MightyMoveSemantics
@MightyMoveSemantics 11 ай бұрын
@7:39 Bucket Count (e.g., std::unordered_set s(5);) This is about organizing the internal storage with a specified number of buckets. Elements are distributed among these buckets based on their hash values. Suppose you insert an integer 14. The hash function calculates a hash value, let's say h(14) = 14 for simplicity. The bucket index is then 14 % 5 = 4, so 14 is placed into bucket 4. reserve(5);: This is about optimizing performance by minimizing the number of rehashes when inserting elements. It does so by ensuring there's enough space allocated to hold the specified number of elements without needing to rehash. Am I right?
@MikeShah
@MikeShah 11 ай бұрын
That sounds about right to me!
@thestarinthesky_
@thestarinthesky_ Жыл бұрын
Thanks Mike for this great video 🤩! I have a question why @23:36 we got that error? I didn't get it quite why.
@MikeShah
@MikeShah Жыл бұрын
I think I just had the wrong type -- needed an iterator that can insert.
@shrek1412
@shrek1412 Жыл бұрын
may I know difference between unordered_set and unordered_map?
@MikeShah
@MikeShah Жыл бұрын
Unordered set only contains keys, whereas unordered map is a key/value pair. (I.e. stores the keys, same as map, but those keys are used to index and return a value)
@AyushAnand-oj1kl
@AyushAnand-oj1kl Жыл бұрын
can you provide me your vim step file and commands to use it.
@MikeShah
@MikeShah Жыл бұрын
I use a vanilla vim and occasionally code completion: kzfaq.info/get/bejne/f7hmo8mc1tDGp2w.html
STL std::map  | Modern Cpp Series Ep. 126
36:13
Mike Shah
Рет қаралды 3,4 М.
wow so cute 🥰
00:20
dednahype
Рет қаралды 31 МЛН
He bought this so I can drive too🥹😭 #tiktok #elsarca
00:22
Elsa Arca
Рет қаралды 13 МЛН
Violet Beauregarde Doll🫐
00:58
PIRANKA
Рет қаралды 40 МЛН
ASMR Programming - Spinning Cube - No Talking
20:45
Servet Gulnaroglu
Рет қаралды 3,8 МЛН
Master Pointers in C:  10X Your C Coding!
14:12
Dave's Garage
Рет қаралды 301 М.
How much faster has Mojo's dictionary gotten?
7:40
EKB PhD
Рет қаралды 3,6 М.
STL std::unordered_map (C++11)  | Modern Cpp Series Ep. 129
40:42
std::unordered_set In C++
11:50
CppNuts
Рет қаралды 33 М.
unique_ptr: C++'s simplest smart pointer
11:54
mCoding
Рет қаралды 43 М.
Rust and RAII Memory Management - Computerphile
24:22
Computerphile
Рет қаралды 225 М.
Turns out REST APIs weren't the answer (and that's OK!)
10:38
Dylan Beattie
Рет қаралды 152 М.
STL std::set | Modern Cpp Series Ep. 121
24:15
Mike Shah
Рет қаралды 3,5 М.
wow so cute 🥰
00:20
dednahype
Рет қаралды 31 МЛН