Write a program in C++ to find the number of comparisons using binarySearch and the sequential search algorithm as follows:
Suppose list is an array of 1000 elements.
a. Use a random number generator to fill list.
b. Use any sorting algorithm to sort list.
c. Search list for some items as follows:
i. Use the binary search algorithm to search the list. (You may need to modify the algorithm given in this chapter to count the number of comparisons.)
ii. Use the binary search algorithm to search the list, switching to a sequential search when the size of the search list reduces to less than 15. (Use the sequential search algorithm for a sorted list.)
Comments would be appreciated! Am a relatively new coder. Thank you.
In: Computer Science
list of vehicles and their horsepower. These are:
211 230 182 155 320 310 320 140
177 138 306 310 171 169 150
a) Find the mean and standard deviation of the horsepower data.
b) Draw a normal probability plot (QQ plot) for the horsepower data
c) Draw a histogram of the horsepower data.
d) Using the actual data, find the number of cars with horsepower higher than the first car listed (211 hp). Then divide by 15 to get a percent
e) Using normalcdf, find the percent of cars with more horsepower than the first car listed (211 hp).
f) Compare your results of parts d and e. Are they close?
g) Do the data appear normal? Explain using parts b ,e and f
please answer only e, f, and g questions !! thanks
here is A to D answers
Answers B
A) If the observations are
X1,X2,X3,X4,X5…………X15
Mean= 219.3
Std=72.9
B) A normal probability plot is created using Minitab
C) The Histogram of the horsepower data is created using Minitab
X represent horsepower
D) Number of cars with horsepower higher than first car listed(2011hp)=6
Percent=6/15*100=40%
In: Statistics and Probability
LISP FUNCTIONS
Imagine you are writing the AI for a simple game that will require an adversarial search.
The state of the game can be represented using a list of 3 elements, such as (B B B). The list representing the game state can contain any combination of 3 values: A, B, or C. It will always have exactly 3 items. (Let's call it the "state list").
With that in mind, write the following LISP functions:
| State | Action |
| (B * *) | A1 |
| (* B *) | A2 |
| ( * * B) | A3 |
| State | Action | Returned |
| (B * *) | A1 | (A * *) |
| (* B *) | A2 | (* A *) |
| (* * B) | A3 | (* * A) |
Demonstrate your functions work by calling each one in turn, passing each of them appropriate arguments, and then printing to the screen the values they returned.
In: Computer Science