C++ Coding (1)

C++ Coding (1)

FOLLOW THE INSTRUCTIONS AND WRITE A CODE ABOUT IT.

THE LINK FILES IN NOTE PART IS IN THE FILES THAT I UPLOADED.

THE FILE “UNSORTED……ALGORITHMS.TXT” ARE THE TEACHING PART OF THIS ASSIGNMENT.

Topics Covered:

  • Algorithm Analysis
  • The unsorted array-based list

Goals:

  • To gain a basic understanding of algorithm analysis and big-O notation.
  • To understand how array-based lists work.
  • To understand the unsorted array-based list algorithms.

Don’t write the program too complex!!!!

—————————————————REQUIREMENTS START HERE—————————————————————————————–

Requirements:

Use the following UML diagram and description to write a class implementing an unsorted list.

Class Attributes Description:

Class variables:

  • list: an integer pointer that holds the memory address of a dynamically allocated integer array.
  • size: an integer that holds the current size of the list. Gets initialized to 0.
  • max: an integer that holds the size of the integer array. Initialized with the size of the integer array.

Class methods:

  • Constructor: Accepts an integer as it’s only argument. Uses the argument to initialize max. Initializes size to 0. Dynamically allocates an integer array that has max elements and stores the memory address of the array in pointer list: list = new int[max];
  • Destructor: Frees the dynamically allocated array created by the constructor.
  • isFull: returns true if the list is full, false otherwise.
  • isEmpty: returns true if the list is empty, false otherwise.
  • insert: If the list isn’t full, places it’s argument at the end of the list and updates the size variable. If the list is full, throws a c-string exception: “LIST FULL”.
  • remove: uses it’s argument to remove an item from the list. The argument is the position within the list of the item to remove. If the list is empty, throws a c-string exception: “LIST EMPTY”. If the argument is out of bounds, throws the following c-string exception: “OUT OF BOUNDS”.
  • find: searches for it’s argument within the list. Returns the index of the element of the array if the argument was found, -1 otherwise.
  • get: Returns the “a’th” value of list. That is, if the argument is 3, then returns the 4th value in the list. If the argument is out of bounds, throws the following c-string exception: “OUT OF BOUNDS”. If the list is empty, throws the following c-string exception: “LIST EMPTY”.

Notes:

  • The class does not interact with the user in any way, i.e., no cout or cin statements.
  • Any emails of “Does this look right?” will be answered with “What makes you think it doesn’t look right?”. Your class and code is correct if it satisfies the above requirements. I won’t “pre-grade” your solution.
  • You can use this driverView in a new window to get you started on testing your solution. It is not complete. It does not guarantee a perfect score.
  • Your header file should have preprocessor guards and your accessor methods should be marked const.
  • You can review how to read UML class diagrams here (Links to an external site.)Links to an external site..
  • You can download and use this skeleton of MyList.hView in a new window to get you started and make sure the header file is formatted correctly. Make sure the header file you upload is named correctly. This skeleton is named MyList-1.h. THe one you submit must be named MyList.h.

Submitting Your Solution:

Your class should be written in a plain-text source file named MyList.h. Submit this file, and only this file, through Canvas.

You may submit your solution multiple times in case you want to make corrections or change something. The last file submitted before the due date will be the one that is graded.

"You need a similar assignment done from scratch? Our qualified writers will help you with a guaranteed AI-free & plagiarism-free A+ quality paper, Confidentiality, Timely delivery & Livechat/phone Support.


Discount Code: CIPD30



Click ORDER NOW..

order custom paper