What is Algorithm: Definition and 721 Discussions

In mathematics and computer science, an algorithm ( (listen)) is a finite sequence of well-defined, computer-implementable instructions, typically to solve a class of specific problems or to perform a computation. Algorithms are always unambiguous and are used as specifications for performing calculations, data processing, automated reasoning, and other tasks. In contrast, a heuristic is a technique used in problem solving that uses practical methods and/or various estimates in order to produce solutions that may not be optimal but are sufficient given the circumstances. As an effective method, an algorithm can be expressed within a finite amount of space and time, and in a well-defined formal language for calculating a function. Starting from an initial state and initial input (perhaps empty), the instructions describe a computation that, when executed, proceeds through a finite number of well-defined successive states, eventually producing "output" and terminating at a final ending state. The transition from one state to the next is not necessarily deterministic; some algorithms, known as randomized algorithms, incorporate random input.The concept of algorithm has existed since antiquity. Arithmetic algorithms, such as a division algorithm, were used by ancient Babylonian mathematicians c. 2500 BC and Egyptian mathematicians c. 1550 BC. Greek mathematicians later used algorithms in 240 BC in the sieve of Eratosthenes for finding prime numbers, and the Euclidean algorithm for finding the greatest common divisor of two numbers. Arabic mathematicians such as al-Kindi in the 9th century used cryptographic algorithms for code-breaking, based on frequency analysis.The word algorithm itself is derived from the name of the 9th-century mathematician Muḥammad ibn Mūsā al-Khwārizmī, whose nisba (identifying him as from Khwarazm) was Latinized as Algoritmi. A partial formalization of the modern concept of algorithm began with attempts to solve the Entscheidungsproblem (decision problem) posed by David Hilbert in 1928. Later formalizations were framed as attempts to define "effective calculability" or "effective method". Those formalizations included the Gödel–Herbrand–Kleene recursive functions of 1930, 1934 and 1935, Alonzo Church's lambda calculus of 1936, Emil Post's Formulation 1 of 1936, and Alan Turing's Turing machines of 1936–37 and 1939.

