With public functions: const & operator=(const nodeType&); void setInfo(const Type& elem); Type getInfo() const; void setLink(nodeType *ptr); nodeType* getLink() const; nodeType(); nodeType(const Type& elem, nodeType *ptr); nodeType(const nodeType &otherNode); ~nodeType(); With private node data, and link Type info; nodeType *link; linkedList.h With public functions: const linkedListType& operator= (const linkedListType&); void initializeList();
With public functions: const & operator=(const nodeType&); void setInfo(const Type& elem); Type getInfo() const; void setLink(nodeType *ptr); nodeType* getLink() const; nodeType(); nodeType(const Type& elem, nodeType *ptr); nodeType(const nodeType &otherNode); ~nodeType(); With private node data, and link Type info; nodeType *link; linkedList.h With public functions: const linkedListType& operator= (const linkedListType&); void initializeList();
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Create the following templated classes, use the books examples to help
you.
you.
nodeType.h
With public functions:
const <Type>& operator=(const nodeType<Type>&);
void setInfo(const Type& elem);
Type getInfo() const;
void setLink(nodeType<Type> *ptr);
nodeType<Type>* getLink() const;
nodeType();
nodeType(const Type& elem, nodeType<Type> *ptr);
nodeType(const nodeType<Type> &otherNode);
~nodeType();
With private node data, and link
Type info;
nodeType<Type> *link;
linkedList.h
With public functions:
const linkedListType<Type>& operator=
(const linkedListType<Type>&);
void initializeList();
bool isEmptyList() const;
void print() const;
int length() const;
void destroyList();
Type front() const;
Type back() const;
virtual bool search(const Type& searchItem) const = 0;
virtual void insertFirst(const Type& newItem) = 0;
virtual void insertLast(const Type& newItem) = 0;
virtual void deleteNode(const Type& deleteItem) = 0;
linkedListIterator<Type> begin();
linkedListIterator<Type> end();
linkedListType();
linkedListType(const linkedListType<Type>& otherList);
~linkedListType();
With protected data
int count; //variable to store the number of list elements
nodeType<Type> *first; //pointer to the first node of the list
nodeType<Type> *last; //pointer to the last node of the list
With private function
void copyList(const linkedListType<Type>& otherList);
orderedLinkedList.h
With functions:
bool search(const Type& searchItem) const;
void insertFirst(const Type& newItem);
void insertLast(const Type& newItem);
void deleteNode(const Type& deleteItem);
unorderedLinkedList.h
With functions:
bool search(const Type& searchItem) const;
void insertFirst(const Type& newItem);
void insertLast(const Type& newItem);
void deleteNode(const Type& deleteItem);
unorderedLinkedList and orderedLinkedList are derived from
the linkedList type. Write the definitions of these classes so that they
can use the member functions of the class nodeType to access the
info and linked fields of the node.
Submit only the header files (nodeType.h, linkedList.h,
orderedLinkedList.h and unorderedLinkedList.h ) and your
documentation files. The header files must include all function
definitions. Validate compilation of your header files with the
following code. The test program will exercise all functions in the
classes listed above.
#include <iostream>
#include <string>
#include "orderedLinkedList.h"
#include "unorderedLinkedList.h"
using namespace std;
int main()
{
orderedLinkedList<int> list1;
orderedLinkedList<string> list2;
unorderedLinkedList<int> list3;
unorderedLinkedList<string> list4;
list1.initializeList();
list1.isEmptyList();
list1.print();
list1.length();
list1.destroyList();
list1.insertFirst(123);
list1.front();
list1.back();
list1.insertLast(456);
list1.deleteNode(123);
list1.search(456);
list1.search(123);
nodeType<float> node1;
node1.getInfo();
node1.setInfo(123.0);
node1 = node1;
return 0;
orderedLinkedList<int> list1;
orderedLinkedList<string> list2;
unorderedLinkedList<int> list3;
unorderedLinkedList<string> list4;
list1.initializeList();
list1.isEmptyList();
list1.print();
list1.length();
list1.destroyList();
list1.insertFirst(123);
list1.front();
list1.back();
list1.insertLast(456);
list1.deleteNode(123);
list1.search(456);
list1.search(123);
nodeType<float> node1;
node1.getInfo();
node1.setInfo(123.0);
node1 = node1;
return 0;
}
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
Can you please resend me the whole code WITH the implementation functions and WITHOUT errors, I copied and pasted the exact code you gave me but I get errors.
Solution
by Bartleby Expert
Follow-up Question
I don't get the "//To be implemented" comments, what am I supposed to do?
Also, are the header files and header files implementation different? Like is the linkedList.h different than the linkedList.h (implementation)?
Solution
by Bartleby Expert
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education