Draw a sketch of a doubly-linked list

Assignment Help C/C++ Programming
Reference no: EM132080039

You need help with these three questions. Please answer all of them

1. Draw a sketch of a doubly-linked list, specifically of class DLinkedList in DLinkedList.h, containing the first four words of your favorite song (one word in each node). Make sure to show the DLinkedList object, all node objects, and all objects' data members and pointers.

2. Complete the following main function to create your linked list above (Your code should go in only the indicated space - do not change any other code).

#include <iostream>

#include <string>

#include "DLinkedList.h"

using namespace std;

int main()

{

DLinkedList<string> lyrics;

// YOUR CODE TO CREATE THE LIST GOES HERE

cout << lyrics.front() << endl;

}

3. Write the following new member function for the DLinkedList class. The member function must swap the first and second data nodes (not the sentinels) in the linked list (other data nodes stay as they are). Throw an exception if the list has fewer than two elements. Your code should go in only the indicated space (in DLinkedList.h) - do not change any other code.

template <typename E>

void DLinkedList<E>::swapFirstAndSecond(){

// YOUR CODE TO SWAP NODES GOES HERE

}

Test that your code works by again printing out the front of the list in your main function after calling lyrics.swapFirstAndSecond().

Include a screen capture of the output of your program

Reference no: EM132080039

Questions Cloud

Write a sed script called activity61 to format : Write a sed script called activity61 to format the above file as: FullNname PhoneNumber EmailAddress
What is tom income tax basis in the property : Tom and Elizabeth purchase land for $1 million-Tom furnishes $400,000 and Elizabeth $600,000 of the purchase price.
Determine the amount of the premium on the day of issue : On January 1, 2016, Young Company issued bonds with a face value of $300,000, Determine the amount of the premium on the day of issue
Determine the factory overhead rate : Tin y Biggs Company operates two factories. The company applies factory overhead to jobs on the basis of machine hours in Factory 1 and on the basis of direct.
Draw a sketch of a doubly-linked list : Draw a sketch of a doubly-linked list, specifically of class DLinkedList in DLinkedList.h, containing the first four words of your favorite song.
Calculate the amount of the insurance claim : Required: Calculate the amount of the insurance claim to be filed for the inventory destroyed in the tornado
What is the cell reuse distance : What is the cell reuse distance for a 15 km cell radius with a k=6?
Controversial issue in our political environment : Immigration is an example of a topic that is a controversial issue in our political environment.
Write a verilog module for an odd parity generator circuit : Write a Verilog module for an odd parity generator circuit. The data message is 4 bits. Use Verilog bitwise operators. Do not use always blocks.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Task 1 write compile and run the following two programs

task 1 write compile and run the following two programs using cc programming method. select the appropriate defined

  Write the select query

Assume the table "books" contains books that the company stocks. Assume the table order_lines only contains books that have actually been ordered.

  How do the properties derived classes differ

How do the properties derived classes differ

  Process creation

Write a C (or C++) program that can create a collection of processes (each with its base thread) when a user runs the program. Using the standard cmd prompt features, you can "launch" a process just by typing its name. I will need some way to provide..

  Define the method computediscount

It should define the method computeDiscount so that if the quantity purchased of an item is more than minimum, the dis-count is percent percent.

  Worst-case and best-case running times

a. Write a pseudocode for this algorithm. b. What are the worst-case and best-case running times for this sorting algorithm?

  C++ programming to add-subtract-multiply or divide two no

create a text-based, menu-driven program that allows the user to choose whether to add, subtract, multiply or divide two numbers. The program should then input two double values from the use, perform the appropriate calculation, and display the re..

  Write code to find all pairs of integers in a sorted array

EEO 224: Object-Oriented Programming for Electrical and Computer Engineers Spring 2018 - Write a program that reads a char as input

  Implement the bisection method for solving given equations

Implement the Bisection Method for solving equations. Use the following function: double root(double (*pf)(double x), double a, double b, int n).

  Design a modularized body mass index program

Design a modularized Body Mass Index (BMI) Program which will calculate the BMI of a team player. The formula to calculate the BMI is as follows:  BMI = Weight * 703/Height2

  Implement a cardiac machine simulator in c++

keep track of the bug location; which could be an index into the memory array. Watch out for cells 0 and 99; they are special.

  The mean and standard deviation

How do i write a program in c++ that use functions max, min, the total numbers, the mean and standard deviation to read a file text and return these values from the file text. note the file text has random numbers. note im not suppose to use arrays.

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