While adding the element to the linked list why we are always using addLast we can also do add any specific reason using addLast?
Why adding the element addLast?
addLast is of complexity O(1)
what i mean is both add and addLast appends the element at the end .Please refer documentation https://docs.oracle.com/javase/7/docs/api/java/util/LinkedList.html#add(E) ,Now both takes o(1) .Now any specific reason to choose addLast over add
add and addLast works similarly so you can use either of them
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.