considering that invert means interchanging two nodes
in both singly and doubly we use temp node to perform so basically its the same
difference comes in the way we reach that location
in singly wehave to traverse from the begining
and in doubly can be traversed backwards
therefore i feel in this case too doubly is more efficient
correct me if i am wrong