2,180 Topics
![]() | |
Hey i want to know how to make my single linked list a double can anyone help? #include "MyLinkedList.h" #include <iostream> int main() { SListNode<int>* list = new SListNode<int>; //Set 3 LinkedList nodes to contain 3 int variables. list->m_data = 10;//(1). list->m_next = new SListNode<int>; list->m_next->m_data = 20;//(2). list->m_next->m_next = … | |
![]() | Hey everyone, I am working on this project and do not know where to start. Can anyone lead me in the right direction? I am very poor in this background and could use all the help I can get. So, any help would be very much appreciated. Here are the … |
I have a bit a of a problem because I have no idea what's going on in my code. Could someone guide me with this? **It has to swap the nodes themselves. ** #include <iostream> #include <iomanip> using namespace std; typedef struct node { int DATA; node *NEXT; }; node … | |
Using an appropriate definition of ListNode, design a simple linked list class with only two member functions and a default constructor: void add(double x); boolean isMember(double x); LinkedList( ); The add function adds a new node containing x to the front (head) of the list, while the isMember function tests … | |
Hello, I think it's safe to say that I am totally off here. I need some help. > The program should include two classes Book and Author. > A Book should contain a title, an ISBN and publication year. An Author should contain a name and a sorted linked list … | |
Hey guys, I am writing a program which uploads a text file into a linked list then displays a menu prompt to the user. All of my functions work fine except when I try to exit the menu/program. The program crashes and I don't see where it is coming from. … | |
I am writing a program in C to build linked lists from scratch. However, I am getting hung-up on trying to build a link list that will automatically sort itself. By this, I mean that the nodes will automatically be placed in the correct location. My current code is putting … | |
I wrote a linked list program in C++ which compiles and works well. But I have been told that a) I have to have two separate structs instead of one that contains both the info and the node; and, b) that I have to use two pointers instead of the … | |
Can anybody tell me what's wrong with my selection sort of linked lists? It's meant to sort the whole node, not the data. #include <iostream> #include <iomanip> using namespace std; typedef struct node { int DATA; node *NEXT; }; node *HEAD = NULL; void Create(int data); void Display(); void Sort(); … | |
Alright so I am trying to insert nodes into a linked list but also I want them to be sorted right away I think I got most of it except I am struggling when it comes to inserting it to the middle of the table temp -> price = price; … | |
Hey guys. I am somewhat new to the C++ language and was wanting to make a basic text editor. For this i was going to use Nodes and linked list to accomplish this. the main thing i need help with at this moment is creating a command prompt for the … | |
How to sort alphabetically the link list? Example: pHead B pSecond A pLast C Result: pSecond A pHead B pLast C | |
hi i need help with linked list. so iam trying to mege two linked list together. i got all to working but my meger method dont work. lets say age of List_A = 1, 2, 3; and List_B = 2, 4, 5, 6; after meger method i should get 1,2,2,3,4,5. … | |
im trying to build my own LL, not seeming to work? My insert method is wrong, and cant fiugre it out, any ideas? public class List { private int size; private Node root; private Node current; public List(){ size = 0; } public void insert(int a){ size++; if(root == null){ … | |
I need some help with debugging this problem. I just started learning how to store files at C but I can't seem to check if this code is correct since I can't compile it well. Might anyone help me point out the problems in my code? #include <stdio.h> #include <stdlib.h> … | |
Hello again, I am asked by my professor to create a program using selection sort in a linked list. Selection sort with sorting only the data is pretty easy, but I'm having a hard time because he made us sort the nodes themselves. Can anyone help by giving atleast the … | |
i have a single list program which i need to sort the nodes of int and String type unsing only one of these algorithms (insertion, selection, bubble and shell). no merge or quick or using collections and stuff. i'm having a difficulty here, i only know how to implement them … | |
I was asked to create a program that enters numbers and displays the before sorting order, and the sorted order displaying the previous node address and the next node address. I was told not to swap the data inside the nodes, but move the nodes themselves. I have a problem … | |
how do you insert in linked list. this is that i have. struct node { int data; struct node *next; }; struct node *head; void insert(struct node*, char*, int); int main() { int data; struct node *List_A = NULL; insert(&List_A, %data); return 0; } void insert(struct List_A, int data) { … | |
Please i'm working on a linked list and want to overload the ++ operator in order to use a dummy pointer to loop/traverse through the list. But its gives me a compiled-time error. Here is the actual code: class Node { private: string value; Node* next; public: ~Node(){del ete this;}; … | |
[I]This exercise will explore the queue and stack data structure implemented with linked lists. The Koch snowflake can be implemented without recursion by using a queue or a stack. Assume that L is either a queue or a stack, L.add( seg ) adds a segment, and L.remove() removes the segment. … | |
I have to write a code.The program compute random sentences by using singly linked list date structure.The same word cannot be used more than once. I've already written the some codes which takes the list. [CODE]// random_sentence_operator.cpp : Defines the entry point for the console application. // #include <stdio.h> #include … | |
Hi all. I am trying to build a Binary Linked Trie but fail in basic pointer operations.Following code can be built but in debug or run mode, it breaks and outputs the error. [ICODE]typedef struct node { char ch; node *next; }; struct node *root = NULL; void add(struct node … | |
Hello, I have a linked list with the following data in it reflecting a title (name), int (# copies) and float (price). I'm supposed to sort this linked list by prices (highest to low) and then print the titles. From what I've seen, the best method is using selection sort, … | |
I have a Product class that is the parent of 3 other classes; Books, Movies, Music. And the Product class connects to the Store class that holds the Store's location. If I need to find a certain Product I have to traverse the list of each the Store class and … | |
I am running into (pretty serious) valgrind issues as I run my application. As far as I can tell, my BST has some memory loss, to put it rather clinically. I've tried to create the right destructor on my BST<T> class, which contains BSTNode<T> nodes (both are shown below in … | |
is this logic correct, where does counting starts in a link list, is it from 0 or 1. b'cos when i am ading item 60 at loc 4, den the output is : item number 1 contains 30 item number 2 contains 20 item number 3 contains 10 item number … | |
I'm working on a project that can recursively print out the items from a single link list. The project also require the reverse method should accept a reference to a generic single-linked list. This is my logic for printing the item in reverse: if the element in a node is … | |
Hello everyone, I have a program that intends to create a doubly linked list of structures, using the following header (q1.h): [CODE=c]typedef struct lNode* ListNodePtr; typedef struct lNode { char* string; ListNodePtr next; ListNodePtr prev; } ListNode; [/CODE] This is my implementation: [CODE=c]#include "q1.h" #include <stdio.h> #include <stdlib.h> #include <string.h> … | |
hey, i am a beginner and we got stuck with my algorithm homework assignment on radixsort. question is followed: struct listnode *radixsort(struct listnode *data, int a, int k) which takes a linked list of unsigned long integers, each less than a^k, and sorts them by k rounds of bucketsort with … | |
Hello! I have this problem with creating a linked list inside a linked list. Think of it as recording a list of customers, and at the same time, recording a list of items they bought individually. I tend to think that I might lose the head node and it's probably … | |
I did it but I got different outcome?? This program is an exercise in generic (singly) linked lists. A parameterized list class with just a few operations. Then,create lists from this class using two different classes for the type parameter creating a "list of lists". You will write a driver … | |
HELP me to make this program, it's so hard to understand anyone can help me to make a program?? PLEASE!!! Using an appropriate definition of listnode, design a simple linked list class with only two member function and a defult constructor: void add(double x) boolean isMumber(double x) LinkedList(); The add … | |
struct looks like this: [CODE] struct ListNode; typedef ListNode* ListType; struct details { char first_name[20]; char last_name[20]; int start_number; int end_number; }; struct ListNode { details data; ListType next; }; ListType list = NULL; ListType head = NULL; ListType * PointerToHead = &head; [/CODE] I have a circular linked list … | |
Hi all. I could really use some help on adding a node to the end of a doubly linked list. First off here is my node class along with the class where the adding should take place. For simplicity I did not add the other parts and classes of the … | |
Hello .. Afternoon, happy, I have a test tomorrow and I want your help in the creation of code: we would like to counter and find the maximum , Minumum for linked list ? PLZ help me :) | |
i have an "add function" that adds names alphabetically to a sorted linked list. the list is already made in this format : Dani Web Mark Markos Michael David Zebra Zebra . . etc if i add a node : adam ( it goes to the end of the list … | |
Hello All, I just wanted to know,how to use recursion to find the nth last element in a linked list? I know of an approach using 2 pointers as well as another one using 2 iterations but I can't seem to figure out the recursive solution.Any help will be greatly … | |
[CODE]void merge() { if(start==NULL) { start=start2; } else { temp=start; while(temp->next!=NULL) { temp=temp->next; } temp->next=start2; } temp=start; if(start==NULL) printf("\nList is empty"); else { printf("\nElements of the list:\n"); while(temp!=NULL) { printf("%d\t",temp->info); temp=temp->next; } } system("pause"); system("cls"); main(); }[/CODE] the following code is use to merge two linked list into one and … | |
I have a simple query, I am using code for "QUEUE IMPLEMENTATION USING SINGLE LINKED LIST" [url]http://ds4beginners.wordpress.com/2006/12/17/queue-implementation-using-single-linked-list/[/url] for my program but having an issue if you pleas help me. [CODE]public class queue { gcroot<message^> msg; queue* next; public: queue(); queue* enqueue(queue*,message^); queue* dequeue(queue*); void queue_display(queue*); void setbinding(String^); String^ getbinding(void); }object, … | |
Hi all, I want to know if there is a smart way in c++ to test if my variable (or pointer) was already initialized? For example, I have a linked list, and I want to add an item to that list. If would like to do some thing [CODE] if … | |
Hi all, I'm having some troubles practicing linked-lists: the problem calls to implement string as a linked-list of chars. So I created a new class - mystring and defined building function, show(), and also destructor. The build and show works correctly. I get the exact same string I sent as … | |
From A C++ beginner. I have written a class that splits the first list into 2.I used iterators to accomplish it. Now I am supposed to create a new method that splits the input chain ∗this, destroys the input chain and uses its nodes to construct the chains a and … | |
I'm creating a program which has data in the linklist. I'm trying to print out the element in the linklist from head to tail and tail to end, but for some reason, I run into some compiler error. I don't know why it won't let me call the hasPrevious and … | |
Hello everyone! I have here a code with a random-access file that lets you delete and update any information in the file. Please run the file to see what I'm talking about. [CODE] #include <iostream> #include <fstream> #include <iomanip> #include <string> using namespace std; #include <cstdlib> int choice; void displaysmenu(void) … | |
Hey, I created a phone directory program. But I was wondering if I could get some hints on how I could create a txt file and add, delete names and numbers on the txt file. [CODE]import java.util.*; import java.lang.*; import java.lang.Object; import jpb.*; public class PhoneDir { private static LinkedList … | |
I read through all previous post regarding quicksort on a linked list. The trouble I am having is using a random element, it seems all the other post are using the first or middle element where I want to use a random element for the pivot. in anycase here is … | |
![]() | I've been trying to figure out whats wrong here, but I just can't wrap my head around it. My compiler outputs the following when I attempt to compile it. [CODE] z:\Desktop\tmp\proj4>cl proj4_linkedlist.c Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. proj4_linkedlist.c … ![]() |
Basically, the assignment is to create a huge integer class by using a singly linked list, wherein each element of the linked list holds one digit of the number of the huge int. I only have to do addition and multiplication, and addition works. Multiplication *should* work, as far as … | |
Please help to make a code of the josephus problem in C using the circular linked list. |
The End.