Explore BrainMass

Write the function definition as a recursive search using C++

This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here!

A sequential search member function of SortedType has the following prototype:
void SortedType: : Search(int value, bool& found) ;
a. Write the function definition as a recursive search, assuming a linked list implementation.
b. Write the function definition as a recursive search, assuming an array-based implementation.

© BrainMass Inc. brainmass.com October 25, 2018, 9:31 am ad1c9bdddf

Solution Preview

Part a

Recursive search

using namespace std;

int recursiveSequential( int a[], int size, int value ) {

if( size == 0 )
return -1;
if( value == a[ size - 1 ] )
return size - 1;
return recursiveSequential( a, size - 1, value );

int main () {

int const length = 10;
int searchV;
int list[10] = { 2, 3, 4, 5, 20, 40, 80, 45, 99, 0};

cout << "Please enter the value to be searched" <<endl;
cin>> search;

cout << recursiveSequential(list, length, searchV) << endl;

return 0;

using link list function

template<typename T>
Iterator<T> LinkedList<T>::find(T value)

Node<T>* pos = NULL;
Iterator<T> res=pos.position;

Node<T>* current = first;
Iterator<T> iter=current.position;

while (current != NULL) ...

Solution Summary

The solution gives a complete C++ code to write the function definition as a recursive search, assuming both a linked list implementation and an array-based implementation.

See Also This Related BrainMass Solution

Executive Report and Discuss SQL

Tom Ashton started Ashton Manufacturing Inc (AMI) several years ago. The Company has grown quickly from a small operation to the mid-sized organization it is today. AMI has an opportunity to take on an additional customer. This arrangement will allow AMI to grow to a large organization operating nearly 24 hours a day / 7 days a week.

Recently AMI has been experiencing significant downtime due to a failing software application written for AMI when the company started. This Access database application is responsible for a key manufacturing process.

Mr. Ashton and his investors are concerned the Company can not grow until the technical infrastructure is in place and functioning properly. AMI has limited funds for IT endeavors but has hired your consulting firm seeking advice.


Prepare an executive summary including your recommendations to repair or replace the application. Support this summary with a research paper which contains the details behind the summary.

Start by researching Microsoft Access and other prominent RDBMS such as MS SQL Server, Oracle and My SQL. Compare and contrast these systems based on key features such as scalability, ease of implementation (development and support), performance, security and price.

Include a discussion on SQL:

What is SQL?
Who owns SQL?
What are some of the differences in the SQL supported by RDBMS vendors?

View Full Posting Details