: Develop a linked list node struct/class You can use it as a subclass like in the book (Class contained inside a class) You can use it as its own separate class Your choice
: Develop a linked list node struct/class You can use it as a subclass like in the book (Class contained inside a class) You can use it as its own separate class Your choice
Chapter9: Using Classes And Objects
Section: Chapter Questions
Problem 19RQ
Related questions
Question
Give me the answer in one Visual Studio file, not Visual Studio Code
- Give me full code near and simple
Develop a C++ "doubly" linked list class of your own that can hold a series of signed shorts
Develop the following functionality:
- Develop a linked list node struct/class
- You can use it as a subclass like in the book (Class contained inside a class)
- You can use it as its own separate class
- Your choice
- Maintain a private pointer to a node class pointer (head)
- Constructor
- Initialize head pointer to null
- Destructor
- Make sure to properly delete every node in your linked list
- push_front(value)
- Insert the value at the front of the linked list
- pop_front()
- Remove the node at the front of the linked list
- If empty, this is a no operation
- operator <<
- Display the contents of the linked list just like you would print a character string
- operator []
- Treat like an array
- Return the value stored in that element of the linked list
- If element doesn’t exist, return std::numeric_limits<short>::min()
- empty()
- Returns a boolean that determines if the linked list is empty or not
- size()
- Returns how many elements are currently in the linked list
- You may not use a variable to maintain the size
- You must calculate it manually using pointers
- insert(positionIndex, value)
- Think
vector indexing - positionIndex of 0 means insert at the beginning of the linked list
- positionIndex >= linked list size gets inserted at the back of the linked list
- erase(positionIndex)
- Think vector indexing
- positionIndex of 0 means insert at the beginning of the linked list
- positionIndex >= linked list size is a no operation
- find(value)
- Searches the linked list for the given value
- Think vector indexing
- If found, returns the index value it is at
- If not found, returns -1
Extensively test your linked list class to make sure all above functionality works in all possible cases
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 6 images
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
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT