Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3661500
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:18:43+00:00 2026-05-19T01:18:43+00:00

I have looked at most threads here about Doubly linked lists but still unclear

  • 0

I have looked at most threads here about Doubly linked lists but still unclear about the following.

I am practicing the Goodrich and Tamassia book in Java. About doubly linked lists, please correct me if I am wrong, it is different from a singly linked list in that a node could be inserted anywhere, not just after the head or after the tail using both the next and prev nodes available, while in singly linked lists, this insertion anywhere in the list is not possible?

If one wants to insert a node in a doubly linked list, then the default argument should be either the node after the to-be inserted node or node before the to-be inserted node ? But if this is so, then I don’t understand how to pass the node before or after.
Should we be displaying all nodes that were inserted till now and ask the user to select the node before or after which some new node is to be inserted ? My doubt is how to pass this default node. Because I assume that will require the next and prev nodes of these nodes as well.

For e.g, Head<->A<->B<->C<->D<->E<->tail

If Z is the new node to be inserted after say D, then how should node D be passed? I am confused with this though it seems pretty simple to most.

But pl do explain.

Thanks,
Sanjay

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T01:18:44+00:00Added an answer on May 19, 2026 at 1:18 am

    it is different from a singly linked
    list in that a node could be inserted
    anywhere, not just after the head or
    after the tail using both the next and
    prev nodes available, while in singly
    linked lists, this insertion anywhere
    in the list is not possible?

    This is wrong. You can insert nodes in the middle of a singly linked list just fine. The only difference is that a doubly linked list is easier to navigate, since you can walk it forward and backward from any given node.

    If one wants to insert a node in a
    doubly linked list, then the default
    argument should be either the node
    after the to-be inserted node or node
    before the to-be inserted node?

    That depends entirely on what you are using the list for. Linked lists are not really a good general-purpose data structure due to their poor random access performance. Because of that, they are usually only used for algorithms that iterate over the list anyway and insert or remove nodes while they do it.

    But
    if this is so, then I don’t understand
    how to pass the node before or after.
    Should we be displaying all nodes that
    were inserted till now and ask the
    user to select the node before or
    after which some new node is to be
    inserted?

    You’re approaching this from the wrong way, trying to write an application around a certain data structure. Normally you start out with the application’s end-user requirements and then decide which data structure is best used to satisfy those requirements. A User should never have to understand low-level internals of a program like linked lists.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have looked here and from what I understand the following regex simply means
Have looked quite hard for this answer but having no luck. I have 3
I have looked at many other threads that show how to use accelerometer values,
I have looked but have not found a specific answer for changing just one
I have looked thoroughly, but I have not found the solution (or perhaps I
I have looked at the network documentation for Unity and most examples seem to
Here is the issue. I have looke through these threads for a while now
I have looked at most of the questions on this subject and there does
Most of the winforms timer examples I have looked at declare static callbacks. Is
I've looked at the other threads with similar questions, but I'm new to git,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.