deleting an element from an Array is o(1) only for if the element is the last element on the array ,so if i want to remove an element from middle it is o(n) ,
It is almost the same as a dictionary…the major difference is that a hashset is synchronised (works good in a multi threading code) The use of Dictionary is now kind of obsolete and deprecated. You are not advised to use a Dictionary
Thank you bro. Clean explenation :)
Helped me a lot!
This is Gold!
O(1) for deleting an element in an array is debatable, if you want to move the above elements down to fill the gap it gets slower.
deleting an element from an Array is o(1) only for if the element is the last element on the array ,so if i want to remove an element from middle it is o(n) ,
in an array, you can go straight to an index. That means O(1)
I just wanna know, is the time complexity O(1) for a Linked List at the head and tail?
to add an element at the tail of the linked list, the time complexity is O(n).
to add at the head, the time complexity is O(1)
@@nikoo28Thank you
ok but , how it uses hashing to do all this operations in O(1) time complexity? thats what i wanted to know :(
Those are the internal details on how a hashset actually works. I will create a separate video on hashing sometime in the future.
You said it O(1) for reading but not explained why it is, Please explain
you will have to understand the internals of a HashSet data structure. I plan to make a video on it in my System Design series
Sir , where can I contact you?
I need some help.
Check the channel description, you will find an email address to reach out.
You can also comment here
I cannot sir.
Can we talk on LinkedIn or Discord/Twitter?
Send me an email
How it different from dictionary
It is almost the same as a dictionary…the major difference is that a hashset is synchronised (works good in a multi threading code)
The use of Dictionary is now kind of obsolete and deprecated. You are not advised to use a Dictionary