I want to be able to have LinkedList.contains() return true for a custom comparator.
Suppose that I have 1 LinkedList and 2 objects
LinkedList<MyObject> myList = new LinkedList<MyObject>();
MyObject a = new MyObject("HELLO");
MyObject b = new MyObject("HELLO");
Technicaly, both objects are identical in terms of comparison (MyObject ...
I am writing a program in c++ which implements a doubly-linked list that holds a single character in each node. I am inserting characters via the append function:
doubly_linked_list adam;
adam.append('a');
This function is implemented as follows:
//Append node
node* append(const item c){
//If the list is not empty...
...
I fear this is a really stupid question, but here goes:
Why does the clear method in Java's default LinkedList implementation bother to walk the list and unhook all the nodes? Why not just unhook the header and leave the rest of the list connected -- the GC will get it anyway, no?
Here's the method:
/**
* Removes all of the elements...
I am implementing an undo/redo buffer with generic LinkedList.
In this state:
[Top]
state4 (undone)
state3 (undone)
state2 <-- current state
state1
[bottom]
When I do a Push, I would like to remove all states after the current one, and push the new one.
My current bypass is to do while (currentState != list.last), list.removeLast(); b...
I was thinking about building a program that use a raid(disk) like algorithms. If one computer dies. The next will step in. In it's place. And it need to scale from 1 - 1000 computers.
I need some advice.
What the name of the algorithms I'm need to learn?
At one point I thought it was possible to build it on top of git.
...
After four weeks of learning Objective-C for the iPhone, my first useful application is almost finished. However, I still need to save several instance variables whenever the current view is changed and to reload them when the view is reopened.
I have no trouble loading variables with basic C types like int and BOOL, but am having diffi...
Another programmer was mentioning that they haven't found a use case for using a linked list data structure in any professional software in his career. I couldn't think of any good examples off the top of my head. He is mostly a C# and Java developer
Can anyone give some examples where this was the correct data structure to solve a pa...
Not that I have time to discuss this properly to reach a conclusion and adapt my code because the phase one (of three) of a school project is in 24hrs, but at least I need to know if I did the correct decision.
I'm using linked lists and here's my structures:
typedef struct sCity {
int cityID;
char *cityName;
struct sCityL...
I have a MySQL database table with this structure:
table
id INT NOT NULL PRIMARY KEY
data ..
next_id INT NULL
I need to fetch the data in order of the linked list. For example, given this data:
id | next_id
----+---------
1 | 2
2 | 4
3 | 9
4 | 3
9 | NULL
I need to fetch the rows fo...
In what situations should I use each kind of list? What are the advantages of each one?
...
I want to have a List or Array of some sort, storing this information about each country:
2 letter code
Country name such as Brazil
Continent/region of the world such as Eastern Europe, North America, etc.
I will classify each country into the region/continent manually (but if there exists a way to do this automatically, do let me k...
What would be the best way to create a circually linked list in C#. Should I derive it from the LinkedList< T> collection? I'm planning on creating a simple address book using this Linked List to store my contacts (it's gonna be a suck-y address book, but I don't care cause I'll be the only one to use it). I mainly just want to create th...
I have to build a class polynom (polinom) inherited from class lista (list). I have to add , substract ,multiply , divide 2 objects from the polynom class.
I have this piece of code. I don't understand why my destructors aren't working. I also have to overload the operators: +,-,<<,>> but I don't know how to.
#include <iostream>
#inclu...
so this is what I got...
QueueList
{Id,Queue_Instance_ID, Parent_Queue_Instance_ID, Child_Queue_Instance_ID}
what will be the most efficient way to stuff this into a LinkedList<QueueList>? basically do you think I can go lower than o(n^2)?
thanks.
...
Does anyone have an extension method to quickly convert the types in a LinkedList<T> using a Converter<TInput, TOutput>?
I'm a bit surprised, where is the ConvertAll<TOutput>(delegate)?
...
( if you get easily bored reading long posts, you can focus on the bold parts )
Hello all! This is not exactly a technical question, since I know C kind of enough to do the things I need to (I mean, in terms of not 'letting the language get in your way'), so this question is basically a 'what direction to take' question.
Situation is: ...
I have written a basic linked list class in C#. It has a Node object, which (obviously) represents every node in the list.
The code does not use IEnumerable, however, I can implement a sorting function? The language I am using is C#. Is there an example of this in C#?
I am working from this sample: http://www.c-sharpcorner.com/UploadFi...
Hello. I'm writing a program in which you enter words via the keyboard or file and then they come out sorted by length. I was told I should use linked lists, because the length of the words and their number aren't fixed.
should I use linked lists to represent words?
struct node{
char c;
struct node *next;
};
And then how can...
Windows provides a lockless singly linked list, as documented at this page:
Win32 SList
I'm wondering if there's an existing good C++ wrapper around this functionality. When I say good, I mean it exports the usual STL interface as much as possible, supports iterators, etc. I'd much rather use someone else's implementation than sit down ...
If I have an LinkedList of Employee objects...
Each employee has a Name, and an ID fields.
I have linkedList call list....
If I want to see if the list contains an employee I do:
list.contains(someEmployeeObject)
How about if I want to see if the the list contains an employee based on the imployee ID..
let's say I have the followi...