linked-list

C - Help understanding how to write a function within a function (list_map)

Hello I recently asked some questions on linked lists in C. The link was found here First I want to thank everyone for helping me with this. But I have one issue I cannot understand. I even asked the professor but he emailed me back with little information. Basically I am writing a linked list in C (see above link). One of the thing...

Referring to: How to Use LLIST *mylist[N];

This does work LLIST *mylist[10] = {NULL}; But would if I wanted to do this I get errors: int x=10; LLIST *mylist[x] = {NULL}; x can be any value I'm setting it to 10 for the time being. x is going to be used as a counter. ...

Still problems with LLIST *mylist[x]

So I have... int x; LLIST *mylist[x]; x =10; bzero(mylist, sizeof(LLIST *)*x); this does not seem to be a valid solution.. I did add the -std=c99 to my make file, just this alone did not work which is why emil suggested the above approach, because I had originally: int x=10; LLIST *mylist[x] = {NULL}; My make file lo...

Referring to "C - Help understanding how to write a function within a function (list_map)"

I have the same professor: I have read the forum: http://stackoverflow.com/questions/2119558/c-help-understanding-how-to-write-a-function-within-a-function-listmap/2119913#2119913 It is very helpful understanding the concept of the function but I'm not sure if I am using it right... Here is my code.. Let me know if I am on the right ...

C Linked list only contains first element...not sure what happens to rest.

I posted a question a few days ago about a linked list in C. I thought everything was ok then the prof emails us saying that instead of this signature: int insert_intlist( INTLIST* lst, int n); /* Inserts an int (n) into an intlist from the beginning*/ He accidentally meant: int insert_intlist( INTLIST** lst, int n); /* Inserts an i...

Crash, while printing contents of linked-list

Hello, I'm having some trouble printing out the contents of a linked list. I'm using an example code that I found somewhere. I did edit it a bit, but I don't think that's why it's crashing. class stringlist { struct node { std::string data; node* next; }; node* head; node* tail; public: BOOLEAN append(std::string ...

Does c#/.net x.x have an implementation of a doubly linked list (that can be iterated over backwards)?

I've been searching for the standard implementation of a doubly linked list in c# (so that I have a linked list I can iterate over backwards) and cannot find one. I feel like something so simple must have an implementation that I'm just missing. If it does exist, for which version of c#/.net does it exist? Reverse iteration in general ...

loading an entire linked list in a single Ruby/MySQL query

I'm storing linked lists of data in records that look like this: CREATE TABLE IF NOT EXISTS `data_nodes` ( `record_id` int(11) NOT NULL, `prev_node` int(11) NOT NULL, `data` varchar(200) NOT NULL, PRIMARY KEY (`record_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; where prev_node is the record_id of the previous item in the list,...

Python linked list O(1) insert/remove

Hey, I am looking for a linked list and related algorithms implementation for Python. Everyone I ask just recommends using built in Python lists, but performance measurements indicate that list insertion and removal is a bottleneck for our application. It's trivial to implement a simple linked list, but I wonder if there is a mature lib...

Generic data structure libraries for C ?

Which libraries do you guys use for generic data structures like linked list, binary tree etc.? What are the most common, efficient libraries? Can you name some? ...

C++ destructor example

Hello My C++ is a little rusty but I have made a program that reverses a linked list and now I am trying to write the proper destructors for it but I don't know exactly what to destroy. Here are my class definitions: class LinkedList { private:ListElement *start; public:LinkedList(); public:void AddElement(int val); publ...

What is the exact difference between constant and non-constant space linked list mergesort?

First, let me describe two button-up ways to merge-sort a single linked list: Merge two elements, push that on a stack. Merge the next two elements, pop, merge and push. Merge two elements, push, merge two, pop, merge, pop, merge, push. I hope you got the idea. Merge with the next element, move 2. Merge, move 2. If you arrived at the e...

Can i use the ordering methods of simple linked lists into a hash list?

Im confused with this question? Thank you in advance. Programming in C under linux ...

Linked List explanation required

I need to understand how a linked list works in this C++ code. I got it from my textbook. Could someone explain in detail what exactly is going on here? /*The Node Class*/ class Node{ private: int object; Node *nextNode; public: int get() { return object; } ...

Java Question Linked List objects

I have the following piece of code : Essentially the number of methods should remain the same as in the code and I need to extract a string from an element of the linkedlist of Objects of type emp_struct.. How do I do it? import java.util.*; import java.io.*; class a1 { static LinkedList l1; private emp_struct input() throws I...

CSS link navigation browser compatability.

Hello I have a horizontal linked list (implemented to look like tabs) that I'm using for a site navigation. I checked my page today on my phone and it didn't display correctly on opera or in internet explore. I checked IE6 when I got home and it appears the same way. HTML <div id="navcontainer"><ul> <li><a href="">Home</a></li> <li...

How to sort a linked list in PHP?

$arr[] = array(...,'id'=1,'prev'=>2,'next'=>null); $arr[] = array(...,'id'=2,'prev'=>3..,'next'=>1); $arr[] = array(...,'id'=3,'prev'=>4,'next'=>2); .. The order of each record can be arbitary. How to sort this kind of array so that record with prev's value null is first,and the one with null next is last? ...

Finding the intersecting node from two intersecting linked lists.

Suppose there are two singly linked lists both of which intersect at some point and become a single linked list. The head or start pointers of both the lists are known, but the intersecting node is not known. Also, the number of nodes in each of the list before they intersect are unknown and both list may have it different i.e. List1 ma...

Are LinkedLists an unintuitive solution since most of the time I don't need to know the physical location of an element in a Collection?

Recently a coworker showed me some code he had written with a LinkedList and I couldn't get my head around it. a -> b -> c -> d -> e -> f If I want to get d from the LinkedList, don't I have to traverse the list starting with a and iterating up to d or starting with f and iterating back to d? Why would I care WHERE d is stored physica...

Trees: Linked Lists vs Arrays (Efficiency)

This is an assignment question that I am having trouble wording an answer to. "Suppose a tree may have up to k children per node. Let v be the average number of children per node. For what value(s) of v is it more efficient (in terms of space used) to store the child nodes in a linked list versus storage in an array? Why?" I believe I ...