View More On Wikipedia.org
  1. person123

    MATLAB Computing Sections of a Graph Which Can Be Removed By Removing Two Edges

    Hi. I have graph which I am analyzing in MATLAB. I would like to determine sections of the graph which could be removed from the rest of the graph by removing only 2 edges. (The graph represents the network of atomic bonds from a simulation of silica, and I am attempting to locate strands of...
  2. S

    Efficient Q-Tree Algorithm: Understanding Parent-Child Relationships

    Hi, I don't get what the conditions below exactly means. Its which u they are talking about? Is the u the parent or children? Does it mean u = B? and the children are A,C,D? if u is in the quadtree rooted by v:NW then u:x < v:x and u:y ≥ v:y; Thanks,
  3. Francis

    A Quantum CSP Algorithm for Aircraft Recovery Problem

    The Aircraft Recovery Problem: consists of finding solutions for a disrupted aircraft flight schedule such that a set of constraints is satisfied, namely continuity, turn-round time, scheduled maintenance, and airport departure/arrival capacity. My approach consists of finding the domains for...
  4. Francis

    A Conditional phase shift for Grover's algorithm

    I am trying to understand the following deduction: "The conditional phase shift can be represented by the unitary operator 2|0> <0| - I:" for eq. 4a) I was expecting to be: [2 |0><0| - I] |0> = 2 |0> <0|0> - I|0> = 2|0> - |0> = |0> as for eq. 4b I can't understand it at all. Why does the...
  5. IreneFerri

    Problems with Landau Wang algorithm in fortran

    I have been struggling for over a month now with a problem I cannot fix. I would really appreciate any comment or guidance. Thank you! I am considering an Ising-like model with N agents that han hold one of the following 3 states, represented by vectors: state + : vector (1 0) state 0 : vector...
  6. user366312

    Interpolation in the Marching Square Algorithm

    Marching Square - article In the "Linear Interpolation" section This article discusses how to interpolate the values when the lines are oblique. For example, for Case#2 it has the following calculation: I have written the following source code to implement the Marching Square algorithm...
  7. w4y021

    Can a Body Language Algorithm Reveal Our True Emotions?

    These days there is a question confuses me if it can be real or not. 2-3 years ago when I was looking around papers about computer sciences on the web, I came across to a sceintific paper which mentions an algorithm about analysing your language even it's a foreign language. So when you speak...
  8. E

    B Algorithm for checking if a set of digits are all distinct

    If I give you 9 digits ##u_1, u_2, \dots, u_9##, is there an operation/set of operations you can perform to check whether all the digits from 1 to 9 are represented in that set? Just asking because my solution was a boring brute force check. I don't think anything useful becomes of the product...
  9. tomdodd4598

    I The period-finding circuit for Shor's algorithm

    I've been trying to learn about Shor's algorithm by writing out implementations of the circuit for modular exponentiation, ##{ a }^{ x }\; ({ mod }\; N)##, to find the period ##r## for small numbers such as: ##(N=15,\quad a=11)\quad \longrightarrow \quad r=2##, ##(N=35,\quad a=13)\quad...
  10. A

    Developing Algorithm to Recursively Walk Array: arr[4] Example

    I want to write code walk around the array recursively. For some reason I cannot share my code. Let's say I have a array like this: arr[4], I want to look 012 123 013 or 01 12 23 02 03 13. In code I write I can look 012 123 or 01 12 23 but I cannot look 013 or 02 03 13. What algorithm should I...
  11. S

    C/C++ Could someone translate this Donald Knuth algorithm to C/C++?

    [Can't embed image. Keep getting 500 Internal Server Error ...] https://i.stack.imgur.com/rmDuR.jpg Image added by mentor
  12. maistral

    Reaction kinetics + Gillespie algorithm: Propensity function?

    I'm trying to simulate a simple series reaction stochastically using Gillespie's algorithm. I found this file: What is this 'propensity function'? Say for example I have the simple reactions: A --(k1)--> R R--(k2)--> S are these 'propensity functions' the rates (a wild guess)? I mean; α1 =...
  13. Adec

    Comp Sci Galaxy simulation with the velocity Verlet algorithm

    To simulate the trayectories of solar systems around a black hole (i.e. a galaxy) I have 3 classes in C++: cSystem, cBlackHole and cGalaxy. cSystem assigns initial values of position, velocity, etc to a solar system. cBlackHole does the same but just for the black hole. And cGalaxy mixes...
  14. D

    What is the sum of existing partial products in Booth's Algorithm?

    Trying to understand Booth's Algorithm. There's some YouTube videos online but I decided I'd try by reading Booth's original paper http://bwrcs.eecs.berkeley.edu/Classes/icdesign/ee241_s00/PAPERS/archive/booth51.pdf Can anyone explain what is meant by "sum of existing partial products"? (Page 3...
  15. tomdodd4598

    I Number of qubits required for Shor's algorithm to factor a number < 2^n

    Hey there, There are plenty of proposed implementations of Shor's algorithm which require different numbers of qubits, ##q##, to be able to factor a number ##N## of size ##<2^n##, i.e. a number of length at most ##n## bits. Most of these require ##q## linear in ##n##; for example, this...
  16. A

    Code for BCC Lattice Algorithm: Start Here

    I need to write a code for my simulation for which I have to create bcc lattice. Can anybody suggest how I can start since I am jumbled up this 3d lattice coordinate writing?
  17. Z

    Prime Number Detection: Running Time of Algorithm

    Hi, I want to know if the algorithm to find prime number has running time O(sqrt(N)) or O(log^2N). log^2N is better than sqrt(N). Also for large values can it become a pseudo polynomial algorithm? Zulfi.
  18. bhobba

    Have you heard of the VDSR upscaling algorithm?

    Hi All Here is an interesting algorithm for up-scaling images: https://arxiv.org/pdf/1511.04587.pdf It has 20 3x3x64 (some I have read use 3x3x16) convolutions. Now my understanding of convolutions means, the first produces 64 images from the 64 filers, then in the second convolution each of...
  19. Arman777

    Understanding Verlet Algorithm

    I am trying to understand the verlet algorithm but I am kind of stuck. I guess first we are findind the ##v(t + 1/2h)## then we are leaving it there and starting a loop for 8.78 ? Also I did not understand the meaning of the equation 8.78 ? We are never using ##v(t + 3h/2)## ? Or in the...
  20. S

    Text color detection algorithm giving pixels of text

    I'm creating a type of image processing software and I have a need to get the color that best represents text once I have identified the pixels in a region of text. I've tried using simple strategies like "averaging" the pixels or taking the most common pixel, but these produces bad results An...
  21. JorgeM

    Algorithm for the min. distance over a set of points randomly distributed

    The only restrictions are: -There are N points randomly distributed over an X-Y plane and it is necesary to pass every point at least 1 time, in order to get the path of the minimun distance throught all of them. -If does not matter how many times you pass any of this points. -You have to pass...
  22. T

    XOR algorithm to find the missing number in a given array

    Recently I have been reading up about the logical operations OR, AND and XOR. Whilst reading about XOR I cam across a method using XOR to find the missing number in a given array, but I just can't understand how or really why it works. The algorithm is displayed below. A = [2, 3, 1, 4, 6, 7]...
  23. V

    A On uniform boundedness of the GD algorithm

    Consider a function ##f\in\mathcal{C}^2## with Lipschitz continuous gradient (with constant ##L##)- we also assume the function is lowerbounded and has at least one minimum. Let ##\{x^k\}_k## be the sequence generated by Gradient Descent algorithm with initial point $x^0$ and step-size...
  24. V

    MHB Effect of Perturbation on Gradient Descent Sequence

    Consider a function $f\in\mathcal{C}^2$ with Lipschitz continuous gradient (with constant $L$)- we also assume the function is lowerbounded and has at least one minimum. Let $\{x^k\}_k$ be the sequence generated by Gradient Descent algorithm with initial point $x^0$ and step-size $0<\alpha<2/L$...
  25. jedishrfu

    Who needs qubits? Factoring algorithm run on a probabilistic computer

    https://arstechnica.com/science/2019/09/who-needs-qubits-factoring-algorithm-run-on-a-probabilistic-computer/
  26. B

    Pivoted Cholesky decomposition algorithm

    Hi at all! I need to implement the Pivoted Cholesky Decomposition in C++ and I know that is possible implement it without rows permutations. Where can I find the algorithm described clearly and/or codes example in other language to replicate in C++? Thanks!
  27. E

    Comp Sci Time Complexity Algorithm Proof

    Use the formal definition of Big-Oh to prove that if f (n) and g(n) are nonnegative functions such that f (n) = O(g(n)), f (n) + g(n) = Ω(g(n)). By the definition of Big-Oh: If f(n) and g(n) are non-negative functions such that f(n) = O(g(n)) there must be positive constants c and n0 such...
  28. F

    Complexity of this heap algorithm

    I'm trying to count running time of build heap in heap sort algorithm BUILD-HEAP(A) heapsize := size(A); for i := floor(heapsize/2) downto 1 do HEAPIFY(A, i); end for END The basic idea behind why the time is linear is due to the fact that the time complexity...
  29. Arman777

    1D peak algorithm (correct implementation)

    array_values = [[0], [0,0], [1,2], [3,1,2], [1,2,3], [4,6,2,1], [8,9,0,2,1]] def peakfinder(xarray): if len(xarray) == 0: print("You entered an empty error !") raise ValueError if len(xarray) == 1: return xarray[0] if len(xarray) == 2: return...
  30. Arman777

    Python How can I create a density reachable algorithm in DBSCAN

    I am new to data science and I am trying to create an algorithm for the DBSCAN. I can label each point as core-border-noise. But after this step I am stuck. How can I separate the density reachable cores and create clusters from these points ?
  31. matqkks

    I Proof of the Division Algorithm

    In many books on number theory they define the well ordering principle (WOP) as: Every non- empty subset of positive integers has a least element. Then they use this in the proof of the division algorithm by constructing non-negative integers and applying WOP to this construction. Is it...
  32. matqkks

    MHB Proof of the Division Algorithm

    In many books on number theory they define the well ordering principle (WOP) as: Every non- empty subset of positive integers has a least element. Then they use this in the proof of the division algorithm by constructing non-negative integers and applying WOP to this construction. Is it possible...
  33. Haorong Wu

    I In quantum search algorithm, how to interpret the effect of U(t)?

    In Nielsen's QCQI, in page 259, it reads, $$U \left ( \Delta t \right ) = \left ( \cos^2 \left ( \frac {\Delta t} 2 \right ) - \sin ^2 \left ( \frac {\Delta t} 2 \right ) \vec \psi \cdot \hat z \right ) I \\ -2 i \sin \left ( \frac {\Delta t} 2 \right ) \left ( \cos \left ( \frac {\Delta t} 2...
  34. R

    Algorithm analysis problem turned into a math problem

    The equation listed is the implicit form. I achieved this a weird way. \begin{array}{|c|c|c|} \hline 1 & 1 & 1*1 \\ \hline 2 & 6 & 2*3 \\ \hline 3 & 18 & 3*6 \\ \hline 4 & 40 & 4*10 \\ \hline 5 & 75 & 5 * 15 \\ \hline 6 & 126 & 6 * 21\\ \end{array} Focusing on the third column now, I can...
  35. S

    MHB Discrete maths problem - tracing an algorithm

    Hello, I'm working on a discrete mathematics for computing paper and am stuck on what a symbol is trying to convey. Sorry if this seems like a stupid question (I feel stupid for not being able to work it out myself), I've just started this subject and am still getting used to it. My question...
  36. FahdEl

    Equation of motion using Runge-kutta 4 and Verlet algorithm

    import numpy as np import matplotlib.pyplot as plt G=6.67408e-11 M=1.989e30 m=5.972e24 X0=-147095000000 Y0=0 VX0=0 VY0=-30300 T=365*24*60 def rk(ax,ay,x,y,vx,vy,h): t=0 n=int(T/h) A=[[t],[x],[y],[vx],[vy]] for i in range(1,n): k1x=vx k1y=vy q1x=ax(x,y)...
  37. L

    I Algorithm to determine the roulette curve

    I am trying to develop an equation or algorithm to determine the roulette curve that results from rolling a curve over another fixed curve. A general method to determine the roulette using any two curves, rolling and fixed, seems to be presented here...
  38. Z

    Time Taken by this Algorithm in Terms of m, p, t_add, t_s and t_w

    Hi, Kindly consider the Question 4.8 on the following link http://parallelcomp.uw.hu/ch04lev2sec18.html ##t_s## = start up time ##t_w## = per-word transfer time m = size of message p = number of processors The total time for communication for ##logp## steps is: ##T = (t_s + t_w*m) * log_2 p##...
  39. jedishrfu

    SmarterEveryDay on Youtube Video Algorithm Hacking

    SmarterEveryDay is posting a series of videos (this is the first one) on Youtube Video Identification hacking, what it is and how it affects what we see online. Its really good even though the notion of manipulating the Youtube algorithm is very disturbing.
  40. R

    Modified Euclidean Algorithm proof

    gcd(f_n,f_{n-1}) gcd[f_{n-1},f_n - f_{n-1}] gcd[(f_n - f_{n-1}), (f_{n-2} - f_{n-1})] gcd[(f_{n-2} - f_{n-1}),f_{n-3} - f_{n-2})] gcd[(f_{n-2} - f_{n-3}),(f_{n-4} - f_{n-3})] . . . gcd(f_2,f_1), where f_2 = 1, f_1 = 1 I assume LateX is not working yet. Not sure if I am on point here or not...
  41. PainterGuy

    MPPT algorithms, perturb and observe algorithm etc

    Hi, I had thought that "hill climbing method" is a general terminology to refer to methods such as perturb and observe and incremental conductance. The same is also said here, "The hill climbing based techniques are so named because of the shape of the power-voltage (P-V) curve. This technique...
  42. Q

    I "Basic" question about Grover's Quantum Computing algorithm

    Hi everyone, I'm a computer scientist (not a physicist), so I will ask a computer scientist's question. In all the descriptions I found of Grover's algorithm, there is an element that is puzzling the computer scientist in me: it seems that you need to tell the Oracle about the position of the...
  43. P

    I Why is the Phase Shift in Grover's Algorithm Applied to All Elements Except 0?

    Hi everybody, I've read some pages in Nielsens "Quantum Computing" book, it's very interesting, but especially at Grover's algorithm, there occurs a question for me. It is said that a phase shift is performed, which is defined as follows: ##|0\rangle \rightarrow |0\rangle \\ |x\rangle...
  44. P

    I Grover algorithm geometric interpretation

    Good day everybody, I'm currently working on the Grover algorithm. You can also illustrate this process geometrically and that's exactly what I have a question for. In my literary literature one obtains a uniform superposition by applying the Hadamard transformation to N-qubits. So far that's...
  45. E

    Programming algorithm expressed in math notation

    Hey everyone, I wasn't sure if this belonged in the general math forum or not, so I posted it here instead (mods - feel free to move if it belongs elsewhere). What I want to know is how to properly write out a computer algorithm in proper math notation. Take this code for example: Height...
  46. F

    Can someone recommend an algorithm to optimize this data

    I have a data set of samples, and I made up some variables that filter out unwanted samples from the data set. Say each sample has values ##\vec{x}=x_1, x_2,..., x_n##, and I know the values of ##\vec{x}## for each sample. Also, if I sum up all of the samples, I get a value, ##Z##, which tells...
  47. R

    MHB What Type of Math is Used in Fortune's Algorithm?

    I've heard that Fortune's Algorithm is the fastest algorithm yet found to generate a voronoi diagram. I am far from being able to understand it, but I got interested in it because I want to learn about procedural generation. My question is, what sort of mathematics would I have to be familiar...
  48. N

    Crossword Puzzle Generation Algorithm

    Hey all, for a dictionary app I have to code I have to implement as crossword game as a side feature, unfortunately this is compulsory, I can't figure out a good way of finding words that intersect each other (esp words that intersect multiple others) without a hell of a lot of goto and while's...
  49. FritoTaco

    Finding the Inverse of 2 (mod 17): Euclidean Extended Algorithm

    Homework Statement Hi, I'm doing a problem by solving congruences but my question is simply trying to find the inverse of 2 \enspace (mod\enspace 17) from 2x \equiv 7(mod \enspace 17). Homework Equations It's hard to find a definition that makes sense but if you check my upload images you...
  50. Z

    How to frame a genetic algorithm for this problem?

    Hi, I have a random array which represents method calls. For instance: [3, 4, 7, 40, 39, ...] meaning that method 0 is called 3 times, method 1 is called 4 times, method 2 is called 7 times, method 3 is called 40 times, method 4 is called 39 times and so on upto n. Now consider a module as a...
Back
Top