Write constructors, destructors, and all necessary member functions such as insert, erase, increment and decrement operators, operator* to dereference, as well as operator== and operator!= to check whether two iterators are pointing to the same element.
INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS
Homework # 6
Part I: Theory & Practice
- Read Ch 11 and Ch 12.
- Practice Problems: R11.5, R11.9, R11.13, P11.1, P11.5, P11.11, R12.7, P12.1, P12.7, P12.14 ( not collected )
Part II : Programming
- Coding Exercise (20 points ).
Using good coding practices, design your own Linked List of int types. It will consist of classes List, Node, and Iterator granting friendship and defining functions as needed. Write constructors, destructors, and all necessary member functions such as insert, erase, increment and decrement operators, operator* to dereference, as well as operator== and operator!= to check whether two iterators are pointing to the same element. You will then use this list to write the following member functions :
- List::reverse to reverse your nodes
- List::push front to add a value to the beginning of a list
- List::sort to sort the elements of a linked list (without copying them into a vector or another data type)
- List::merge which accepts another List object and merges the two lists into one, alternating elements from each list such that merging 1 7 12 and 8 3 11 2 2 1 yields the list 1 8 7 3 12 11 2 2
Write a main function to test your list such that it follows the output shown in Figure 1. Compile your code and run your program to check for compile-time errors and logic errors. Submit your header files and source codes to ccle.ucla.edu in separate files.
Attachments:
Related Questions
. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:
1
Project 1
Introduction - the SeaPort Project series
For this set of projects for the course, we wish to simulate some of the aspects of a number of
. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:
1
Project 2
Introduction - the SeaPort Project series
For this set of projects for the course, we wish to simulate some of the aspects of a number of