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 8739645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:58:36+00:00 2026-06-13T10:58:36+00:00

I asked a question last night on how to sort() a double linked list

  • 0

I asked a question last night on how to sort() a double linked list in C++.
I managed to get it to work, but now I’d like to merge two lists, but I can’t
get it to work. I don’t have much code, I’m sorry. Everything I tried
absolutely made no sense. I’d just like if someone could give me some hints on
where to start, or on how to do this, with the information I’m going to
provide.

This is what I had in the beginning:

void next() { if (curr != tail) curr = curr->next; }

I believe I only need these.

I looked at some exemples online, but it doesn’t make any sense to me. It
seems so different than what I have right now. Apparently it should be A LOT
easier than doing a sort function, which I had barely any trouble doing.

Any explanation/hints would be greatly appreciated! And I’m sorry once again
for the lack of code, I just don’t know where to start.

  • 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-06-13T10:58:37+00:00Added an answer on June 13, 2026 at 10:58 am

    You can actually do this in multiple ways

    1. Take the two sorted lists, and literally merge them so that you end up with a sorted list
    2. Take the two sorted lists, and create a third new list that contains elements from both the lists in sorted order
    3. Merge the two sorted/unsorted lists, and then sort the resulting list

    It looks like you’re trying to do no. 3 here.

    In which case, you can just

    1. Start from head of the current list, and go to next until you reach the last element
    2. Set curr->next = other_list.head
    3. Call sort on the current list

    This would however destruct the original list. I think it’s better to copy them to a third list.

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

Sidebar

Related Questions

I asked a similar question last week but did not get an answer that
Last night I asked a question like this, I'm not sure what's happening and
I asked this question earlier: How to get delta between two text items But
I asked this question on the PyQt mailing list, and didn't get any responses,
This is a follow up of another question I asked last night. My problem
This is related to another question I asked last week, but the current issue
I asked a similar, yet lousy, question very late last night ( Access to
I asked a similar question last week and didn't get a very good response,
I asked this question last week on SO- SQL Exclusion Query It looks like
I was asked a question in C last night and I did not know

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.