What is Algorithm: Definition and 720 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. R

    Challenge: Find the minimum amount of draws possible for a list of integers

    Hello. Sorry if the title is a bit vague. I'm doing this challenge (google foobar) and even though it's not very elegant to ask for help, it's not like I'm going to win any kind of prize for it. In any case I'd like some suggestions since my current solution fails 2 tests on 5. The most...
  2. H

    An Algorithm Challenge (finding the five fastest horses out of a large group)

    As a Bedouin schiek you own twenty-five horses. You want to find the three fastest. You have no clock or other device that measures time. Your racing field is wide enough that five horses can race unimpeded, so you can race five at a time and see how they place. You don't want to abuse your...
  3. H

    Ingenious Algorithm Riddle: Imposs. Even w/Answer

    Hardly anyone would think of this solution. I even wonder how anyone would come up with the question. And it is even more amazing that the questioner and solver were not the same person.
  4. L

    I Questions about Grover's algorithm for quantum searches

    Hi! I have studied Grover's algorithm for quantum search and I just want to make sure that I understood it correctly: to make a number k of calls to the oracle one needs to have k physical copies of the gate producing the oracle. In quantum circuits there are no loops, hence a physical gate...
  5. C

    I Is an algorithm for a proof required to halt?

    I know that when giving an algorithm to prove something we need to prove two things about the algorithm ( there’s another option which is to show time-complexity but that’s optional since it’s irrelevant to the proof): 1. Correctness 2. That it halts But there are also algorithms/procedures...
  6. C

    Gauss-Jordan Elimination algorithm steps

    For this problem, For (i) the solution is, However, I am somewhat confused how to follow the steps of the Gauss-Jordan Elimination algorithm from there. Do I have to eliminate the coefficients from ##x_2## and ##x_3## respectively from row 1 and the -5 coefficient from row 2 in the exact...
  7. sHatDowN

    Algorithm problem involving 3 points and 3 lines in the x,y plane

    1- Coordinates of two points are given in x and y plane. A(x1,y1), B(x2,y2) Calculate the angle between the two lines passing through each of these points with the origin of linear coordinates. 2- If a line passes between the two points A and B above, does point C lie on this line? C(x3,y3) how...
  8. D

    I Smoothing algorithm for real-world data

    Hi 🙂 I'd appreciate your help. I have a bunch of livestock with an ear sensor on each, that sends me data about how much heat is going out of the ear. I wanna take this data from each livestock and smooth it. My question is, how to know which smoothing algorithm I should use to get an...
  9. M

    Use the Euclidean algorithm to find integers ## a, b, c ##

    Let ## a, b, c ## and ## d ## be integers such that ## 225a+360b+432c+480d=3 ##. Then ## 75a+120b+144c+160d=1 ##. Applying the Euclidean algorithm produces: ## gcd(75, 120)=15, gcd(120, 144)=24 ## and ## gcd(144, 160)=16 ##. Now we see that ## 15x+24y+16z=1 ##. By Euclidean algorithm, we have...
  10. shivajikobardan

    Comp Sci Diffie Hellman Key Exchange Algorithm? (x,y value)

    I'm not asking it from "will it be secure" point of view, rather I'm asking textbook kind technically correct or not. This is the algorithm (in the 3rd step of right figure, it should be generate y, typo) I took p=23,g=5. And picked x=4,y=5 I got the secret key as 12 and both got 12, so it...
  11. shivajikobardan

    Comp Sci Solve ax+by=GCD(a,b) for RSA Algorithm Cryptography

    It starts at 6:16 It's the part where he's pointing his hand in this picture. I didn't get it although it's pretty mechanical, so I'd like to learn that technique as this is really useful in RSA algorithm(rather than having to memorize some values). I've been searching for a method like that...
  12. Bob Walance

    B Shor's algorithm on a Google Sheet

    Here is a spreadsheet that demonstrates how Shor's algorithm works. The user first enters a number 'N' that has only two prime factors. Then, the user enters a random integer 'x'. Shor's algorithm does the rest in the factorization of N. A different value for 'x' must be tried if the factoring...
  13. N

    ART algorithm - Image Reconstruction

    My answer: The ART algorithm is a row-action algorithm. I tried to draw it, but I am not sure whether it will answer the question
  14. M

    Use the binary exponentiation algorithm to compute....

    First, consider ## 19^{53}\pmod {503} ##. Then ## 53=(110101)_{2}=2^{5}+2^{4}+2^{2}+1=32+16+4+1 ##. Note that \begin{align*} 19^{2}\equiv 361\pmod {503}\\ 19^{4}\equiv 44\pmod {503}\\ 19^{8}\equiv 427\pmod {503}\\ 19^{16}\equiv 243\pmod {503}\\ 19^{32}\equiv 198\pmod {503}.\\ \end{align*} Thus...
  15. A

    Comp Sci For which of the following purposes is the Banker’s algorithm used?

    I am new to the operating system and I want to know, Is it right Banker's Algorithm is mainly used to prevent deadlock? I picked this question from https://www.interviewbit.com/operating-system-mcq/ and I think it is also used for Solving deadlock, Can anyone know, Is this right?
  16. C

    Comp Sci Number of trees in a Fibonacci Heap without CASCADING-CUT

    I know that the maximum number of trees in a heap will be when all the trees are of smallest order as possible. Then, after performing CONSOLIDATE operation on the heap, all the newly created trees in the heap will be of different orders. Since in a different exercise I showed that the minimal...
  17. Oldman too

    New algorithm for real time voice camouflage

    An interesting approach to those eavesdropping devices in your life. https://arxiv.org/pdf/2112.07076.pdf ABSTRACT Automatic speech recognition systems have created exciting possibilities for applications, however they also enable opportunities for systematic eavesdropping. We propose a method...
  18. Monsterboy

    Comp Sci Using Single Source Shortest Path Algorithm to find the longest path

    This is the weighted, directed acyclic graph I created in JavaScript class WeightedDirectedGraph { constructor() { this.adjacencyList = {}; } addNode(node) { if(!this.adjacencyList[node]) { this.adjacencyList[node] = []; } } addEdge(node1, node2, direction, weight) {...
  19. B

    Coding Viola-Jones Algorithm in C#: Q&A

    I am coding the Viola-Jones algorithm in C# and I have a few questions. For finding an eye, after I have my integral Image, I am passing a 24 X 24 Rectangle across the whole image from left to right and top to bottom. I subtract the black area from the white. So right now, I am solving for the...
  20. chopnhack

    Comp Sci Functional Dependency Solving Algorithm for Minimal Cover

    Step 1: Reduce RHS into singletons F = {AB->C, C->A, BC->D, ACD->B, D->E, D->G, BE->C, CG->B, CG->D, CE->G} Step 2: Reduce LHS redundant attributes ACD->B has closure of A: A, C: C,A and D: D,E,G since A is in the closure of C we can remove A from ACD->B making it CD->B no other LHS could be...
  21. shivajikobardan

    Comp Sci Genetic algorithm knapsack problem

    Here is a solution, part of which doesn’t make any sense to me-: ->Why did we select c3,c1 and c3,c2 for 2nd generation? -> why did we select os1,os2,c3,c2 for 3rd generation? (And what the heck is happening here? We are already in 3rd generation when even 2nd one is not complete? -> then we...
  22. shivajikobardan

    MHB Debugging Algorithm Logic: 2 Iterations & Finding Right/Wrong Answers

    https://lh3.googleusercontent.com/J-M_R31KFl76aXCRE4sxzAWI6iAldXG9fMI2k4YRMZo6vZY0w1DPUfV7tLc1w5IsVQX8uUkjgThzROZrbb3bc6kluAEmyiH63Z4BsXKT5Xr7X7mLxOwbR1L0y3ttoLitS6bOnwz- Here is a solution, part of which doesn’t make any sense to me-: ->Why did we select c3,c1 and c3,c2 for 2nd generation...
  23. shivajikobardan

    Comp Sci What is uniform crossover in genetic algorithm crossover operation?

    https://slidetodoc.com/genetic-algorithms-an-example-genetic-algorithm-procedure-ga/ slide is taken from here. is this done total randomly or is it done pseudorandomly. I mean is there some forumula for randomness used in this case? i learned about single point and double point crossover but...
  24. shivajikobardan

    Comp Sci I need a solved numerical example on genetic algorithm for 1 iteration

    Really need this. Tried googling but not many. 1 or 2 are there. I want this algorithm solved by hand to some problem. IDK what kinds of problems exists. but one is knapsack problem. there is analytics vidya's tutorial but I want something else, more direct, more clear...Any resource you can...
  25. shivajikobardan

    Comp Sci Confused about DFS algorithm in action (not an issue with the pseudocode)

    The DFS in action doesn't relate to the pseudocode as you can see it. My confusion starts from dfs in action, step 4. I could write essay about it, but you can see it yourself as well and spot that algorithm and dfs in action doesn't match up properly. or is it only me? This is not a homework...
  26. riay00

    I How to create a fair distribution algorithm?

    Hi, I am a math noob and need to understand what is the best mathematical formula for fair distribution. The problem statement is as follows: We choose 2 numbers at a given time to distribute donations at a particular instance in time (The numbers from 1-6500 represent community members...
  27. mathbalduino

    Algorithms for Traveling Purchaser Problem (TPP)

    Hey guys, how you doing? Im here to ask for you help. I am writing my bachelor paper as an implementation/review of the TPP algorithms out there. Almost every paper that I read references the Ramesh algorithm, that returns an exact solution for TPP problems, but I just can't find the algorithm...
  28. shivajikobardan

    MHB RSA algorithm to encrypt "abcdefghij"

    Say p=5, q=11 z=(p-1)*(q-1) =40 d relatively prime to z, so d=27 de mod z=1 27e mod 40=1 e=3 $C=M^e mod \; n$ For d, M=4 C=$4^3 mod 55$ Am I right here?
  29. A

    MHB Want to use probability algorithm for my web app

    I'm a freelance web developer and right now I'm stuck into a mathematical(probability) issue where I'm developing an answer filtering tool. This tool works as follows: 1) There are six questions that the user will be asked 2) Based on the answer of first question, my server will decide which...
  30. P

    I Notation of the approximation in quantum phase estimation algorithm

    I'am interested in the notation of the approximation in quantum phase estimation algorithm. In the literature there are different definitions, which I divide into two cases here. Both different in their definition of the ##\delta##. In both cases I start with a quote of the source and show an...
  31. M

    A HHL quantum algorithm and the phase estimation

    In HHL algorithm, does the controlled unitary (Hamiltonian simulation part of Quantum phase estimation) depend on Hermitian matrix coefficients and how?
  32. P

    I Measurement of a qubit in the computational basis - Phase estimation

    Hello, I have a question about the measurement of a qubit in the computational basis. I would like to first state what I know so far and then ask my actual question at the end.What I know: Let's say we have a qubit in the general state of ##|\psi\rangle = \alpha|0\rangle + \beta|1\rangle##. Now...
  33. Theia

    MHB Algorithm to arrange N people into groups of K

    Hi all! I've been trying to find a reasonable way to solve following problem: N people meet each others in groups of K people such that no one meets more than once. If I'm not mistaken, this requires two things: N must be divisible by K N - 1 must be divisible by K - 1. Let's assume these...
  34. S

    Comp Sci A Question about modulus R in Rabin Karp Algorithm

    Hello, I am learning trying to set up a code that searches for a certain pattern in the text by implementing Rabin-Karp Algorithm. When setting up the Rabin Karp hash function, I have been told that I should set a value q in order to lower the time complexity of the function, and that q should...
  35. M

    MHB Booth algorithm for multiplying signed numbers

    Hey! 😊 The algorithm of the Booth for multiplying signed numbersrs of fixed complement representation decimal point by 2 is implemented by multi-consecutive digit stain control of the multiplier, so after each test the algorithm proceeds by $N$ digits (e.g. for $3$-bit control step $N$ is...
  36. M

    I Question about Grover's algorithm

    Hello! I am just getting started learning about quantum computing so I apologize if this questions is trivial, but I am a bit confused about the Grover's algorithm. As far as I understand (I read it from here), assuming there is just one solution, you start with N qubits, you put them in an...
  37. Arman777

    Python Algorithm for Converting Strings: Find the Best Option

    Let us suppose I have a string in this form, string = 'CıCCkCnow CwCho CyCou CaCre but CwChat CaCm CıC' Now I won't to take each word between 'C' and convert it into an upper case letter. For example, the above string should turn into new_string = 'I know Who You Are but What Am I' what kind...
  38. B

    Evaluate the complexity of this graph coloring algorithm

    Hello everybody, I should evaluate the complexity of this graph coloring algorithm. To do this, I use the adjacency matrix in which the graph nodes are the elements on the diagonal, while the elements outside the diagonal indicate if a node is adjacent to another ##(A_{i,j} = 1)## or not...
  39. Wrichik Basu

    I Numerically solving Time-independent Schrödinger eqn. using Shooting algorithm

    I have to solve the 1D Time-independent Schrödinger equation (TISE) using the shooting algorithm. As far as I understood from this video on Shooting method for solving BVP, I will have to solve the problem by using IVP solvers (like RK2 or RK4 methods), and guess a value for the derivative of...
  40. B

    Crosstalk Algorithm - Optical system

    I have a camera that take pictures of square boxes that are really close to one another. There is a light that is Illuminating the boxes but when I try and isolate a single but in my picture, I am reading higher values then what I should be. If I remove the other boxes and only do one box, I am...
  41. Admiralibr123

    I Algorithmic model for primary decay chains

    I have seen "radioactivedecay.py" python library which employs measured experimental data for its calculations. I have seen models that solve the system of differential equation with numerical algorithms to predict the proportion of nuclides at any given time. But I have yet to see a...
  42. F

    Find Z-bus using Z building algorithm using MATLAB code

    I tried to write to the code, but I got confused in line 46 & 59.Every new added bus increases the dimension of the Z matrix, and since we have 3 busses, the dimension of Z should be [3x3]. I formed a for loop in case of adding a new bus to add a new row and new column (increases the...
  43. Mark44

    Fast reciprocal square root algorithm

    I ran into an interesting video on Youtube yesterday, about a fast way to compute the reciprocal of the square root of a number. I.e., to compute this function: ##f(x)= \frac 1 {\sqrt x}## The presenter is John Carmack. If you search for "Fast Inverse Square Root — A Quake III Algorithm" you'll...
  44. Arman777

    Python MCMC algorithm -- understanding some paremeters

    Recently I have shared a question about a program called SimpleMC and how to run it. Running a Github File on VS code for windows 10- File system problem ( | Physics Forums I am trying to understand an MCMC program. I manage to run it, but I am trying to understand the meaning of the some...
  45. TimeSkip

    I God's algorithm as undecidable?

    I posted in the same sub-forum about complexity in mathematics and whether it is determinate. Seemingly, the consensus is that there's no definitive way in assessing a proofs complexity in a manner that is rigorous in regards to any other theorems or otherwise stated in a systematic way other...
  46. Wrichik Basu

    What's wrong with this Python program on Euler's forward algorithm?

    Here is the function that I have written: import numpy as np def ode_euler_forward(odefun, y_initial, x_range, num_steps): """ Solves a system of non-stiff ODEs using Euler's forward algorithm. Parameters ---------- odefun : callable(x, y1, y2, ...) The function...
  47. C

    Det of Triangular-like Matrix & getting stuck in Algorithmic Proof

    Find determinant of following matrix: ## A = \begin{pmatrix} a_{1,1} & a_{1,2} & \cdots & a_{1,n-1} & a_{1,n} \\ a_{2,1} & a_{2,2} & \cdots & a_{2,n-1} & 0 \\ \vdots & \vdots & \ddots & \vdots & \vdots \\ a_{n,1} & 0 & \cdots & 0 & 0 \end{pmatrix} ## Note: I tried to solve this question...
  48. Arman777

    Trying to find an algorithm for the Number Mastermind game

    I am trying to write a code to guess the secret number. For example, if I have a secret number called 412. My code will take the inputs as 120 - 0 312 - 2 439 - 1 where the numbers on the right gives the position of the correct digit at the correct location. I have thought some codes but it...
  49. person123

    MATLAB More Efficient Way of Computing Neighbors in Range

    Hi. I have a collection of points in 3D space. I'm using MATLAB to find all pairs of points within a certain range from one another. Right now I'm using rangesearch(X,X,r), where X is the collection of points and r is the range. These points are the locations of atoms and I am attempting to...
  50. 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...
Back
Top