Why set is unordered? How internally set working? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why set is unordered? How internally set working?

Anyone please explain this clearly. I am expecting that you people should answer it easily. Thanks in advance. Jan Markus mitali jadhavrao

26th May 2018, 1:07 PM
$¢𝐎₹𝔭!𝐨𝓝
$¢𝐎₹𝔭!𝐨𝓝 - avatar
3 Answers
+ 4
The Great Saga Jan Markus has already explained how set is implemented internally.When searching a element of list you have to look through the entire memory to find it which makes it slower.On the other hand in case of sets you will be looking for a particular hash which makes it faster. Example:You need to find a book in library.You dont know what category it belongs to so it takes a lot of time to find it. But on other hand you know the book you need to find is mythological so you search for it in mythological section which makes it faster.
26th May 2018, 1:49 PM
Mitali
Mitali - avatar
+ 4
Jan Markus It's a pleasure for me😄😊
26th May 2018, 1:49 PM
Mitali
Mitali - avatar
0
Jan Markus Thanks for the reply. could you please explain how sets are faster than list? Do you have any coding example?
26th May 2018, 1:29 PM
$¢𝐎₹𝔭!𝐨𝓝
$¢𝐎₹𝔭!𝐨𝓝 - avatar