Algorithms and Concurrency
Let's now look at some basics of algorithms in general, the time complexity; and the order of magnitude measurements, before we start talking about building concurrency in executing algorithms, then explore the approaches to parallelizing algorithms.
An algorithm can be defined as a sequence of steps that takes an input to produce the desired output. They are agnostic technology representations; let's look at a sorting algorithm example:
Input: A sequence of n number—a1, a2, …,an Output: A permutation (reordering)—a1', a2', …,an' such that a1'<=a2'<=… <=an'
The following algorithm is an insertion-sort algorithm:
INSERTION-SORT(A) 1. for j = 2 to length[A] 2. dokey<-A[j] 3. //insert A[j] to sorted sequence A[1..j-1] 4. i<-j-1 ...
Get Practical Machine Learning now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.