100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Other

UnsortedList and SortedList Class File

Rating
-
Sold
-
Pages
1
Uploaded on
06-11-2025
Written in
2025/2026

The provided code defines two classes for managing lists of integers: `UnsortedList` and `SortedList`. Both classes include the following features: 1. **UnsortedList**: - Stores a fixed number of items (defined by `SIZE` which is set to 10). - Contains private members for storing IDs and the current length of the list. - Public methods include: - Constructor and destructor. - `isFull()` and `isEmpty()` to check the list's status. - `insertItem(int id)` to add an ID. - `deleteItem(int id)` to remove an ID. - `displayList()` to show the contents of the list. 2. **SortedList**: - Similar to `UnsortedList`, it also handles a fixed number of items. - Contains private members for storing numbers and the current length of the list. - Public methods include: - Constructor and destructor. - `isFull()` and `isEmpty()` functions. - `insertItem(int item)` to add a number while maintaining sorted order. - `deleteItem(int item)` to remove a number. - Search methods: `binarySearch(int item)` for efficient lookup in a sorted list and `linearSearch(int item)` for checking each element. - `displayList()` to present the contents. Both classes support basic operations on the lists while providing functionalities specific to their unsorted or sorted nature.

Show more Read less








Whoops! We can’t load your doc right now. Try again or contact support.

Document information

Uploaded on
November 6, 2025
Number of pages
1
Written in
2025/2026
Type
Other
Person
Unknown

Content preview

#include <iostream>
#include <string>
#include <cctype>
using namespace std;

#ifndef UNSORTEDLIST_H
#define UNSORTEDLIST_H

const int SIZE = 10;

class UnsortedList
{
private:
int idNumbers[SIZE];
int length;
public:
UnsortedList();
~UnsortedList();
bool isFull() const;
bool isEmpty() const;
void insertItem(int id);
void deleteItem(int id);
void displayList() const;
};

#endif


#ifndef SORTEDLIST_H
#define SORTEDLIST_H

#include <iostream>
#include <string>
using namespace std;

class SortedList
{
private:
int length;
int numbers[SIZE];
public:
SortedList();
~SortedList();
bool isFull() const;
bool isEmpty() const;
void insertItem(int item);
void deleteItem(int item);
int binarySearch(int item);
int linearSearch(int item);
void displayList() const;
};

#endif
$11.49
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
tinahuynh

Get to know the seller

Seller avatar
tinahuynh California State University, Long Beach
View profile
Follow You need to be logged in order to follow users or courses
Sold
New on Stuvia
Member since
1 month
Number of followers
0
Documents
68
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions