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

  Returns true if a string contains properly nested

Give an algorithm that returns true if a string contains properly nested and balanced parentheses, and false if otherwise. Hint: At no time while scanning a legal string from left to right will you have encountered more right parentheses than left..

  Creating the flowchart for the decision structure

A telephone corporation service plan charges twenty-five cents for each call made. In addition, it charges five cents a minute for all calls made to a phone number that has a service plan with the corporation.

  Question about data model

Create a simple data model that outlines a database management system. This model requires to track people's participation in several fitness activities at a fitness center.

  Calculate best and worst-case speedup for centralized scheme

Suppose that it doesn't take any time to allot work to process, calculate best- and worst-case speedup for centralized scheme for dynamic mapping with two processes.

  Create an er diagram

Create an E-R diagram with all appropriate notation for the following condition. In a particular fruit growing region there are a number of orchards.

  Designing an algorithm for task-array of person numbers

You have been allotted task of designing an algorithm for following task. Someone has built the array of person numbers of all n students enrolled in 331 this fall.

  Diagram of a telephone network

Consider a diagram of a telephone network, which is a graph G whose vertices represent switching centers, and whose edges represent communication lines joining pairs of centers. Edges are marked by their bandwidth, and the bandwidth of a path is the ..

  Computing time complexity of procedure

What is the time complexity of the procedure? If A[l .. r] = [24, 30, 09, 46, 15, 19, 29, 86,78], what is the output?

  Transmitting image using raster scan order

If we were to transmit this image using raster scan order, after 15 seconds how many rows of the image will the user have received?

  System administrators database, network and application

What methods would you use to effectively manage a team of system administrators database, network, application working in your data center?

  Choosing computer passwords

Before logging on to computer, you must have a unique username and unique password. Analyze and explain considerations you must make when choosing a password.

  Sorting algorithm to put whole array in order

Assume you have the array of 1000 records in which only few are out of order and they are not very far from their correct positions.

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