Search for the value needle in the array

Assignment Help C/C++ Programming
Reference no: EM13165685

Below is a list of prototypes and documentation for a set of functions you are to implement. Read the documentation carefully, making sure that you implement the functions exactly as described. The list is in alphabetical order, not grouped by functionality, so read the whole list an implement them in any order that seems logical for incremental development and testing purposes.

  • search for the value needle in the sorted array range given by [hay_begin ... hay_end), using the Binary Search algorithm. This function will return a pointer to the needle value if it is found, or a null pointer if needle is not found.

double* binary_search (double needle, double* hay_begin,

double* hay_end, double epsilon=1e-10);

  • sort all elements in the array range [begin...end) in ascending order using the Bubble Sort algorithm

void bubble_sort (double* begin, double* end);?

  • compare two double-precision values, returning an indication of the relationship between the two such that:

    result:

    < 0 if v1 < v2

    > 0 if v1 > v2

    == 0 if v1 "==" v2 (within error bounded by epsilon)

?double epsilon_compare (double v1, double v2, double epsilon=1e-10)

  • fill all elements in the range [begin...end) within an array 
  • with the value given in 
    the valueparameter (defaults to zero)?????
    
void    fill_array ( double* begin, double* end, double value=0.0);
  • search for the value needle in the array range given by [hay_begin ... hay_end),
  • using the Linear Search algorithm. This function will return a pointer to the
  •  needle value if it is found, or a null pointer if needle is not found.
double* linear_search    (double needle, double* hay_begin,
 double* hay_end, double epsilon=1e-10);
  • Given a pointer to an address within an array, convert the pointer to the corresponding array index (offset). Returns the array index corresponding to ptr, or -1 if ptr was null.
int     pointer_to_index (const double* ptr, const double* array_begin);
  • print all elements in the range [begin...end) within an array to the stream given in the parameter stream, separated by the delimiter string given in delim. Note that a trailingdelim will not be added to the output stream.

void print_array (std::ostream& stream, const double* begin, const double* end, string delim="\n");

  • reverse the order of all elements in the array range [begin...end)
    
void    reverse_array    (double* begin, double* end);
  • sort all elements in the array range [begin...end) in ascending order using the Selection Sort algorithm.

void     selection_sort  (double* begin, double* end);

****MUST CONTAIN ALL FUNCTIONS ALONG WITH COMMENTS****

Reference no: EM13165685

Questions Cloud

Describe heat transfer between the gas and the tank : A tank containing carbon dioxide at 400K and 50 bar is vented until the temperature in the tank falls to 300K. Assuming there is no heat transfer between the gas and the tank
Compute the theoretical moles of naoh : calculate the theoretical moles of NaOH that should be necessary to reach the equivalence point
Decimal floating point number : What decimal floating point number does this IEEE 754 single precision number represent: 0x47C0_E6B7?
What would be the ieee 754 double precision binary : What would be the IEEE 754 double precision binary representation of the floating point value 2.71828×10-13? Express your final answer as a 16-hexdigit number and explain how your answer was obtained for full credit.
Search for the value needle in the array : Search for the value needle in the array range given by [hay_begin ... hay_end), using the Linear Search algorithm. This function will return a pointer to the needle value if it is found, or a null pointer if needle is not found.
A java program where the user designates : a java program where the user designates how many games they would like to play (for example user inputs 10 games) then they play the game, if lets say there is a tie after 10 games the game continues until either the user of the computer wins by 2
What happens when you assign : What happens when you assign 340,282,343,598.33 to a Single variable? Assuming that the variable in question is named sngNumber and you execute the statement MessageBox.Show
Supposed to swap numbers : The program is supposed to swap numbers, but I am stuck something is wrong! It does not swap them it repeats the second number, please help to fix! Thanks, this is in C++.
The imperial system of measurements : The Imperial system of measurements uses feet and inches for length, where 1 foot is equal to 12 inches. Write a class named Imperial that will represent distance measurements in feet and inches. Your class should include the following.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Use a for loop to generate 100 random numbers.

Use a For Loop to generate 100 random numbers. Determine the most current maximum and minimum number as the random numbers are being generated. This is referred tp as a "running" maximum and minimum. Display the running maximum and minimum values as ..

  Write a pseudocode statement

Assume that a program has two string variables named str1 and str2. Write a pseudocode statement that assigns an all uppercase version of str1 to the str2 variable. is str.add(str1,str2) part of it?

  The imperial system of measurements

The Imperial system of measurements uses feet and inches for length, where 1 foot is equal to 12 inches. Write a class named Imperial that will represent distance measurements in feet and inches. Your class should include the following.

  Write program to read from file to find number of integers

Write down the program which reads from file numbers.txt 30 integers in range 0 - 200. Program ‎then determines number of integers in each of given ranges.

  Program to declare array alpha of components of type int

Write C++ statements to do the following: Declare an array alpha of 15 components of the type int. Output the value of the tenth component of the array alpha.

  Calculate the trajectory of a soccer ball

Write a program to calculate the trajectory (flight path) of a soccer ball

  Writing a program that creates a linked list

Writing a program that creates a linked list from 100 randomly generated numbers and sorts the using a heap. One heap in ascending order and one heap in descending order. Then displays the original linked list and both sorted lists.

  Write a function num_digits(n)

C programing, not C++ write a function num_digits(n) that returns the number of digits in a nonnegative integer n.

  A run is a sequence of adjacent repeated val

A   run   is   a   sequence   of   adjacent   repeated   values.   Using   an   array,   write   a   program   that   generates   a   sequence   of

  Write the code

Write a program that allows an instructor to keep a grade book. Each students has scores for exams, homework assignments, and quizzes.

  Write a program to crypt its input accordingly

Write a program to crypt its input according to a specified transformation scheme

  Least number of comparisons needed

What is the least number of comparisons needed to sort an array of 6 numbers, in the worst case, using any sorting algorithm that sorts with binary comparisons? Explain

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd