answersLogoWhite

0

#include<iostream>

#include<iomanip>

#include<vector>

#include<algorithm>

#include<random>

#include<time.h>

void initialise (std::vector<unsigned>& data)

{

// Pseudo-random number generator (range: 1 to 99).

std::default_random_engine generator;

generator.seed ((unsigned) time (NULL));

std::uniform_int_distribution<unsigned> distribution (1, 99);

data.clear();

unsigned max_elements(50);

while (max_elements--)

data.push_back (distribution (generator));

}

int linear_search(std::vector<unsigned>& data, unsigned value, unsigned& comparisons)

{

int index(-1);

for( comparisons=0; comparisons<data.size() && index<0; ++comparisons)

if (data[comparisons] -1)

{

std::cout << "not found. ";

}

else

{

std::cout << "found at index " << binary_index << ". ";

}

std::cout << "Comparisons: " << binary_comparisons << std::endl;

}

}

User Avatar

Wiki User

11y ago

What else can I help you with?

Continue Learning about Engineering

Is an action that a Java object can perform?

An action that a Java object can perform is called a method. Methods define the behavior of an object and can manipulate its internal state, perform calculations, or interact with other objects. They are defined within a class and can take parameters and return values, allowing for dynamic interactions and functionalities within the program.


Function of a program counter?

Program Counter is just a synonim for Instruction Pointer.


These are symbols or words that perform operations on one or more operands?

either operators or functions


What is matrix programming in C programming?

C Examples on Matrix OperationsA matrix is a rectangular array of numbers or symbols arranged in rows and columns. The following section contains a list of C programs which perform the operations of Addition, Subtraction and Multiplication on the 2 matrices. The section also deals with evaluating the transpose of a given matrix. The transpose of a matrix is the interchange of rows and columns.The section also has programs on finding the trace of 2 matrices, calculating the sum and difference of two matrices. It also has a C program which is used to perform multiplication of a matrix using recursion.C Program to Calculate the Addition or Subtraction & Trace of 2 MatricesC Program to Find the Transpose of a given MatrixC Program to Compute the Product of Two MatricesC Program to Calculate the Sum & Difference of the MatricesC Program to Perform Matrix Multiplication using Recursion


What is an instruction that causes a program to perform a specific action called?

command

Related Questions

How to overload the new and delete operators to provide custom dynamic allocation of memory?

You don't. Remember that C++ is a superset of the C language. You can still use the old malloc/free functions to perform your own memory allocation/deletion.


What is a list of instructions that cause the central processing unit to perform operations to complete a task?

Program


What is to perform the indicated operations?

It means to Simplify


Is that ture A data file contains instructions for a computer on how to perform a specific task?

This would be true. A data file is a file that contains the data which controls the operations of a program or task, which is the instructions for how to perform the task or run the program.


What is emm server in veritas netbackup?

Enterprise Media Manager (EMM) server is a centralized data sore and group of services that perform the management and allocation of resources required for all the NetBackup operations.


What are the functions of the ALU?

to perform arthmatic and logical operations


What are the primary arithmetic operations a computer program can perform?

The four primary arithmetic operations a computer program can perform are addition, subtraction, multiplication and division.2 + 3 = 5 is an example of addition9 - 7 = 7 is an example of subtraction2 x 3 = 6 is an example of multiplication10 / 2 = 5 is an example of division


What is difference between Static analysis and Dynamic analysis?

Static analysis can be seen as a stricter check of syntax made by an advanced compiler (that will not produce binary code but error messages). Dynamic analysis is a specific analysis done when the program is actually running. Thins kind of analysis, being done at runtime, can detect specific behaviors, like accessing deallocated memory, leaking memory, time spent in functions and so on. To put it roughly, is static analysis is advanced compilation, dynamic analysis is a particular form of testing that often requires your program to be "instrumented" for it (i.e., modified at the binary level). In Xcode, dynamic analysis is available through Instruments. You can found more information about it by googling for "xcode instruments tutorial". In short, you can run your program under dynamic analysis choosing "Running with Performance Tool" and choosing the kind of analysis you want to perform (memory leaks, memory allocation, performance, zombies, etc.). Instruments will show you in a graphical environment how memory usage evolves, or how long it takes for specific functions to perform, etc.


_________, also called a program, tells the computer what tasks to perform and how to perform them?

program


Is an action that a Java object can perform?

An action that a Java object can perform is called a method. Methods define the behavior of an object and can manipulate its internal state, perform calculations, or interact with other objects. They are defined within a class and can take parameters and return values, allowing for dynamic interactions and functionalities within the program.


Is CU is responsible for decision making IN COMPUTER?

CU is not responsible for decision making, It is only responsible for how fast the computation is performed. For decision making need logical operations and for that we've some software program which perform logical operations which does decision making.


How many floating point operations per second can this processor perform?

The processor can perform approximately 2.5 billion floating point operations per second.