I was reading about big O notation in java programming. I found the following table it shows different big O for different data structures.
My questions are:
- If I want to delete an item in an array, is it
O(n^2)
? (search and delete) - If I want to delete an item in a stack, is it
O(n)
? - Which one is more effective, is it a single linked list or double single list?
- In what case is that the insert operation is
O(1)
orO(n)
in a hash table? - If I want to delete an item in a binary search tree, is it
O(log(n)*log(n))
while insert is justO(log(n))
?
Thanks.