Adobe Interview Question
Software DevelopersCountry: India
Interview Type: In-Person
okay lets consider both the cases removal/deletion of 23 from the set and accessing and overwriting the value of 116 to 18
if we use different data structure then according to time complexity clearly deletion of 23 is efficient than 116 access and overwrite
time complexity :-
Access Deletion
Array O(1) O(n)
Stack O(n) O(1)
Singly-Linked List O(n) O(1)
Doubly-Linked List O(n) O(1)
Skip List O(n) O(n)
Hash Table - O(n)
Binary Search Tree O(n) O(n)
Cartesian Tree - O(n)
B-Tree O(log(n)) O(log(n))
Red-Black Tree O(log(n)) O(log(n))
Splay Tree - O(log(n))
it also depends on the interviewers perception towards the question
Numbers: 9 23 46 75 116
Diff between above numbers: 14 23 29 41
Diff between above numbers: 9 6 12 >> The series here is not right.
IF
we reduce 6 from 9
Numbers: 3 23 46 75 116
Diff between numbers: 20 23 29 41
Diff between numbers: 3 6 12 >> The series now doubles everytime
Answer: The value 9 should be changed to 3.
23 .. it is prime ;)
- Abhi February 27, 2016