286 Topics
| |
i am trying to move the node in the first item from the list and add it to the back of the list 1->2->3 becames 2->3->1 instead i get 3 1 2 [CODE] #include <iostream> using namespace std; struct nodeType { int info; nodeType *link; }; void createList(nodeType*& first, nodeType*& … | |
Hello. The problem with the following code is that when I read from a file after restarting the program and then try to display the contents, it goes into an endless loop. I hope that someone can point out the logical error hiding there. [CODE]#include <iostream> #include <windows.h> #include <fstream> … | |
[CODE] #include<iostream> #include<time.h> #include<conio.h> using namespace std; class adclist { struct list { int data; list* next; }; public: void makelist(); }; void adclist::makelist() { list** table = new list* [10]; for(int j =0; j < 10 ; j++) table[j] = NULL; for ( int m =0; m < 10; … | |
Hi! I've got this structure struct *cell{int row,int column,int distance, struct cell *next}. By calling a function, I fill a linked list . The problem is that I cannot find how to delete the nodes that have the same row and column.Let me provide an example. Let's say that the … | |
Dear friends, hello to you all as this is my first thread - question to the forum. This is my problem, which is a school exersize: I create a linked list which contains three numbers r,c,d per node From this list I have to create a hash table htable[7] with … | |
Hello everyone. I've been trying to implement a linked list in C++. I found this implementation on the web, where they created a struct for the list's nodes. When trying to add a new node to the list, I get this error: [B]List.C: In member function `bool Linked::addNode(Point)': List.C:23: error: … | |
hi I have been working in this code for a while and I need to know what's wrong with it ASAP. here: [CODE]#include<iostream> using namespace std; class Node { public: int value; Node * next; Node(); Node(int); }; Node::Node():value(0),next(NULL){} Node::Node(int v):value(v),next(NULL){} bool AllPositive(next * h) { bool test = false; … | |
Here is the input.txt file that I have. [code]2 5 -2 3 1 2 4 0 1 2 1 0 [/code] These are 2 polynominals. 2x^5 - 2x^3 + x^2 + 4 and x^2 + 1 while <3,5> : 3 is the coefficient, 5 is the degree. I just can … | |
I believe the error has something to do with my mergeArray function. Its a modified version of the insertNode function. i tried to make it so that i can loop through and insert an entire array of elements into a linkedList. My program compiles without error but gives me a … | |
THis is what I need to do...I need help with the third point [INDENT]1. Write a class OrderedList. The implementation of OrderedList must be as a linked list of Comparable elements. The list items are maintained in ascending order at all times. On this assignment, no indexing methods are allowed. … | |
pls someone give me a c++ program to insert and delete an element from a linked list...i tried a lot but i am stuck.. | |
This is supposed to be a code for a video game store [CODE]#include<iostream> #include<fstream> using namespace std; ifstream infile; struct VideoGame { string Name; string Genre; string Publisher; string Developer; string Platform; string Price; int count; VideoGame *link; }; void CreateList(VideoGame*& first, VideoGame*& last); void CheckOut(VideoGame*& first, string title); bool … | |
Hello everybody! I have to Questions to ask please: 1) How can I find the maximum value in a single linked-list recursively? this is what I tried to do: int findMax(int key){ Node max=head; while (max != null){ if (max < max.getKey()) return(max.getNext()); } } it ends up to an … | |
Been working on this for 2 hours non stop. Can't seem to figure out exactly what's the problem. Perhaps I'm taking a wrong approach to this problem. Right, I need to copy a singly linked list to another new list. Can use any method EXCEPT RECURSION. Here's the code so … | |
How can i make addition in my linked lists if the nodes are stroing two values: 1) int element 2) int colomnvalue i have to make the addition on the basis that the nodes having the same colomvalue, thier element should be added. This addition is to be made in … | |
i want to know whats the error over here. i just want to store the three value in a node and making a linked list but after storing two nodes that is headptr and than temptr, when the third node is made it stops. I think my error is somewhere … | |
My question is that what is the effect if I delete a pointer in a linked list by mistake??? What problems will arise and how will I come to know that is a missing pointer that is causing the trouble? | |
I've got a program that is supposed to mimic a music playlist by implementing a circular, doubly linked list. However, i cant use java's LinkedList, i have to write my own linked list. I have a DblListnode class to keep track of the nodes (show below) [CODE]public class DblListnode { … | |
Hi guys I'm struggling to write a code for traversing a directed graph. It contains City as nodes. I'm trying to put City(s) to a LinkedList and then work with them to find the path. However, as you will notice I'm still newbie in C++. I have a *nextcities as … | |
I've searched all over google and this site. I've found a few hints here and there but after i make the changes either my compiler throws a fit or it doesn't produce the desired results. Here's what i want: I want to create a linked list in the main function … | |
[code] class Node { private: int integer; Node *pointer; public: Node(int x = 0, Node *y = NULL) { integer = x; pointer = y; } int getInteger() { return integer; } Node getPointer() { return *pointer; } }; [/code] [code] private: Node *stack; Node *top; int listSize; int pushedValue; … | |
[CODE]/*Task: Two ordered linklist contain number. eg.1->2->3-> and 2->3->5 **Print** union of them eg.1->2->3->5 ,remove duplication, can't change linklist Problem : 1. append() might need to be modified. 2. dnot't know how to use append() to complete the task. */ #include <stdio.h> #include <malloc.h> #include <string.h> #include <stdlib.h> typedef struct … | |
I have an win32 console phonebook application. Phone records are held as linked list. [CODE] struct Tel_dugum{ char name[NAMELEN]; char telno[TELNOLEN]; Tel_dugum *next; }; [/CODE] You can see the structure of the linked list above. My problem is when i search i dont want my app to search whole records … | |
Here are my questionsand my answers. Could you guys/gals tell me if i am right or wrong? Which array-based operations are O(1)? inserting item or deleting item in unsorted array Which linked-list operations are O(1)? inserting and deleteing item in unsorted lsit Which array-based operations are O(n)? traversing through the … | |
Hello all, I have a question: What are the advantages & disadvantages of the circular linked list compared with: a. Usual linked list b. Doubled linked list Although the implementation of the usual list functions & the circular list functions are similar…when do we have to use it?? or in … | |
hi all, i have a programming assignment where i read a text file through command line arguments. i then use that information to get a list of photos (just strings, not actual images) and a list of keywords that correspond to each of those photos. i am stuck on how … | |
Hey guys/gals for some reason in my main function my first while loop will not take in more than two values. any reasons why that wont happen? and just to be on the safe side, did I implement my remove function properly? [CODE]#ifndef SORTEDLIST_H #define SORTEDLIST_H #include<iostream> using namespace std; … | |
I have a scenario where i am given a file that contains info such as: (just a sample) img01.jpg|Washington DC|aquarium|puffer fish|seahorse img02.jpg|CHICAGO|AQUARIUM img03.jpg|Chicago|fish where the first section is the "image" (just a made-up name, not an actual image) and the rest of the words are keywords. ive been able to … | |
Cn anybody give me a program about adding nodes at the end of the list in C? I just need a basis of a program that I will be creating. I also needed its algorithm. Thanks in advance. |
The End.