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. Narkon

    Understanding the Sklansky Adder Algorithm

    Hello. I am unsure if this subforum is the right place for this question, but without any alternatives, I will dare to post it here. A few days ago I received an assignment which is about the creation in VHDL of a Sklansky adder. However, before I move to the coding part, I have trouble...
  2. wololo

    Tree Data Structures & Minimax Algorithm for Games

    Homework Statement Homework Equations Tree data structures. I think it might also have something to do with minimax algorithm, but it was only mentioned once and never discussed extensively in class so I doubt it is required. The Attempt at a Solution [/B] If both players play as well as...
  3. S

    Is this considered a valid sorting algorithm?

    Let me know if I've invented a valid O(n) sorting algorithm. public void Sort ( this List<T> L ) { // Check every second whether L is sorted // Given enough time, natural bit flips will eventually make L sorted while ( !L.IsSorted() ) Thread.Sleep(1000); } public bool IsSorted (...
  4. TheMathNoob

    Algorithm to find the minimum spanning tree on a planar graph

    Homework Statement I have the following algorithms: Prime MST with array, Prime MST with priorityq and Kruskal with priorityq. I have to choose the best algorithm to find the minimum spanning tree on a planar graph. A planar graph has the property in which the number of edges is in O(number of...
  5. W

    Can the Velocity Verlet Algorithm Prove Energy Conservation?

    I've read that this algorithm conserves energy if the system it's applied to conserves energy. I can't find a proof, and it's not a particularly obvious statement, so how would you prove it?
  6. S

    Help me nail the final post to the fence of this algorithm

    I'm writing a class to format console output and the trickiest method in this class so far is the one for printing a table. I'm having it act like an HTML table in how text fits public static void PrintTable ( string[][] cells ) { // Outputs content in cells matrix...
  7. M

    Algorithm for water spill problem

    Hey guys and gals. I have come across a problem that I was wondering if anyone recognized. I came across it while trying to find approximate solutions to a fluid-flow PDE, when the flow is high(The PDE is described in another one of my threads, but that is not important, I will describe the...
  8. G

    Optimization algorithm to apply to my system?

    I am at the moment working on a project in which I try to minimize the annual running costs of a chemical manufacturing plant. To predict annual running costs I created a model with over 50 inputs, including things such as the type of chemicals and equipment used at different points in the...
  9. evinda

    MHB Description of simplex algorithm

    Hello! (Wave) I am looking at the description of the Simplex algorithm.Let $\overline{x_0}$ be a non degenerate basic feasible solution. We suppose that $\overline{x_0}=(x_{10}, x_{20}, \dots, x_{m0},0, \dots,0)$ with $x_{10}, x_{20}, \dots, x_{m0}>0$. Thus the first $m$ columns of $A$, i.e...
  10. B

    Does this algorithm guarantee equaprobable outcomes?

    Suppose you have a list of numbers, say ##{1, 7, 9, 4, 5, 6}##. You store the first number, and then iterate through this list. For each number in the list, you flip a coin. If it is heads, you swap that element in the list with the number you stored. If tails, you do nothing. Either way, you...
  11. P

    Iterations in the Euclidean algorithm

    Homework Statement Let m and n be natural numbers. Suppose ## min(m, n) \geq 2^k ## for some natural number k. Show that the Euclidean Algorithm needs at most ## 2k ## iterations to calculate the gcd of m and n.The Attempt at a Solution [/B] So far I think I need to show that for all the...
  12. TheMathNoob

    Average complexity -- worst case of an algorithm

    Homework Statement a Write an algorithm to find the median of three distinct integers a,b,c b Describe D, the set of inputs for your algorithm, in light of the discussion in Section 1.4.3 following Example 1.9. This section discusses Average complexity for an algorithm which involves an...
  13. NATURE.M

    Solving the a7 + b7 = c7 + d7 Equation Using Heap Algorithm

    Homework Statement We have four integers a,b,c,d each of which are >= 1 and <= n, and are asked to write an algorithm to find all possible solutions to the following equation: a7 + b7 = c7 + d 7 The algorithm should use a heap of at most n elements, and should have worst case runtime of O(n2...
  14. ChrisVer

    Anti-##k_T## algorithm for jets

    First I'll try to give a summary of what I understand about the anti-##k_T## algorithm (as a continuation for a particle flow algorithm)... The algorithm uses an iterative clustering with transverse momentum ##p_T## weighted distance parameter and is applying a selection on the "protojets". For...
  15. M

    MHB Algorithm to answer existential questions - Reduction

    Hey! :o Lemma 1. For any $x$ in the ring $F[t,t^{-1}]$ ($F[t,t^{-1}]$: the polynomials in $t$ and $t^{-1}$ with coefficients in the field $F$), $x$ is a power of $t$ if and only if $x$ divides $1$ and $t-1$ divides $x-1$ (the divisibilities are meant, of course, in $F[t, t^{-1}]$). Lemma 2...
  16. P

    Algorithm for creating unique groups of elements

    Homework Statement so for a side task I'm supposed to assign people to groups for an icebreaker in python, can anyone give me links to theories that I could read up on or give me suggestion X number of people at my company signed up for a dinner roulette as a way to meet new people. Everyone...
  17. chakr

    An algorithm to find values m, x, and b for y = m x + b

    Hi, is there away to find values of m, x, and b for a given value of y. For example, if I have y = 10000, my 'm' could be 100, x = 100, and b = 0, or it could be m = 250, x = 40, and b = 0 or any other combination of m, x, and b. I need to write a C code for my microcontroller. I will be given...
  18. Domenico94

    Machine learning or algorithm design

    HI everyone. I was just wondering about a career in the IT (I study communication systems engineering, but I'm rather interested in coding, rather than Internet and communcation systems- related stuff). I wanted to ask you, given the advances that technology is making, which skills would be...
  19. S

    Rank Array of Numbers in Ascending Order in C

    Not sure if this is the correct place to post this type of question, so I will relocate if need be. What I'm interested in doing is taking an array of numbers and assigning a rank based on ascending order. Explicitly, the ranking of an array would look like 1.534 - 15 -0.887 - 3 -0.489...
  20. T

    This algorithm can judge “creativity” in art like an expert

    http://qz.com/425662/picasso-genius-this-algorithm-can-judge-creativity-in-art-as-well-as-the-experts/
  21. ognik

    Investigating a Parabolic PDE algorithm

    Homework Statement Hi - I'm on the last chapter of this book and am a bit stuck. I am given a very basic fortran program (code attached in the zip file) and asked to 'investigate its accuracy and stability, for various values of Δt and lattice spacings'. The program is an implementation of the...
  22. M

    MHB How does the Pohlig-Hellman algorithm work?

    Hey! :o I am studying Cryptology right now and I am facing some difficulties to understand the Pohlig-Hellman algorithm. Could you explain to me how the algorithm works?? Could you give me a step by step example?? (Wondering)
  23. evinda

    MHB Memoized Dynamic Programming algorithm

    Hello! (Wave) I am looking at the following example of Memoized Dynamic Programming algorithm. memo={} Fib(n): if n in memo return memo[n] if n<=2 F[n]=1 else F[n]=F[n-1]+F[n-2] memo[n]=F[n] return F[n] Could you explain me why we check if $n$ is in memo although memo is a set...
  24. ognik

    MHB How Can Sources and Sinks be Incorporated in a Parabolic PDE Algorithm?

    Hi - on the last chapter of this course and was feeling much better about it all, but I now confess to being back in my normal state - confused. I am given a simple fortran program (code attached in the zip file) and asked to investigate its accuracy and stability, for various values of \Deltat...
  25. A

    Parity problem in Bernstein Vazirani Algorithm

    I don't understand the following aspect of the parity problem and if someone could please explain it to me, I would be grateful. In the given quantum circuit, the output f(x) is defined to be x.a = x1a1+x2a2+x3a3(mod 2), where a is a fixed |a1a2a3>. For example, if x=|101> and a=|100>, x.a =...
  26. JK423

    What do we mean by Classical Simulation of Quantum Algorithm

    In the quest of searching what are the basic ingredients of quantum theory that provide exponential speed-up to some quantum algorithms, a basic question that is pursued in the literature is when a quantum circuit (or algorithm) can be classically simulated efficiently. One example is this paper...
  27. S

    Combinatorial Algorithm for Sorting Adjacency Matrices in Polynomial Time

    Given a matrix A of a regular graph G. The matrix A can be divided into 4 sub matrices based on adjacency of vertex ##x \in G##. ## A_x## is the symmetric matrix of the graph ##(G-x)##, where ##C## is the symmetric matrix of the graph created by vertices of ##(G-x)## which are adjacent to...
  28. S

    Can a decision tree algorithm minimize wastage for given volumes?

    Hi all, Im having trouble making a general algorithm for what at first glance appears to be a simple problem. If I have a volume (V) that can be made from two smaller, different volumes how can I decide which volumes to use to get the minimum wastage? So for example if V(required)=300 and my...
  29. S

    Help to write a psudoecode (formal) of this procedure.

    This is the core idea- https://www.physicsforums.com/threads/complexity-analysis-problem-of-an-algorithm.812931/ I would like to write a formal psudoecode (latex), but as new writer I am having hard time to write, whatever I wrote is not easy to understand, so i would appreciate forum...
  30. evinda

    MHB Finding a Local Minimum of $G$: Algorithm & Analysis

    Hello! (Wave) A $m \times m$ grid is a graph of which the vertices are ordered pairs of natural numbers $(n_1, n_2)$ with $1 \leq n_1 \leq m$ and $1 \leq n_2 \leq m$. Two vertices $(k_1,k_2)$ and $(k_3,k_4)$ are neighbors iff $|k_1-k_2|+|k_3-k_4|=1$. We suppose that a unique number $y_w$ is...
  31. Superposed_Cat

    Crossover help for Genetic algorithm

    Hey all, we're making a robot that teaches itself to walk using a genetic algorithm(took a hiatus with this but have returned). So i coded a simulator that to see why the GA wasn't working well with realistic physics. The GA works like this "A++,B---,D+" would mean motor A's angle increase by...
  32. S

    Complexity Analysis problem of an Algorithm.

    ##A,B## are symmetric matrices of graphs ##G,H## respectively. For ##x \in G##,consider the graph ##(G-x)##, it has vertices adjacent to ##x## and vertices non adjacent to ##x##.## A_x## is the symmetric matrix of the graph ##(G-x)##, where ##C## is the symmetric matrix of the graph created by...
  33. J

    Having trouble with algorithm to build a function tree

    So I've been writing an algorithm to build a function tree and I believe I'm aaaaallllllmost there. The intent is to take a math function like x^2+x+1*5 and build it into / + \ / + \ / \ / ^ \ x 1 * 5 x 2...
  34. P

    Trajectory opimization: Fast preview algorithm

    Hello everyone, I have been interested in trajectory optimization for a while now and I have read a few papers on that topic and bought the book "Spacecraft trajectory optimization" from Cambridge University Press and want to start programming with the goal to optimize a trajectory in a...
  35. R

    Algorithm to compute Basis images of an image

    I know from the Fourier Analysis that any signal can be represented as summation of elementary signals i.e. basis functions .Likewise,any image can be represented as summation of Basis images. Is there any available code, or even an algorithm, that would allow me to compute Basis images of an...
  36. evinda

    MHB What is the Time Complexity of this Vertex Cover Algorithm?

    Hello! (Wave) I want to write an algorithm that finds an optimal vertex cover of a tree in linear time $O(n)$, where $n$ is the number of the vertices of the tree.. A vertex cover of a graph $G=(V,E)$ is a subset $W$ of $V$ such that for every edge $(a,b)$ in $E$, a is in $W$ or $b$ is in...
  37. Superposed_Cat

    What's wrong with this simple Genetic Algorithm?

    Hey all, writing this simple genetic algorithm but its not working. Any idea why? static int len = 30; static char[,] dog = new char[len, 30]; static void breed() { sort(); int Ii0 = r.Next(0,15); int Ii1=r.Next(0,15)...
  38. evinda

    MHB Prove correctness of algorithm

    Hello! (Wave) Give an algorithm that finds the MST (maximum spanning tree) of a graph $G=(V,E)$. Prove that the algorithm you gave finds the MST. I tried the following: I applied the Kruskal algorithm, but instead of ordering the edges by weights in increasing order I ordered them in...
  39. evinda

    MHB What Determines the Running Time of Kruskal's Algorithm?

    Hello! (Wave) The Kruskal's algorithm is the following: MST-KRUSKAL(G,w) 1. A={} 2. for each vertex v∈ G.V 3. MAKE-SET(v) 4. sort the edges of G.E into nondecreasing order by weight w 5. for each edge (u,v) ∈ G.E, taken in nondecreasing order by weight w 6. if FIND-SET(u)!=FIND-SET(v)...
  40. evinda

    MHB Build Huffman Tree with Ternary System

    Hello! (Wave) Steps to build Huffman Tree Input is array of unique characters along with their frequency of occurrences and output is Huffman Tree. 1. Create a leaf node for each unique character and build a min heap of all leaf nodes (Min Heap is used as a priority queue. The value of...
  41. evinda

    MHB Merging $k$ Sorted Lists with a Thin Heap: A $\mathcal{O}(n \lg k)$ Algorithm

    Hello! (Wave) I am asked to write a $Ο (n \lg k)$ - time algorithm that merges $k$ sorted lists into one sorted list, where $n$ is the the total number of elements in all the input lists. Hint: Use a thin heap for a $k$ -way merging. Do you have an idea what could be meant with thin heap ...
  42. nomadreid

    The black box in Deutsch's algorithm

    I am not sure whether this question should go in Quantum Physics, Computers, or Linear Algebra. I am willing to see it moved if appropriate. In Nielsen and Chuang's "Quantum Computation and Quantum Information", in explaining quantum parallelism in section 1.4.2 (as a preparation for Deutsch's...
  43. M

    MHB Stable Algorithm: Insertion, Merge, Heap, Quicksort?

    Hey! :o Which of the following sorting algorithms are (or can be implemented as) stable: Insertion Sort, Merge Sort, Heap Sort, Quicksort ?? How can we determine it?? (Wondering)
  44. ChrisVer

    Boosted Decision Trees algorithm

    I am not sure whether it should be here, or in statistical mathematics or in computers thread...feel free to move it. I am using it here because I am trying to understand the algorithm when it's used in particle physics (e.g. identification of neutral pions in ATLAS). As I read it: In general...
  45. Alpharup

    Creating new algorithm like PID

    I have come across this Proportional Integral- Derivative( PID) control theory. I feel that it is highly beneficial and accurate. I want to create a new algorithm which is more accurate, faster, efficient than PID. Also it should be easily programmable in microcontroller. So what are the...
  46. Superposed_Cat

    Troubleshooting Simple Algorithm for Image Extraction in App | Help Needed

    Hey all, I'm currently working on an app that requires the a sub routine to extract 'blob"s from images, ie if I have multiple black shapes on a white background split them into separate images. Google turned up nothing, my soultion was to 1. flood fill pixel(0,0) with color[0] 2.add color to...
  47. T

    Algorithm to find square root of a quadratic residue mod p

    I'm going through an explanation in a number theory book about Tonelli's algorithm to find the square roots of a quadratic residue modulo ##p## where ##p## is prime, i.e. I want to solve ##x^2 \equiv a \pmod{p}## with ##(\frac{a}{p}) = 1##. The book goes as follows: Let ##p - 1 = 2^s t##, where...
  48. G

    Algorithm for Numerical approximation to add data points

    Hi, I am working on TDR (Time Domain Reflectometry). I send a 7GHz bandwidth fast rising edge (14ns) square wave into a coax. I get a return Signal. I have an ADC with 10Msamples/sec. I am using MPLAB IDE for coding the microcontroller. Now I would like to increase the Points on the...
  49. S

    MHB Linear programming problem (simplex algorithm)

    Can anyone help me to solve that problem ? I would really appreciate For the linear programming problem P1 : Max z = 2 + x1 - 2x4 x2 = 1 - x4 x3 = 0 - x1 - x4 xi \ge 0 1 \le i \le 4 Question 1 : Explain why the writing of that linear programming in the form proposed above...
  50. G

    High Frequency signal with fast risetime, its bandwidth

    Hi, I am new to world of electronics and to high frequency Domain. But I am working on a design where I have a coax of 30cm length. I have used an external oscillator to generate 7GHz fast falling pulse. I am using a Controller to control the oscillator. Now I have a pulse of about 350ns...
Back
Top