Hi, actually this was another problem but it changed so I decided to open a new question.
My code is
typedef struct inner_list
{
int count;
char word[100];
inner_list*next;
} inner_list;
typedef struct outer_list
{
char word [100];
inner_list * head;
int count;
outer_list * next;
} outer_list;
void delnode(outer_list **head,ch...
My code was almost finished that a maddening bug came up! When I nullify the last node to finalize the link list , it actually dumps all the links and make the first node link Null !
when i trace it , its working totally fine creating the list in the loop but after the loop is done that happens and it destroys the rest of the link by doi...
I'm trying to make a function in C to add numbers to an ordered linked list, but I've got the
feeling it can be done in a lot less rows. Is there an example?
This example code does not work:
#include <stdio.h>
#include <stdlib.h>
struct listNode {
int number;
struct listNode *nextPtr;
};
typedef struct listNode LISTNODE;
type...
Hello,
Which implementation is less "heavy": PriorityQueue or a sorted LinkedList (using a Comparator)?
I want to have all the items sorted. The insertion will be very frequent and ocasionally I will have to run all the list to make some operations.
Thank you!
...
Hi there, Im trying to reverse the order of the following linked list, I've done so, But the reversed list does not seem to print out. Where have I gone wrong?
//reverse the linked list
#include <iostream>
using namespace std;
struct node{
int number;
node *next;
};
node *A;
void addNode(nod...
I'm using C++ to recursively make a hexagonal grid (using a multiply linked list style). I've got it set up to create neighboring tiles easily, but because I'm doing it recursively, I can only really create all 6 neighbors for a given tile. Obviously, this is causing duplicate tiles to be created and I'm trying to get rid of them in some...
Hi! I have a datastructure
struct record {
char cont[bufferSize];
record *next;
};
When I add new records to this structure, I want them to be sorted alphabetically. I made this function, that adds record in the right place (by alphabet) in the linked list:
record *start=NULL, *p, *x;
void recAdd(char*temp) {
p = new...
edit
Clafification: The intention is not to remove the node from the original list. But to create an identical node (data and children wise) to the original and insert that into the new list. In other words, a "move" does not imply a "remove" from the original.
endedit
The requirements:
Each Node in the list must contain a reference...
I'm dealing with a file with a linked list of lines with each node looking like this:
struct TextLine{
//The actual text
string text;
//The line number of the document
int line_num;
//A pointer to the next line
TextLine * next;
};
and I'm writing a function that adds spaces at the beginning of the lines found i...
I understand that Tortoise and Hare's meeting concludes the existence of loop, but how does moving tortoise to beginning of linked list while keeping the hare at meeting place, followed by moving both one step at a time make them meet at starting point of cycle?
...
Hi
this is my code for main class and doubly linked class and node class but when I run the program ,in the concole will show this"datastructureproject.DoublyLinkedList@19ee1ac" instead of the random numbers .please help me thanks!
main class:
public class Main {
public static int getRandomNumber(double min, double max) {
...
Hi
this is my whole class ,I have added number 2 to the doubly linked list and then I want it to be be print in the concole but it will show this "datastructureproject.Node@f62373"
thanks!
package datastructureproject;
public class DoublyLinkedList {
private Node head = new Node(0);
private Node tail = new Node(0);
private int length =...
Hi
I have found this code in the internet and it was for arrays ,I want to change it for doubly linked list(instead of index we should use pointer) would you please help me that how can i change merge method(I have changed sort method by myself) also this is not my home work ,I love working with linked list!!
public class MergeSort {
p...
Hi
I want to use merge sort for sorting my doubly linked list.I have created 3 classes(Node,DoublyLinkedList,MergeSort) but it will throw this exception for these lines:
1.in the getNodes method of DoublyLinkedList---> throw new IndexOutOfBoundsException();
2.in the add method of DoublyLinkedList-----> Node cursor = getNodes(index);...
Hi there, I'm trying to sort names into alphabetical order inside a linked list but am getting a run time error. what have I done wrong here?
#include <iostream>
#include <string>
using namespace std;
struct node{
string name;
node *next;
};
node *A;
void addnode(node *&listpointer,string newname){
node *temp;
temp = ...
Hi, in spite of having so many efficient data structures, why is only linked list used
so heavily in systems programming? Is it because it allows least usage of heap/less buggy code?
Regards,
Pwn
...
I'm looking for a good understandable example in c++ with differences. Does the header file <list.h> provide both or should I look somewhere else?
...
I've been working on this program for five months now. Its a real time application of a sensor network. I create several linked lists during the life of the program and Im using malloc for creating a new node in the link. What happens is that the program suddenly stops or goes crazy and restarts. Im using AVR and the microcontroller is A...
I have read the following code of using CRITICAL_SECTION when working with multiple threads to grow a linked list. what would be the main() part which uses two threads to add to linked list?
#include <windows.h>
typedef struct _Node
{
struct _Node *next;
int data;
} Node;
typedef struct _List
{
Node *head;
CRITICAL_SEC...
Hi ...
i am implementing a simple linked list in c++.
I have a mistake and i don't see it :(
#include <stdexcept>
#include <iostream>
struct Node {
Node(Node *next, int value):
next(next), value(value) {
}
Node *next;
int value;
};
class List {
Node *first;
int len;
Node *nthNode(int index);
public:...