Hello, for a school assignment I was supposed to write an insertion sort algorithm for a doubly linked list. As the feedback system of this particular course is rather weak (actually non-existent) I would like to ask you for your honest opinion about how well this is implemented, what could be improved, made more efficient, etc? Thanks in advance, Marcel #include <iostream> using namespace std; class elem{ public: int value; elem* prev; elem* next; elem(int e, elem* ptr1, elem* ptr2){ value = e; prev = ptr1; next = ptr2; }; }; class list{ private: elem* first; elem* last; int length; …

Member Avatar
Member Avatar
+0 forum 4

HI I donot understand where to start . I need ideas and help. void InsertList(c4735list *destinationList,c4735list *sourceList,node *startNode) { //=====================not implementd yet } this fn inserts source list into destination list.the nodes are inserted after the startnode in destination list.source list should be an empty list after this operation. the current pointer should be set to the head of the list. typedef struct _node { struct _node *prev, *next; void *data; } node; typedef struct _c4735list { node *head, *tail; node *current; void (*cleanupData ) (void *); // function that knows how to clean up data } c4735list;

Member Avatar
Member Avatar
+0 forum 2

How do you create a node with fullName and studentID in the "add" method and then put them into the correct positions which the name_first and name_second should move until the name in the name_first is larger than the new_Name and name_second is smaller than the new_Name? public class NodeDemo{ private String fullName; private int studentID; private NodeDemo fullNameLink; private NodeDemo studentIDLink; public NodeDemo(String newName, int newStudentID, NodeDemo newFullNameLink, NodeDemo newStudentIDLink){ fullName = newName; studentID = newStudentID; fullNameLink = newFullNameLink; studentIDLink = newStudentIDLink; } private static NodeDemo startPosition; public void add(String new_Name, int newStudentID){ NodeDemo name_First = startPosition.fullNameLink; NodeDemo name_Second …

Member Avatar
Member Avatar
+0 forum 7

I have to do a second assigment on doubly linked lists. Problem description: Create a class to implement a doubly linked list to store student records. Besides the basic operations, the class should include a sorting method that allow the user to sort the records in the list. Programming Requirements: 1. Create a doubly linked list in Java. Each element in the list contains a data which is an object of a Student class and two links, next and previous. 2. The Student class contains two class fields only: name - The first and last names are in one string …

Member Avatar
Member Avatar
+0 forum 1

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> ListNodePtr tail = 0; ListNodePtr newNode(void); ListNodePtr addNode(ListNodePtr h, char *w); void printList(ListNodePtr h); void deleteNode(ListNodePtr h, char *w); ListNodePtr newNode(void) { ListNodePtr n; n = (ListNodePtr)malloc(sizeof(ListNode)); n->prev = 0; n->next = 0; return n; } ListNodePtr addNode(ListNodePtr h, char *w) { ListNodePtr a; if (h == 0 && tail …

Member Avatar
Member Avatar
+0 forum 30

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 code cause I do not think they are relevant to understanding the concept. The main focus is the add method. So far I've created a node with the element inside it. After that I'm really confused as to what should point to what. Any comments on the concept would help. …

Member Avatar
Member Avatar
+0 forum 1

I have a simple doubly linked list for a class I am in and I keep getting a seg fault on my last line of code, no matter what i make it. I can put a bunch of random couts and it will print them all then on the last one seg fault, all my test functions are working how they should too. Any idea what would cause a seg fault? only things in the class are what my prof says are the typical functions... The big 3, popBack/front, pushback/front and a few others that already work as they should... …

Member Avatar
Member Avatar
+0 forum 6

please provide me doubly linked list all algorithms......

Member Avatar
Member Avatar
-1 forum 4

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 { private DblListnode prev; private Object data; private DblListnode next; public DblListnode() { this(null, null, null); } public DblListnode(Object d) { this(null, d, null); } public DblListnode(DblListnode p, Object d, DblListnode n) { prev = p; data = d; next = n; } public Object getData() { return data; } public …

Member Avatar
+0 forum 0

The End.