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

  Show result of inserting keys using linear probing

Show the result of inserting these keys using linear probing, using quadratic probing with c1 = 1 and c2 = 3, and using double hashing with h2(k) = 1 + (k mod (m ¡ 1)).

  Sorting arrays of name in descending order

Then sort arrays so that records are in descending order by purchase amount for month. Output lists the names of the top five customers.

  Diameter bounded minimum spanning tree of graph by prim-s

Modify Prim's or Kruskal's algorithm to determine diameter bounded minimum spanning tree of complete graph. A diameter bounded minimum spanning tree is spanning tree.

  Question about database structure

Determine when a typical database is created the structure is constructed before the data is actually loaded into the database. What problems exist when someone wishes to add or delete from the existing structure?

  Sql based question

In order to make the SQL select statements that would manufacture running summary files for reports of the above; how would you answer the questions below?

  Question about lan and wan

Think about the following two scenarios two computers are connected to a LAN using a total of 20-feet of cable, and two computers are connected over the Internet and are 8000 miles from each other.

  Explain eager decision tree algorithm-lazy knn algorithm

Discuss the advantages and disadvantages of the new algorithm compared with the eager decision tree algorithm, and the advantages and disadvantages of the new algorithm compared with the lazy kNN algorithm.

  Short discussion on the concept of cryptography

The answer gives the learner with a short discussion on the concept of cryptography and the different aspects and functions that are provided through using encryption.

  Analyzing certain software properties affects

Describe how the lack of metrics for analyzing certain software properties affects the software engineering discipline.

  Possible inputs to a given comparison-based

One of the n! possible inputs to a given comparison-based sorting algorithm, what is the absolute maximum number of inputs that could be sorted with just n comparisons?

  Creating sql statements

Create three SQL statements: the 1st statement should add pending amounts to appropriate accounts, the second statement should subtract the pending amounts from appropriate accounts,

  Evaluate algebraic expression by code with three-operand

Evaluate a short algebraic expression using code with three-operand instructions. The expression should have a minimum of three operands and 2 operators.

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