tag:blogger.com,1999:blog-8712770457197348465.post1870265609418647817..comments2014-12-18T00:05:31.819-08:00Comments on Javarevisited: How do you find length of a Singly Linked listJavin Paulhttps://plus.google.com/114528699166048052030noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-8712770457197348465.post-90324653463871926832014-12-15T22:22:42.673-08:002014-12-15T22:22:42.673-08:00This question was asked to me as well, but they al...This question was asked to me as well, but they also asked me to find the complexity of both iterative and recursive solution. I said that if whether you use two pointer or one pointer approach you are checking almost each element, which means it's O(n) on times. Then he said, can you optimize the solution to reduce the time atleast to logarithimic or constant time. This question I couldn'Joytinoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-41520096040998610942014-10-13T22:57:48.880-07:002014-10-13T22:57:48.880-07:00Can you write a generic implementation of Singly l...Can you write a generic implementation of Singly linked list in Java?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-57157779265962434762014-10-13T22:57:06.321-07:002014-10-13T22:57:06.321-07:00Java LinkedList is indeed Doubly linked list imple...Java LinkedList is indeed Doubly linked list implementation of List and Deque interface in Java, as stated by Java doc. The do have two pointers first and last to point at both end of linked list. Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-4387597247835595112014-04-21T08:39:31.911-07:002014-04-21T08:39:31.911-07:00If Java LinkedList is doubly Linked List, then it ...If Java LinkedList is doubly Linked List, then it should contaion two null elements, one in the begining and other at the end. Please correct if I am wrongPanchamhttp://www.blogger.com/profile/03916691972111159446noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-52969345323630456802013-12-20T21:18:09.972-08:002013-12-20T21:18:09.972-08:00Java LinkedList is doubly Linked List. Java LinkedList is doubly Linked List. Aditya Chaudharyhttp://www.blogger.com/profile/15621484663643907417noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-2200661831048435782013-04-28T15:56:07.802-07:002013-04-28T15:56:07.802-07:00@Durai
Even i wonder why they ask this question.
...@Durai<br /><br />Even i wonder why they ask this question.<br /><br />@Linked list : Anyways thanks for sharing informationAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-5882904722100067652013-02-13T21:11:39.722-08:002013-02-13T21:11:39.722-08:00Just wondering why the interviewer asks these kind...Just wondering why the interviewer asks these kind of questions when we have an size() method to get the size?<br /><br />-DuraiAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-12193664148995733212012-06-03T20:30:40.586-07:002012-06-03T20:30:40.586-07:00This example to find length of linked list can als...This example to find length of linked list can also be extended to solve problems like how do you find middle element of linked list in Single pass or how to you find nth element from last in linked list in one loop. key here is to use two pointer one incrementing one at a time while other incrementing two at a time.LinkedListhttp://en.wikipedia.org/wiki/Linked_listnoreply@blogger.com