Answer:
#include<iostream>
using namespace std;
int main() {
cout<<"Enter The Size Of Array: ";
int size;
bool isBestCase=false;
cin>>size;
if(size<=0){
cout<<"Error: You entered an incorrect value of the array size!"<<endl;
return(0);
}
int array[size], key;
cout<<"Enter the numbers in the array, separated by a space, and press enter:";
// Taking Input In Array
for(int j=0;j<size;j++){
cin>>array[j];
}
//Your Entered Array Is
for(int a=0;a<size;a++){
cout<<"array[ "<<a<<" ] = ";
cout<<array[a]<<endl;
}
cout<<"Enter a number to search for in the array:";
cin>>key;
for(i=0;i<size;i++){
if(key==array[i]){
if(i==0){
isBestCase=true; // best case scenario when key found in 1st iteration
break;
}
}
}
if(i != size){
cout<<"Found value "<<key<<" at index "<<i<<", which took " <<++i<<" checks."<<endl;
} else{
cout<<"The value "<<key<<" was not found in array!"<<endl;
cout<<"We ran into the worst-case scenario!"; // worst-case scenario when key not found
}
if(isBestCase){
cout<<"We ran into the best case scenario!";
}
return 0;
}
Explanation:
The C++ source dynamically generates an array by prompting the user for the size of the array and fills the array with inputs from the user. A search term is used to determine the best and worst-case scenario of the created array and the index and search time is displayed.
Answer:
Number.
Letter is for columns, Number is for rows.
For example to find the cell on the fifth row, and 1st column, it would be A5.
Answer:
I'll sub for ya!
Explanation:
Consider it done. I hope you reach your goal!
Software has to be reliable so that it does not create conflict or negative feelings amongst those who use it.
In this world where humans increasingly rely on the internet and software for information, programmers have to take special care so as to ensure that the members of the society are not affected negatively.
For instance, there have been moments when software led to negative effects such as:
- when Goøgle's algorithm tagged a black couple as gorillas
- Facebøok's algorithm tagged black men as gorillas
- Goøgle maps gave people the wrong directions
These are but a few instances where algorithms have messed up.
We can therefore conclude that it is important that programmers take extra care when designing programs so that they do not lead to negative feelings.
<em>Find out more at brainly.com/question/21328677.</em>