Linked Questions
10 questions linked to/from Complexity of accessing data in an object
1 vote
1 answer
239 views
What is the time complexity of removing/accessing property in an object in javascript [duplicate]
I was watching a youtube tutorial in DS&A (using JS) and he mentioned that the time complexity of accessing or removing property in an object is constant? how is that possible shouldn't we search ...
0 votes
1 answer
233 views
Object complexity while search by key [duplicate]
I have the following object: let obj = { "name": "someName", "age": 33, "city": "someCity" } I understand that an object is not indexed "...
1 vote
1 answer
85 views
Why finding object keys has lower complexity than array lookup in javascript? [duplicate]
I need to map accented letters (é, ü, á, ï, ö, ..., etc.) to their corresponding letters in English (e, u, a, i, o, ..., etc.). I know I can do this in several approaches: Looping through an array - ...
126 votes
5 answers
286k views
Hash table runtime complexity (insert, search and delete)
Why do I keep seeing different runtime complexities for these functions on a hash table? On wiki, search and delete are O(n) (I thought the point of hash tables was to have constant lookup so what's ...
46 votes
4 answers
16k views
How does JavaScript VM implements Object property access? Is it Hashtable?
Objects in JavaScript can be used as Hashtable (the key must be String) Is it perform well as Hashtable the data structure? I mean , does it implemented as Hashtable behind the scene? Update: (1) I ...
62 votes
3 answers
26k views
JavaScript Objects as Hashes? Is the complexity greater than O(1)?
For some algorithm I was writing recently I thought that a hash would be excellent. I thought that I could probably just use the member variables in an object as key value pairs. I am not sure if this ...
4 votes
7 answers
18k views
how to merge two arrays of objects in javascript?
here is a sample example where there are two arrays and we have a merge() to which we pass the arrays. the merge() should return the merged array such that it should merge the objects which have same ...
-2 votes
4 answers
514 views
Best way to filter the array of objects
I have an array of objects with a property I want to filter on called "Country". I have the user select which countries they want to see and wish to return an array of objects filtered by that ...
0 votes
1 answer
211 views
What is time complexity when using object for sorting? [closed]
I have a socket with realtime values. I get the unsorted row object then I need to create a list of the received objects and sort them by price. After this, my data is sorted correctly. I am using ...
2 votes
2 answers
78 views
Is there any difference in following two access of Hashmap in Javascript
var key = 'a'; map[key] = 'value'; map['a'] = 'value'; In Java this is optimized automatically during compilation. I want to know if any JS compiler does such optimization on its own.