linked-list

Problem in understanding XOR linked list.

I am reading XOR linked list (from Wikipedia).But I am having some problems in understanding it. I am not getting following paragraph. To start traversing the list in either direction from some point, you need the address of two consecutive items, not just one. If the addresses of the two consecutive items are reversed, you will en...

Maintain reference to any object type in C++?

I'm trying to teach myself C++, and one of the traditional "new language" exercises I've always used is to implement some data structure, like a binary tree or a linked list. In Java, this was relatively simple: I could define some class Node that maintained an instance variable Object data, so that someone could store any kind of object...

How to implement linked list type structure in C#?

I have a requirement for linked list type traversing in c#, What structure i should use for my project Please suggest.. ...

Storing data of unknown size in C++

Hi, I've been using PHP for about 4 years, however I've come across a problem that requires something with slightly (:P) better performance and so I've chosen C++. The program I'm writing is a Linux daemon that will scan a MySql database for URL's to load, load them using cURL, search for a specified string, and then update the databas...

How to create a linked list of nodes that are contained in the max-Depth of a Binary Tree using Java

I've already created the Binary Tree and Linked list classes, I'm just in need of an algorithm that prints ONLY the nodes of the largest path. The height and size of the Binary Tree are already stored in the root node, but my problem is traversing only the largest path while adding each node to my linked list. ...

Link list algorithm to find pairs adding up to 10

Can you suggest an algorithm that find all pairs of nodes in a link list that add up to 10. I came up with the following. Algorithm: Compare each node, starting with the second node, with each node starting from the head node till the previous node (previous to the current node being compared) and report all such pairs. I think thi...

how to copy one linked list contents to another linked list

Hi, I have been given list L1, L2. L1 contains 1,2,3 and L2 contains 4,5,6. how do i copy the contents from L2 to the end of L1 so in the end L1 contains 1,2,3,4,5,6. any suggestions? ...

Is there a known implementation of an indexed linked list?

My gut tells me there is no good way to achieve this, but, unlike Mr. Stephen Colbert, I'd rather trust a community of developers than my gut... Is there a known way to efficiently implement a "best of both worlds" list, one that provides random access by index and O(1) insertion/removal like a linked list? I foresee two possible outco...

Java lists -- does LinkedList really perform so poorly vs ArrayList and TreeList?

Taken from Apache TreeList doc: The following relative performance statistics are indicative of this class: get add insert iterate remove TreeList 3 5 1 2 1 ArrayList 1 1 40 1 40 LinkedList 5800 1 350 2 325 It goes on to say, "LinkedList is rarel...

Linq to sql - Linked lists

Hi! I'm having a linq to sql schema with a entity "Customers" as well as "Reports". Each customer has zero or more reports. I want customers to have a LinkedList property, so that i easily can access the next and previous entity for each report. What would be the best way, if any, to implement this using linq to sql? Thanks ...

What is the complexity of inserting into sorted link list in big-O notation?

What is the complexity of inserting into sorted link list in big-O notation? Let say I have 5 elements and what is the complexity to insert all of them. Thank you very much ...

Is there a linked list predefined library in C++?

Is there a linked list in C++ that I could just #include? Or do I need to create my own if I want to use one? ...

How do I use merge sort to delete duplicates?

I use recursive merge sort for sorting a link list, but during the merge sort I would like to delete duplicates. Anyone has insight in how to accomplish this? I am using C code. ...

Need Help in List Destroy function

Hi all, I am writing a storage allocator using the First Fit Algorithm and would like to free up memory I have obtained from the system before quitting. So I have this list of 'free' memory which is obtained from the system and remains unused with me. At the end of the program when I try to free the list using the code , my program is...

is it possible to store single linked list information in NSUserDefaults of iphone

is it possible to store single linked list information in NSUserDefaults of iphone. If there is an another way to store the information please mention that also ...

LinkedList.Contains. What is the mehtod used to compare objects?

LinkedList.Contains method. (.NET 2) How the objects are compared inside? (Equals? CompareTo?) MSDN tells nothing about. the situation: interface IClass { string GetName(); } class Class1 : IClass, IEquatable<Class1> { public string FirstName; public string LastName; string IClass.GetName() { return FirstName; } ...

Java Queue Merge, Beginner

I'm trying to write a method that will take in two Queues (pre-sorted Linked Lists) and return the merged, in ascending order, resulting Queue object. I pasted the Queue class, the merge method starts 1/2 way down. I'm having trouble calling merge, this is how I am trying to call it from my main method, can anyone help with this call ...

Why use a pointer to a pointer to the stack when creating a push function?

I am looking at a textbook example of a linked list that implements a stack. I don't understand why using a pointer to a pointer to the stack is necessary for the push operation. See the following example: bool push( Element **stack, void *data) { Element *elem = new Element; if(!elem) return false; elem->data = data; e...

Is the linux kernel's list.h thread safe?

Is the linux kernel's list.h thread safe? Thanks, Chenz ...

Reverse a singly linked list

I would be wondered if there exists some logic to reverse the linked list using only two pointers. The following is used to reverse the single linked list using three pointers namely p, q, r: struct node { int data; struct node *link; }; void reverse() { struct node *p = first, *q = NULL, *r...