Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question

Read this: Complete the code in Visual Studio using C++ Programming Language with 1 file or clear answer!!

- Give me the answer in Visual Studio so I can copy***

- Separate the files such as .cpp, .h, or .main if any!

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 listnode 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
Check Mark
Knowledge Booster
Background pattern image
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.
Similar questions
    SEE MORE QUESTIONS
    Recommended textbooks for you
    Text book image
    Database System Concepts
    Computer Science
    ISBN:9780078022159
    Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
    Publisher:McGraw-Hill Education
    Text book image
    Starting Out with Python (4th Edition)
    Computer Science
    ISBN:9780134444321
    Author:Tony Gaddis
    Publisher:PEARSON
    Text book image
    Digital Fundamentals (11th Edition)
    Computer Science
    ISBN:9780132737968
    Author:Thomas L. Floyd
    Publisher:PEARSON
    Text book image
    C How to Program (8th Edition)
    Computer Science
    ISBN:9780133976892
    Author:Paul J. Deitel, Harvey Deitel
    Publisher:PEARSON
    Text book image
    Database Systems: Design, Implementation, & Manag...
    Computer Science
    ISBN:9781337627900
    Author:Carlos Coronel, Steven Morris
    Publisher:Cengage Learning
    Text book image
    Programmable Logic Controllers
    Computer Science
    ISBN:9780073373843
    Author:Frank D. Petruzella
    Publisher:McGraw-Hill Education