Create an ADT that contains a fixed-size array that can hold at most 100 integer
ID: 656400 • Letter: C
Question
Create an ADT that contains a fixed-size array that can hold at most 100 integers and the following member functions:
A default constructor that initializes all the elements in this array to 0.
A member function that asks an end user to provide a list of integers from the keyboard and stores these numbers into the fixed-size array.
A member function that recursively prints out the array in reverse order. For example, if the array contains the number 4, 19, and 17. Your function will print out: 17, 19, 4.
A member function that recursively searches the largest number in the array. This function will return not only the value of the largest number but also its index in the array.
A member function that recursively finds the value of the k-th smallest number in the array, where k is provided by the end-user. You are required to use the partition-based, recursive algorithm.
A member function that implements the QuickSort algorithm to sort the array in increasing order.
A member function that implements the QuickSort algorithm to sort the array in decreasing order.
An overloaded put operator (<<) to recursively print out the elements in the array in order.
Explanation / Answer
The following program might be helpful.
<!DOCTYPE html>
<html>
<head>
<title>Fixed-Length Queue Data Type In JavaScript</title>
<script type="text/javascript">
// Create a constructor for the fixed-length queue. This is
// really more of a FACTORY than a construtor since an
// entirely tangential object is returned.
function FixedQueue( size, initialValues ){
// If there are no initial arguments, default it to
// an empty value so we can call the constructor in
// a uniform way.
initialValues = (initialValues || )
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.