Algorithms
1. Sorting Algorithms
Sorting is important in programming for the same reason it is important in everyday life. It is easier and faster to locate items in a sorted list than unsorted. Sorting algorithms can be used in a program to sort an array for later searching or writing out to an ordered file or report.
In computer science, ‘sorting’ usually refers to bringing a set of items into some well-defined order.
For example, the notion of order for numbers we can use the usual numerical order (that is, defined by the mathematical ‘less than’ or ‘< ‘relation) and for strings the so-called lexicographic or alphabetic order, which is the one dictionaries use.
Sorting is a common operation in many applications, and efficient algorithms to perform it have been developed. The most common uses of sorted sequences are: making lookup or search efficient; making merging of sequences efficient.
Sorting is important because having the items in order makes it much easier to find a given item, such as the cheapest item.
Read more, Click here:- Report about Sorting Algorithms
2. Randomized Algorithms
2. Randomized Algorithms
A
randomized algorithm is one that makes use of a randomizer (such as a random
number generator). Some of the decisions made in the algorithm depend on the
output of the randomizer. Since the output of any randomizer might differ in an
unpredictable way from run to run, the output of a randomized algorithm could
also differ from run to run for the same input. The execution time of a
randomized algorithm could also vary from run to run for the same input.
A
randomized algorithm is an algorithm that employs a degree of randomness as
part of its logic. The algorithm typically uses uniformly random bits as an
auxiliary input to guide its behavior, in the hope of achieving good
performance in the "average case" over all possible choices of random
bits. Formally, the algorithm's performance will be a random variable
determined by the random bits; thus, either the running time, or the output (or
both) are random variables.
No comments:
Post a Comment