Answered step by step
Verified Expert Solution
Question
1 Approved Answer
( 1 6 pts ) You are given a random array consisting of integers ( including positive, negative, and 0 ) , and each element
pts You are given a random array consisting of integers including positive, negative, and and each element may be repeated.
Note: for all the questions below, please use the iostream library only.
a pts Write a function bubbleSort to implement Bubble Sort to sort the array in descending order.
Function signature:
void bubbleSortint nums int
Example:
Input: nums
Expected realization: nums
b pts Write a function quickSort to implement Quick Sort to sort the array in descending order.
Function signature:
void quickSort int nums int
Example: see above.
c pts Write a function dedup Licate to remove the repeated integers from your sorted array and return the length of the updated array. Do not use extra memory space.
Function signature:
int deduplicateint nums int
Example:
Input: nums
Expected realization: nums
Output:
d pts What are the time and space complexity of each function that you realized above? Explain why.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started