algorithm - how to create a collection with O(1) complexity -


I would like to create a data structure or collection, in which there is no problem adding, removing and computing the O (1) complexity Will be. How should I start with elements?

I have thought of a solution: I will use a hashtable and every key / value will be inserted for the pair, I will have only one hash code, that is: my hash code algorithm every time Will generate a unique hash value, so the index to which the value will be stored will be unique (i.e. no collision).

Will this give me o (1) complexity?

Yes, this will work, but as you mentioned, your hashing function should be 100% unique Should you use any kind of dispute resolution as a result of any duplicate. I would recommend linear chaining

Edit: allows for Hashmap size () o (1) access

Edit 2 : Answer to the negligence of illusion is the reason for this: = P

Yes, Hashing is (K) where Kashmir is the Keyeline. Everyone can agree on it, however, if you do not have a complete hash, then you can not only get O (1) time. You claim that you do not need specialty to achieve the o (1) extinction of a particular element. I guarantee you that this is incorrect.

Consider the worst case scenario: Each element hashes for the same thing. You end up with a single linked list because everyone knows that o (1) is not extinction. I hope, as you have said, nobody is dumb enough to make a hash in this way.

The issue is that the specificity of hash is prerequisite for o (1) runtime.

However, however, it is not technically O (1) Big O functionality, using only quantized analysis, you will gain continuous time capability in the worst case scenario. As the article on Wikipedia is outlined on the revised analysis

The basic idea is that one of the worst situations can change the state in such a way that the worst situation has long since Can not be, thus "amortizing" its cost.

It is referring to the fact that some of the load factors can change your hashtable (change in the status of your data structure) to ensure a small possibility of confrontation.

I hope this clears up all this.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -