"""In a doubly-linked list, the time complexity for inserting and deleting an element is O(1)."""
The above statement is not correct for all cases. I have explained it below.
I am assuming that you don't want a sorted linked list.
Then, inserting an element in both singly linked list and doubly linked list is O(1) if you insert at the head of the list.
Psuedocode is as follows (for singly linked list):
old_head = head;
head = new_element;
new_element->next = old_head;
For deletion in both singly linked list and doubly linked list, you will have to search the lists for the element that you want to delete. The time complexity of searching the element in both the lists in O(n). So, deletion in doubly linked list also requires O(n) time.
However, if you have a pointer to the element to be deleted then for doubly linked list, the time complexity is O(1) because you can directly update the previous pointer of the next element and the next pointer of the previous element and then free the desired element.
For deletion in a singly linked list (if you have a pointer to the element to be deleted), you will have to find the previous element (for updating the pointers correctly) by going through the list and hence the time complexity of deletion in a singly linked list, in this case, is O(n).
at a given position
Given how? Insert as $k_{th}$ element? Insert before/after element $e$? in the latter case, the existence of aliases for $e$ may make a difference. $\endgroup$