plz do not copy from chegg Problem 1. Implement a sorted singly linked list and support the following operations: bool SortedIsEmpty(): return true if the list is empty; int SortedGetLength(): return the length of the list; bool SortedFind(int k, int& x): return the value of the kth element; int SortedSearch(int key): return the position of the element which is same as key (note: use the most efficient method); void SortedInsert(int x): insert x to the right position in the sorted linked list; void SortedDelete(int k, int& x, bool& success): delete the kth element. Part (1) Implement the aboved singly linked list allowing the duplicate element. Part (2) Implement the above singly linked list without allowing the duplicate element. Test your program for both parts with the following operations: Insert 5 Insert 7 Insert 9 Insert 11 Insert 5 Print out the list Insert 7 Print out the list Find the 3rd element Search 7 Print out the length of the list Delete 7 Print out the list Search 7
plz do not copy from chegg
Problem 1. Implement a sorted singly linked list and support the following operations:
bool SortedIsEmpty(): return true if the list is empty;
int SortedGetLength(): return the length of the list;
bool SortedFind(int k, int& x): return the value of the kth element;
int SortedSearch(int key): return the position of the element which is same as key (note: use the most efficient method);
void SortedInsert(int x): insert x to the right position in the sorted linked list;
void SortedDelete(int k, int& x, bool& success): delete the kth element.
Part (1) Implement the aboved singly linked list allowing the duplicate element.
Part (2) Implement the above singly linked list without allowing the duplicate element.
Test your program for both parts with the following operations:
- Insert 5
- Insert 7
- Insert 9
- Insert 11
- Insert 5
- Print out the list
- Insert 7
- Print out the list
- Find the 3rd element
- Search 7
- Print out the length of the list
- Delete 7
- Print out the list
- Search 7
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images