I am following the below approach to calculate the middle element from the linked list , but I want is there any built in method or any other approach which can als
linked list
I would recommend using the Java built in
LinkedList
It gives you all the functionality you need like getting the length: list.size(), and the middle object:
list.size()
list.get((list.size())/2);