The provided code reads two sequences of numbers

Assignment Help Data Structure & Algorithms
Reference no: EM13168404

 The provided code reads two sequences of numbers. In this task, you are asked to write a function to insert these numbers into two separate doubly linked lists so that the data are in ascending order. The function should have the following form. Note in the current implementation, the numbers are not inserted in ascending order.

template <typename T>

void insertOrder(dnode<T> *header, const T& item)

{

insert(header, item);

}

 

 

2. Follow the instructions under question number 36 on page 500 of the textbook and implement the following function:

template <typename T>

 

void merge(dnode<T> *list1, dnode<T> *list2)

{

}
-------------------
//d_dnode.h

#ifndef DOUBLY_LINKED_NODE_CLASS

#define DOUBLY_LINKED_NODE_CLASS

 

template <typename T>

class dnode

{

public:

// the members of a dnode object are used for operations within a

// doubly linked list; access is simplified by making them public

 

      T nodeValue; // data value of the node

dnode<T> *prev; // previous node in the list

      dnode<T> *next; // next node in the list

 

// default constructor. creates object with value T(), the

// default value of type T. set the node pointers to point at

// the node itself

      dnode()

{

next = this; // the next node is the current node

prev = this; // the previous node is the current node

}

 

      // constructor with an argument to initialize nodeValue.

// set the node pointers to point at the node itself

      dnode(const T& value): nodeValue(value)

{

next = this; // the next node is the current node

prev = this; // the previous node is the current node

}

};

 

#endif // DOUBLY_LINKED_NODE_CLASS

 

 

Reference no: EM13168404

Questions Cloud

Our string class always deletes the old character : Our String class always deletes the old character buffer and reallocates a new character buffer on assignment or in the copy constructor. This need not be done if the new value is smaller than the current value
Ext4 file systems on linux vs. ntfs file systems : List what characters are absolutely not allowed for ext4 file systems on Linux vs. NTFS file systems on Windows in a plain text document.
During the middle ages : During the Middle Ages, to determine the successor to the throne of France, the French used the Salic law. It is formulated as follows: the next to the throne is the living male descendant of the most direct male royal. Male royal here means that ..
The greatest common divisor of the fibonacci number : what is the greatest common divisor of the fibonacci numbers f100 and f101 by Euclid algorithm
The provided code reads two sequences of numbers : The provided code reads two sequences of numbers. In this task, you are asked to write a function to insert these numbers into two separate doubly linked lists so that the data are in ascending order
The packing list describes the ideal contents : The packing list describes the ideal contents of each package, but it is not always possible to include the ideal number of each item. Therefore, the actual items included in each package should be tracked. A package can contain many different ite..
Variable of type string that has been assigned : Assume that word is a variable of type string that has been assigned a value. Write an expression whose value is a string consisting of the last three characters of the value word. So if if the value if word were "biggest" the expression's value w..
Need the build function.use recursion : Implement remaining function. Everything else is provided. Use given material to receive points. Implement remaining function. Everything else is provided. Use given material to receive points. Implement remaining function. Everything else is provide..
Output the starting position and length : X Strings: Input a string. Output the starting position and length of the first occurrence of the longest substring of capital Xs in that string. The first letter is in position 1.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Program to create huffman codes

Write a C++ program to create Huffman codes. Program input is a file called freq.txt (make up your own file for testing) that contains data on the characters in some cleartext file in the form of each character's non-zero frequency of occurrence i..

  Implement bucket sort suing two-dimensional array

Where n is number of values to be sorted. Each row of two-dimensional array is referred to as bucket. Write class named BucketSort containing method called sort.

  Insertion sort and merged using standard merging mechanism

Using "insertion sort" and then merged using standard merging mechanism, where k is value to be determined. How must be we select k in practice?

  Refresh address counter

A microcomputer memory is built from 64K X 1 DRAM, with DRAM cell array organized into 256 rows. Each row requires being refreshed at least once every four ms, strictly on a periodic basis.

  Create algorithm prompt for and receive employee number

Create algorithm which will prompt for and receive the employee number from operator at terminal. Your program is to search array of valid employee numbers to check that employee number is XXXXX,

  Analyzing the use of databases

Create a paper analyzing the use of databases in your company. Include what database applications are used. Conclude through proposing improvements.

  C program to compute and display sales of a store

Modify the C program so that user inputs the buying amount. Check the user's input for validity.

  How output of leaky bucket policer can be fed in second

Illustrate how output of the leaky bucket policer can be fed into second leaky bucket policer so that two leaky buckets in series police average rate, peak rate, and burst size.

  Er diagram of cardinality and modality

Read the following information about World Relief for Disaster Victims (WRDV), a fictional nonprofit organization that provides aid to victims of natural disasters.

  Importance of database documentation

Assume your database is performing poorly, and you just started this new job within the past month. You ask to see the documentation for system and are told it does not exist.

  Finding approximation algorithm and ratio of the algorithm

finding approximation algorithm and the ratio of the algoirthm.

  Method singleparent returns number of nodes in binary tree

Write a method singleParent, which returns number of nodes in a binary tree that have only one child.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd