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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:51:20+00:00 2026-05-23T16:51:20+00:00

suppose we have doubly linked list ordered by integer value: struct ListItem { int

  • 0

suppose we have doubly linked list ordered by integer value:

struct ListItem
{
  int value;
  ListItem *prev, *next;
};

struct List
{
  ListItem *first, *last;
  int count;
};

can we use faster search algorithm such as binary search to locate ListItem inside List and how?

  • 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-23T16:51:21+00:00Added an answer on May 23, 2026 at 4:51 pm

    For most practical purposes, no. If you want faster search, a linked list is a poor choice of data structure. Consider a vector, deque, set, or multiset instead.

    Edit: Perhaps it would be good to provide some guidance about which of those makes sense when. A vector makes the most sense if you have two basically separate phases: Either you insert all your data in order, or you insert and sort, then after the data is sorted, the data remains static, and you just search in it. A deque is pretty much the same, except you can insert at either end, so if you might get data out of order, but new data always belongs at one end of the collection or the other, it can be a good choice.

    A set or multiset works better if you’re going to be mixing insertions/deletions with lookups. It stays sorted all the time, so searches are always reasonably fast. Between the two (set vs. multiset) the choice is pretty simple: if you need to ensure each item in the collection is unique, you want set. If you might have more than one item with the same key, you want a multiset.

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

Sidebar

Related Questions

Suppose I have a doubly linked list. I create it as such: MyList list
Suppose I have some simple struct like this: public struct WeightedInt { public int
Suppose I have a Java class with multiple constructors: class Base { Base(int arg1)
Suppose I have a JAXB element like this: @XmlElement private double value; this will
Suppose I have some code like this: class Base { public: virtual int Foo(int)
Suppose I have: struct Vec3 { double x; double y; double z; } ;
suppose you have the code template <template<class> class BaseType> class EST16 : public BaseType<int>
For example, suppose I have val list: List[(String, Double)] with values 04-03-1985, 1.5 05-03-1985,
Suppose I have a large list (around 10,000 entries) of string triples as such:
Suppose I have the following class: class Camera { public Camera( double exposure, double

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.