One of the most common types of algorithms you come across is search algorithms, which are used when you need to find a piece of data within a larger data structure
For example, searching for a substring within a larger string, or perhaps searching for a file in a set of subfolder in the file system
algorithms are designed to work with datasets and solve computational problems
it is important to understand how to talk about the performance of an algorithm
This is an important factor in how you choose a particular algorithm for solving a computational problem, as well as understanding how your program will behave in different circumstances
if we want to measure how the performance of an algorithm changes based on the size of the input dataset
use the term called Big-O notation to describe the performance of an algorithm
This notation format is used to describe how a particular algorithm works as the input data set grows over time
the reason the letter O is used is that the rate at which the complexity of an algorithm grows is also called order of operation
It usually describes a worst-case scenario of how long it will take to complete a given operation
it's important to note that many algorithms and data structures have more than one Big-O value
For example, data structures can usually perform several types of operations, such as inserting or searching for values, each with its own order of operations
An algorithm is considered correct if, at any admissible (for a given problem) input, it finishes its work and produces a result that meets the requirements of the problem
In this case, the algorithm is said to solve the given computational problem
An incorrect algorithm (for some input) may not stop at all or give an incorrect result
but this does not mean that such algorithms are completely useless
If errors are rare enough, or it is possible to control the frequency of errors, we may admit the use of incorrect algorithms
It may be that initially we have a specific task with one data set, and we have compiled an algorithm
Then some new data begins to arrive, there are not many of them, but with them the algorithm slows down significantly
But since there is little such data so far, the algorithm is quite working
Analyzing an algorithm has come to mean predicting the resources that the algorithm requires
Occasionally, resources such as memory, communication bandwidth, or computer hardware are of primary concern, but most often it is computational time that we want to measure
Generally, by analyzing several candidate algorithms for a problem, we can identify a most efficient one
Such analysis may indicate more than one viable candidate, but we can often discard several inferior algorithms in the process
Before we can analyze an algorithm, we must have a model of the implementation technology that we will use, including a model for the resources of that technology and their costs
we will assume a generic one processor, random-access machine (RAM) model of computation as our implementation technology and understand that our algorithms will be implemented as computer programs
In the RAM model, instructions are executed one after another, with no concurrent operations