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

  • Home
  • SEARCH
  • 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 7043539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:18:07+00:00 2026-05-28T02:18:07+00:00

Hello I have a double linked list set up, and i have a search

  • 0

Hello I have a double linked list set up, and i have a search working for it and all that stuff, i just want to delete from it too.

For my search i have:

public void firstNameSearch(String name)
{
    Node u = header;
    while (u != null && u.list() != name )
    {
        System.out.println("Searching List...");
            u = u.getNext();
    }
    if (u.list() == name)
    {
        // what do I need to put here to delete it

    } 
}

I have looked through over post on stack overflow, but the ones i found were in C, so weren’t a great help, I understand the concept on how to make it delete the node, just can’t get it functional.

Thank you in advance.

  • 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-28T02:18:08+00:00Added an answer on May 28, 2026 at 2:18 am

    Its a very basic operation.I assume there is method as set/getPrevious() as its a double linked list.

    [previous]<==>[u]<==>[next]
    

    Deleting an element in a doubly linked list would be simply changing the references pointers of previous and next node.

    if (u.list() == name)
        {
            Node pre = u.getPrevious();
            Node next= u.getNext();
    
            //Connect next node and previous node
            if(pre != null){
              next.setPrevious(pre);
            }else{
             header=next; 
            }
    
         //Connect previous node and next node
            if(next != null){
              pre.setNext(next);
            }else{
              pre.setNext(null); 
            }
    
    
    
    
        } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I have this list that i am working on. When i move the
I have a problem with double quotes in classic ASP. I want to replace
Hello everyone I am just learning my first programming language and have just corrected
I have a webpage where I want to replace all standard quote characters with
I have created a sample Hello World program in android it was working fine
I encountered SQL queries that looked like select hello from foo.bar I found that
Hello I have a function which signature is std::string f(double x, double param1, double
Hello everyone I have converted a project in C# to F# that paints the
Hello i have a canvas with the name Layout. I want to add some
I have this code: $abc = ' Hello Guys , Goodmorning'; I want to

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.