Most voted "algorithm" questions
An algorithm is a sequence of well-defined steps that defines an abstract solution to a problem. Use this tag when the problem is related to the design of an algorithm. Always use specific algorithm tags when the question is more directed to a specific type of algorithm.
Learn more…723 questions
Sort by count of
-
13
votes2
answers16707
viewsHow do the SHA family hash algorithms work?
I would like to understand how the hash algorithms of the SHA family work (Secure Hash Algorithm), such as the SHA-1, SHA-2, SHA-3, and understand the differences between them. I seek didactic…
-
13
votes1
answer593
viewsAnti-aliasing algorithm in Java
I’m using the method setRenderingHints from the awt library to do anti-aliasing. The method provides a significant improvement in the rounded 2D objects. How does the algorithm work? What are the…
-
13
votes1
answer641
viewsHow does the Conditional Random Fields algorithm work?
I’ve been researching the algorithm for a long time "Conditional Random Fields", but I can’t find any deep explanation for how it works and I can’t understand it. I understood that it would be a…
algorithm artificial-intelligence machine-learningasked 8 years, 5 months ago Nicolas Bontempo 1,652 -
13
votes2
answers244
viewsWhat is a heuristic?
Is it the same as artificial intelligence? What is the relationship between these things? Why does it matter to us programmers? Can you give an example to illustrate?
-
13
votes3
answers971
viewsHow to find "Happy Numbers" within an interval?
I’m making an application where I need to find Happy Numbers within a certain range, in the case of 0 to 50, and I found this in Wikipedia: The happy numbers are defined by the following procedure.…
-
12
votes7
answers8546
viewsHow to implement a linear regression algorithm?
I need to implement a linear regression algorithm. Preferably that gives equal or near results to the function TENDENCY (or TREND) excel. I’ve found a lot of material that tries to explain the whole…
-
12
votes3
answers1032
viewsReturn the "period" size of a bit string
Recently I did a very interesting online test (from Codility). Unfortunately this test was timed (30 minutes) and I ended up not being able to reach a satisfactory solution to one of the questions.…
algorithmasked 10 years, 8 months ago Anthony Accioly 20,516 -
12
votes1
answer13778
viewsHow does the MD5 hash algorithm work?
I would like to understand how the hash algorithm works MD5 (Message-Digest Algorithm 5). He is considered safe? I seek didactic answers, which make me understand the processes used by this…
-
12
votes2
answers322
viewsComparison of search algorithms within text strings
I am trying to implement the following algorithms for searching expressions within Java text strings: Knuth-Morris-Pratt (KMP), Brute Force, Boyer-Moore and Levenshtein How could show the similarity…
-
12
votes3
answers414
viewsAlgorithm for distributing entries from an encyclopedia based on number of characters per day
I managed a list of entries from an encyclopedia and I want to find the best way to separate the entries so that I choose a number of days and I have a schedule of which entries to read per day.…
algorithmasked 7 years, 8 months ago Filipe Teixeira 502 -
12
votes1
answer517
viewsWhat’s Breadth First and Depth First?
When we are dealing with trees and graphs we find these terms. What do they mean and why are they important in using data structures of these types and algorithms that manipulate them? What I gain…
-
12
votes2
answers213
viewsHexagon Grid - return neighbors
I am writing a simulator of a game called Iso-Path. It consists of a hexagonal grid, being itself formed of hexagons You can see what I’ve done on this link But I stopped in time to catch the…
-
12
votes1
answer161
viewsWhy does 2*i*i tend to be faster than 2*(i*i) when i is integer?
The two multiplications, 2*i*i and 2*(i*i), are equal and must generate the same result, what changes is only the order that the multiplications are made, but apparently are treated differently by…
-
12
votes3
answers1299
viewsDefine whether the letter is vowel or consonant
I was trying to create a code with Javascript that after reading the letter entered showed if it was a vowel or consonant but with any letter I put the code answers me that and a consonant even if…
-
11
votes3
answers1814
viewsSort a multidimensional array with numerical values
Suppose the following situation in which I have a array composed of several array numerically valued: $array = array( array(22, 25, 28), array(22), array(22, 23) ) I’d like to leave this array…
php array algorithm multidimensional-array classificationasked 10 years, 12 months ago Douglas Cabral 345 -
11
votes2
answers665
viewsHow to determine the smallest number of small areas to render?
I have two images (pixel arrays), one of which is rendered on the screen. The goal is to render the second. However performance is critical and, in the environment where I am, render each pixel is…
-
11
votes4
answers15696
viewsHow to extract digits from a Python string and add them together?
I need to decompose one string in Python, separating letter and numbers, and summing these numbers. For example: string = "96h11k" Of that string need to extract the numbers 9, 6, 1, 1 and add them:…
-
11
votes2
answers335
viewsSplit a String dynamically based on screen size
I’m working on an android app and at some point I get a string from a web-service that is quite large, and the client wants this String (which will be shown in a Edittext) be divided into multiple…
-
11
votes4
answers2951
viewsWhat ways to measure the performance of an algorithm?
If I have, for example, some sorting algorithms (Merge Sort, Quick Sort, Bubble Sort...) in which way(s) I can know the efficiency of each one?
-
11
votes2
answers536
viewsExternal and internal memory sorting algorithms
I was researching the difference between memory sorting algorithms external and internal and found the following answer in Quora : "In cases where we have to classify more data than can fit into…
-
10
votes1
answer508
viewsHow does the secret of Bittorrent Sync work?
I’m looking for a completely Open Source alternative to Bittorrent Sync, and it seems we have almost every element there: Sparkleshare would do what they wanted to do, just missing the direct…
-
10
votes3
answers18905
viewsAlgorithm for betting creation on Lotofácil
One of the ways to bet on Easy Bet is to choose 15 numbers from number 1 to 25. I would like an algorithm in c# that generates bets. Remembering that in each combination the numbers cannot repeat…
-
10
votes5
answers6566
viewsRemove last comma from an array
In this Code below I have a array that returns a comma to me at the end exe: '98602','98603','98604', How can I remove this comma? if (isset($_POST['checkbox'])) { foreach ($_POST['checkbox'] as…
-
10
votes1
answer7950
viewsWhat is the difference between functions and procedures?
I’m studying algorithms and I’m having a hard time understanding the difference between them and when to use these sub-algorithms in a program. I’m learning to code with algorithm in Portugol.…
-
10
votes1
answer187
viewsPersist "pieces" of a tree (large) in parallel
I find myself with the following problem at hand: Goal: Parallelize an ETL process that: Reads from an external interface a tree with an undetermined number of elements. Transforms the…
-
10
votes9
answers17879
viewsHow to identify if a string is a palindrome?
A palindrome is a word or phrase that has the property that can be read from right to left and from left to right. For example, the strings "aaaaa", "1221", "bbaabb" are palindromes, however the…
-
10
votes1
answer382
viewsWhat is and what is a Bloom Filter for?
I was reading an answer here at Sopt (yes, it’s funny) and I saw about Bloom Filter, I wanted more information about him. Besides what it is and what it’s for, where I can use in practice?…
-
10
votes1
answer1792
viewsWhat’s the difference between "Big O", "Big Theta" and "Big Omega"?
What use are each of these "Big O", "Big Theta" and "Big Omega" and when to use each to describe the complexity of an algorithm?
-
9
votes2
answers471
viewsFactorial series from thehuxley.com site
Make a program that calculates and writes the sum of the n first series terms: seriefatorial http://www.thehuxley.com/data/images/app/problems/temp/e68085c6d699d2c7029907f994c57b80.png Input format…
-
9
votes6
answers8412
viewsFunction that enumerates letters of the alphabet
How to convert alphabet letters into one array of numbers according to its sequence? The array should start from paragraph 1, not zero. So the letter A valeria 1, B valeria 2, C valeria 3, and so…
-
9
votes1
answer285
viewsHow does the LED lightweight encryption algorithm work?
I would like to better understand the functioning of the algorithm LED step by step, mainly the process of substituting and permutation of the blocks and mainly the use of the keys in each round.…
-
9
votes1
answer234
viewsWhat is the algorithm for distributing the paragraphs?
I am reading a specific portion of the Bible per week based on programming published on the website Jw.org. I made a javascript script that takes the paragraphs and verses of each chapter and shows…
-
9
votes4
answers760
viewsWhat are Path Finding Algorithms?
In college studies, I came across the Path Search algorithms. The theoretical part confused me a lot and I am limited to understand the uses of this algorithm in practice. What Are Path Finding…
-
9
votes5
answers8188
viewsBest factor calculation algorithm
So I’m learning to develop in Java. The teacher asked me to develop a method for Factorial. And also show on the screen what is happening, for example: 3! = 3 X 2 X 1 = 6 In fact, I made it happen,…
-
9
votes2
answers750
viewsHow to improve the performance of my code with "for"?
I have the following code: for ($i=0; $i < 10; $i++) { for ($j=0; $j < 20; $j++) { for ($p=0; $p < 40; $p++) { echo $vaar[$i][$j][$p]; } } } I believe a code that contains a for inside…
-
9
votes5
answers639
viewsComplete number with "zeros" until the total size is 9!
I receive by parameter one Number.. ex: 18 and need to complement it with "zeros" until the total size is 9 numbers.. the result would be 180000000. If the value received is 678 for example, the…
-
8
votes4
answers6417
viewsHow to split a string into C++?
I received this simple (I really thought it was!) challenge of creating a "tokenizer". I had to split the string " O rato roeu a roupa do rei de roma " into spaces. Then, after a long time, I…
-
8
votes2
answers9026
viewsAlgorithm in C to convert Arabic number to Roman number
How to make this conversion? It doesn’t need to be the algorithm ready, wanted a help at least in logic.
-
8
votes2
answers748
viewsHow to detect when the person starts speaking using Speechrecognition() in Javascript
I’m using the function Speechrecognition (native of each browser) to be able to do voice searches on a website and I noticed that Google can identify when the person starts talking (both in "Ok…
-
8
votes2
answers1152
viewsHow to count words from a string ignoring prepositions?
Is there any service that does the recognition if a certain type of word is a preposition? I want to make a word ranking of a rss feeder, but ignoring prepositions. Ignoring words with less than N…
-
8
votes0
answers581
viewsHow does the RSA encryption algorithm work?
I wanted to understand how the algorithm works RSA, step by step, for a better understanding and so that I can use it properly.
-
8
votes1
answer469
viewsHow to calculate the median when the data is in Chunks?
Suppose my data is divided into 2 vectors: x <- c(100, 400, 120) y <- c(500, 112) I could calculate the median by joining the two vectors and then using the function median. median(c(x,y)) [1]…
-
8
votes1
answer641
viewsWhat is a reference location?
There are several answers here that talk about locality of reference, but do not explain what is. Where it is applied? And why it’s so important for data structures and algorithms?…
-
8
votes1
answer198
viewsHow to implement the "evaluate()" and "successor()" method of the Slope Rise algorithm?
I’m trying to implement the algorithm Hill Climb (Hill Climbing) and this algorithm should return the sequence of cities considered good (with the shortest distance between cities) the problem of…
-
8
votes2
answers863
viewsConvert binary to decimal without using "parseint()"
I’m trying to make a script binary to decimal number conversion. I know what to use parseInt() It’s enough, but it’s not what I want here. Apparently the code had worked, but when the binary number…
-
8
votes3
answers440
viewsGet the elements around a selected in the matrix
The idea is to create an integer array with the amount of user-defined rows and columns. Then an existing value in the matrix must be informed and the program must return the values immediately to…
-
8
votes3
answers223
viewsHow to simplify a problem to get the names of the months of the year?
I am beginning to program in C and I realized this problem whose statement is the following: Write an exercise that asks the user for a one-month number and prints the name of the month on the…
-
8
votes1
answer276
viewsCHALLENGE: Algorithm for updating rectilinear motion uniformly varied aiming inertia at a certain end point
Question I want an algorithm that updates (from an instant to another, with a certain time interval between the two) a uniformly varied movement aiming at a final value making the fastest possible…
-
8
votes3
answers179
viewsTwo different parameters that an accepted function can classify as having O(n²) complexity?
Let’s say I define a function as follows, which accepts an argument a be a array two-dimensional numbers: function totalSum(a) { let total = 0; for (const elem of a) { for (const subElem of elem) {…
-
7
votes2
answers355
viewsMaximize Solution: Sublist Construction Meeting Limit
Having a set of n-values, I need to divide these items into subsets that do not exceed the value (sum of all items) stipulated and assure me that the formation of the set is as close as possible to…