COSC2430: Data Structures and Programing Sorting Algorithms

computer science

Description

Using doubly linked list

Need help on implementing the heap and merge sort, the rest of sorting is optional.

The input from the text file should be stored in the array of the doubly linked list.

Breaking a number into a list of nodes. Each node will store the number of digits specified in the parameters.

Here is the code Im working on:

struct Node {

long long num;
Node* prev;
Node* next;
};
class DoubleLinkedList {
public:
DoubleLinkedList(); // default construct
~DoubleLinkedList(); // deconstruct
DoubleLinkedList(const std::string& num, int digitsPerNode); // user defined construct
DoubleLinkedList(const DoubleLinkedList& list); // copy construct
DoubleLinkedList& operator = (const DoubleLinkedList& list); // assignment consturct
void Print() const;
private:
Node* head;
Node* tail;
int m_digitsPerNode;

DoubleLinkedList(int digitsPerNode);

bool DoubleLinkedList operator <(const DoubleLinkedList & list);

void Append(Node* node);

};


Related Questions in computer science category