Answered You can hire a professional tutor to get the answer.

QUESTION

Implement a linked list class using pointers and object-oriented programming.

Implement a linked list class using pointers and object-oriented programming. Although the C++ STL (Standard Template Library) offers a linked list implementation, you must implement this program "from scratch" and cannot simply utilize the existing STL offerings (<list> or <forward_list>).

Your linked list will be designed to contain signed integers of type int.

Required Classes

You must implement the classes shown below (as well as the member functions that are listed).

{: val; Linked_List_Node *next; }

Note: Linked_List_Node is being used akin to a struct (with public member variables). This is intentional so that you can easily modify the member variables from within the Linked_List class.

Linked_List {: length; Linked_List_Node *first; : ; ; ; ); ); val, index); ; ; }

Note that the sort_ascending() function must be implemented using the recursive Merge Sort algorithm

 (Links to an external site.)

Links to an external site.

. sort_descending() can utilize Merge Sort or a different algorithm (see extra credit).

You are also required to implement a function that counts the number of prime numbers within a Linked_List. This can be written as part of the Linked_List class or in some other class. For our purposes, a negative number is never considered to be prime.

Application Description

Once you have implemented the fundamental building blocks of a linked list you will use this functionality to build a simple application. Implement a program to replicate the following behavior:

Please enter a number: 146 you want another (y n): yEnter a : you want another (y n): yEnter a : you want another (y n): yEnter a : you want another (y n): yEnter a : you want another (y n): n ascending descending (a d)? aYour linked : You have prime (s) your list. you want this again (y n)? nOther Program Requirements
  • When sorting nodes, you may not swap the values between nodes and must change the pointers on the nodes to swap them.
  • You must have a class for each of the following things: Linked_List, Linked_List_Node. As usual, it is completely fine to implement additional classes if you can defend their existence.
  • Your program must be factored into interface, implementation, and application. Specifically, you should have one header file and one implementation file for each class, and you should have a single application file containing your main() function. If you choose to implement a template class, it is acceptable to insert both the header and implementation information into a corresponding .hpp file.
Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question