2,180 Topics

Member Avatar for
Member Avatar for pendo826

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 = …

Member Avatar for raptr_dflo
0
145
Member Avatar for TheFearful

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 …

Member Avatar for histrungalot
0
245
Member Avatar for cryonize

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 …

Member Avatar for raptr_dflo
0
964
Member Avatar for t_daniweb

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 …

Member Avatar for t_daniweb
0
613
Member Avatar for Torf

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 …

Member Avatar for NormR1
0
112
Member Avatar for while(!success)

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. …

Member Avatar for while(!success)
0
244
Member Avatar for brandon93s

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 …

Member Avatar for histrungalot
0
590
Member Avatar for pce369

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 …

Member Avatar for Labdabeta
0
430
Member Avatar for cryonize

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(); …

Member Avatar for Nick Evan
0
592
Member Avatar for akaicewolf

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; …

Member Avatar for akaicewolf
0
128
Member Avatar for POOPdeek

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 …

Member Avatar for Ancient Dragon
0
326
Member Avatar for jodzjcm

How to sort alphabetically the link list? Example: pHead B pSecond A pLast C Result: pSecond A pHead B pLast C

Member Avatar for Ancient Dragon
0
226
Member Avatar for hwoarang69

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. …

Member Avatar for zeroliken
0
162
Member Avatar for coding101

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){ …

Member Avatar for NormR1
0
102
Member Avatar for ineedsomehelp:3

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> …

Member Avatar for zeroliken
0
236
Member Avatar for cryonize

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 …

Member Avatar for mike_2000_17
0
10K
Member Avatar for rayan90

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 …

Member Avatar for zeroliken
0
257
Member Avatar for cryonize

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 …

Member Avatar for TrustyTony
0
9K
Member Avatar for hwoarang69

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) { …

Member Avatar for hwoarang69
0
94
Member Avatar for capton

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;}; …

Member Avatar for capton
0
198
Member Avatar for Hypnos_16

[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. …

0
122
Member Avatar for whitech

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 …

Member Avatar for harinath_2007
0
116
Member Avatar for cahitburak

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 …

Member Avatar for cahitburak
0
967
Member Avatar for Bennys

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, …

Member Avatar for mazzica1
0
99
Member Avatar for Usoda

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 …

Member Avatar for JamesCherrill
0
190
Member Avatar for freedomflyer

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 …

Member Avatar for mike_2000_17
0
595
Member Avatar for shibu2all

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 …

Member Avatar for zeroliken
0
181
Member Avatar for nickliutw

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 …

Member Avatar for nickliutw
0
209
Member Avatar for abed1986

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> …

Member Avatar for abed1986
0
823
Member Avatar for exdx

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 …

0
43
Member Avatar for cryonize

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 …

Member Avatar for Lerner
0
300
Member Avatar for darria

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 …

Member Avatar for peter_budo
-1
141
Member Avatar for jhey_2oo5

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 …

Member Avatar for toimelin
0
250
Member Avatar for nyxxie

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 …

0
153
Member Avatar for muraj

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 …

Member Avatar for NormR1
0
415
Member Avatar for Lama1

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 :)

Member Avatar for sfuo
0
31
Member Avatar for evanovan

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 …

Member Avatar for evanovan
0
204
Member Avatar for ChPravin

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 …

Member Avatar for rexslahed
0
1K
Member Avatar for linezero

[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 …

Member Avatar for thines01
0
185
Member Avatar for SAM2012

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, …

Member Avatar for SAM2012
0
393
Member Avatar for FelineHazard

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 …

Member Avatar for Ancient Dragon
0
7K
Member Avatar for FelineHazard

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 …

Member Avatar for FelineHazard
0
120
Member Avatar for ashsha

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 …

Member Avatar for ashsha
0
182
Member Avatar for nickliutw

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 …

Member Avatar for dantinkakkar
0
152
Member Avatar for Candace Parker

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) …

Member Avatar for Moschops
0
3K
Member Avatar for drico7041

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 …

Member Avatar for dantinkakkar
0
3K
Member Avatar for fr0st003

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 …

Member Avatar for fr0st003
0
651
Member Avatar for thache

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 …

Member Avatar for thache
0
342
Member Avatar for SumPersonGuy

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 …

Member Avatar for tungnk1993
0
157
Member Avatar for davidTechy

The End.