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
-
122
votes6
answers17915
viewsHow to make a phonetic algorithm for Brazilian Portuguese?
To facilitate the search for commonly misspelled information, we use phonetic algorithms. A feature that is extremely useful but that is often neglected, especially outside the English language…
-
87
votes3
answers21628
viewsDefinition of the "Big O" notation
In discussions about algorithmic performance, the use of notation is very common Big O: O(1), O(n), O(n2) It is easy to find the scientific definition of this notation and it is easy to find some…
-
87
votes2
answers4860
viewsAlgorithm to detect nudity with good accuracy
I was researching some libraries in Python that could detect nudity in photos, so that somehow I could avoid inappropriate content on my site. Then I found the library nudity. The problem is that,…
-
78
votes2
answers35446
viewsWhat is the complexity of an algorithm?
What is the complexity of an algorithm? And what are the ways to measure it? (Big O, Big Theta...)
-
55
votes5
answers20362
viewsIs there an algorithm to check the validity of a ID number in Brazil using check digits?
Is there an algorithm to check the validity of a RG number in Brazil using check digits, as with the CPF? If yes, how is this algorithm?
-
55
votes3
answers51454
viewsHow does the AES encryption algorithm work?
I’d like to understand how the encryption algorithm works AES (Advanced Encryption Standard). I seek didactic answers, which make me understand the processes used by the algorithm step-by-step,…
-
45
votes5
answers56754
viewsWhat is the difference between syntactic error and semantic error?
The concepts of syntactic and semantic error are found in books and other programming materials. However, always generate doubts for those who are starting. In a practical way. What is the…
-
45
votes2
answers4966
viewsHow does an artificial neural network work?
I know that this question is quite commonplace and it is easy to find the answer, however, I would like a functional answer, I have seen enough about, but nothing enters my puppy, I’d like something…
-
42
votes5
answers43935
viewsWhat is a Table Test? How to apply it?
It is quite common to read while studying algorithms and programming logic that the Table Test is a means of verifying the functioning of an algorithm. What is the Table Test? How is it possible to…
-
34
votes15
answers4487
viewsDetermine if all digits are equal
It takes as a parameter a numerical value. For example, 888 or 546. And I have a function that returns a value one boolean true if all numbers are equal, or false if they are different. How do I…
-
32
votes2
answers6682
viewsWhat would be the way to validate the CPF checker digits in a DB using only a SELECT?
Finding information on how to calculate the CPF check digits is not difficult. Any Google search gives numerous results. Most are reliable and even have a well respected source which is the entry on…
-
32
votes2
answers2760
viewsWhat is a memoization?
What is memoization? Under what circumstances can it be useful and how can it be used? (If possible, illustrate with a simple example)
-
30
votes3
answers3275
viewsAlgorithm for faster route calculation between two points in parallel Cartesian layers (3D)
I’m working on a solution that involves determining the least effort route between two points in a building. (Imagine students on their first day of university, and they need to know where it is and…
-
30
votes6
answers1117
viewsAlgorithm against Brute-force
I’ve been thinking about an algorithm against attacks like Brute-force which, as we have seen in case of iCloud, can generate great headaches if treated with indifference. Initially I thought of…
-
29
votes3
answers5730
viewsWhen should we declare a method static?
As a general rule, it is considered bad programming practice to use static methods. But in what situations it is justified (or not justified)? For example: if I were to create a simple method to…
-
28
votes1
answer9577
viewsWhat’s a greedy algorithm?
What is an Algorithm Greedy ? What are its characteristics ? What are its advantages and disadvantages ?
-
26
votes2
answers5051
viewsWhat is a deterministic, nondeterministic algorithm?
What is a deterministic and nondeterministic algorithm? What are the characteristics of both? It is possible to implement both in any language? NOTE: if possible exemplify with some implementation…
-
25
votes3
answers681
viewsWhat makes cache invalidation a difficult solution?
There’s a famous phrase: There are only two hard problems in Computer Science: cache invalidation and naming Things -- Phil Karlton So she says it’s hard to name things, which has a funny tone since…
-
24
votes5
answers20688
viewsHow to verify similarity between strings?
It’s very common to compare strings, which is usually done by comparing equality. However, today I have arisen the need to compare the likeness between two strings, so I can compare how similar they…
-
24
votes2
answers3245
viewsWhat are genetic algorithms?
I was reading a little bit about algorithms and suddenly quoted the darwinism, evolutionary theory that explains the evolution process of the species, referencing genetic algorithms. There arose the…
-
24
votes3
answers2716
viewsHow to prove the asymptotic order of an algorithm?
Considering an algorithm like the one below: function somaMatriz(matA, size) { let soma = 0; // 1 for(let i = 0; i < size; i++){ // n + 1 for(let j = 0; j < size; j++){ // n(n + 1) soma +=…
-
23
votes2
answers6299
viewsWhat defines a stable sorting algorithm?
It is known that there are several ways to sort the data of a collection, some examples are the famous Bubble Sort, Insertion Sort and Selection Sort. I heard some algorithms are stable and others…
-
23
votes1
answer510
viewsWhy learn different algorithms that solve the same problem?
I don’t have training in computer science. For example, whenever I want to sort a number vector x in one of the programming languages I use, just run sort(x) and everything is solved. However, the…
-
22
votes7
answers30495
viewsHow to differentiate phone types
I have the following problem: the customer will send me a phone number and I need to differentiate whether it is fixed or mobile, someone knows some rules that distinguish well the two groups?…
-
22
votes4
answers3410
viewsWhat is dynamic programming?
What is dynamic programming ? Dynamic programming NAY is dynamic typing What are its characteristics ? What are its advantages and disadvantages ?…
-
21
votes4
answers4816
viewsCheck Old Play Winner
The algorithm teacher asked us to write a code to make a simple old game in Java. And I already have everything ready only I’m not very happy with the solution I found to validate who won the game.…
-
21
votes3
answers1786
viewsWhat is the usefulness and importance of "do... while"?
The command while is a repeat structure with a condition at the beginning of the declaration. Example: while (condição) { sentenças a executar } Already do...while has verification at the end, ie…
algorithm loop characteristic-language while do-whileasked 9 years, 4 months ago Denis Caixeta 3,427 -
20
votes4
answers552
viewsHow to distribute words in a fixed size area?
I have a list of words and I need to distribute them in an area of fixed dimensions so that it looks like they were randomly arranged in that space. However, I need to make sure that the words do…
-
20
votes2
answers13934
viewsWhat is a complete NP problem?
What is a complete NP problem? What examples can be given to illustrate a complete NP problem? Why these problems are considered important?
algorithmasked 10 years, 2 months ago Carlos Cinelli 16,826 -
20
votes4
answers1048
viewsShould every algorithm be finite?
Every algorithm must always finish after a finite number of steps? It seems trivial but I ask because it generated another doubt that can be exposed in the following example: enquanto (VERDADE){…
-
19
votes1
answer783
viewsAlgorithm for name generation
I did a lot of research, but I couldn’t find an algorithm that would do something like banks do. For example, when you first register in a 24-hour box, the machine will generate a password. In…
algorithmasked 10 years, 3 months ago Marcony Felipe 879 -
19
votes8
answers5853
viewsRecognize word repeats in String
I have a text inside a StringBuffer and I need to check and mark the words that appear more than once. At first I used a circular row of 10 positions, because I am interested only repeated words in…
-
19
votes1
answer7366
viewsWhat is a backtracking algorithm?
What is an algorithm Backtracking ? What are its characteristics ? What are its advantages and disadvantages ?
-
18
votes4
answers2247
viewsWhat is the iterative (non-recursive) version of the LCA (Lower Common Ancestor) algorithm
In graph theory, there is a concept called LCA (Lower Common Ancestor - Nearest common ancestor), where given a pair of nodes of a tree, one must find the nearest "father" (ancestor) of these two…
-
18
votes1
answer2595
viewsExplain the SVR algorithm
I wonder if someone could explain the algorithm Support Vector Regression? (used this of the scikit) I’ve already looked through some sites but I’m still not getting it right.…
-
18
votes1
answer1939
viewsComputational Geometry: Determine nearest neighbor
Is there any algorithm to solve the following problem: Given a set of points in R² and taking a k point, determine the nearest n neighbors of k.
algorithmasked 8 years, 1 month ago Andrey França 2,313 -
17
votes1
answer8180
viewsWhat is a minimal generating tree?
I have an exercise to solve and the teacher told me that I would just use this method to solve. What is a minimal generating tree and how can I use it in practice?
-
17
votes2
answers809
viewsWhat will the new logic of quantum computer programming look like?
There is a lot of talk about quantum computers with high performance and processing capacity. Unlike bits, the qubits of quantum computers, working with superposition, can assume three different…
algorithm compilation binary computer-science computer-theoryasked 9 years, 2 months ago Denis Caixeta 3,427 -
17
votes2
answers690
viewsUse of artificial intelligence techniques to solve complex problems
Faced with the task of developing a complex application, I decided to make that each time a human interacts with the system, that this record its decisions, apply weights and in the next suggestions…
-
17
votes3
answers1024
viewsWhen and how to use instanceof and typeof operator in Javascript
When and how to use operator instanceof and typeof in Javascript? In a post do Stack EN I see the usability of instanceof. However, in another post Stack EN says that it is not necessary to use any…
-
16
votes2
answers684
viewsWhat is an algorithm?
I would like to know what algorithms are. I program in C, study C++ and Python. In all the online courses I’ve taken, I’ve heard of such an algorithm, but I don’t know what it is.
algorithmasked 9 years, 7 months ago Mateus Souza 647 -
16
votes3
answers419
viewsWhat are evolutionary algorithms?
Researching on Evolutionary Programming, I came across the question What are genetic algorithms? In an excerpt from the answer: ... Genetic algorithms are a particular class of algorithms evolutive…
-
15
votes2
answers1506
viewsHow is the algorithm of a P2P application?
There are several P2P programs, I know that the concept is that each computer is like a client and server at the same time, and that they communicate with each other. On this type of communication:…
-
15
votes3
answers10756
viewsWhat is a checksum for?
I was reading a question here on the website and came across the term checksum. Several other times I have seen this term being used when talking about file transfer or some important data. After…
-
15
votes4
answers426
viewsContest question: logic error and semantic error?
I participated in a contest and fell the following question: 33 - Analyze the algorithm and check the correct option for this algorithm. Algorithm Calculo_media: Var N1, N2, MEDIA: Inteiro Início…
-
14
votes3
answers1609
viewsWhat is the function of the vector (array)?
I’m studying algorithms with Portugol and I’m having difficulty understanding the function of the vector in the code. I already know how to use this structure.
-
14
votes6
answers6260
viewsHow to determine if a number is power 2?
I need to develop an algorithm in Visualg where I enter with a number and it tells me if it’s power of 2 or not. What strategies can I use?
-
14
votes1
answer356
viewsWhat would be a good hash calculation algorithm to use in a scattering table?
In the question Why String hashcode() in Java uses 31 as multiplier? There is talk of the use of the number 31 as a multiplier. There has been a controversy about the motivation of this number. In…
-
14
votes4
answers486
viewsHow would an algorithm work to prevent attempts to trick word blocks (strings)?
Let’s say I develop an application that allows the creation of arbitrary records (no matter the subject). However, for some reason, I have decided to block the use of the word batata in the title of…
-
13
votes3
answers949
viewsHow does the Xor Swap algorithm work?
I was studying bit-by-bit operations and came across the Xor Swap algorithm. I understand what it does (exchange the value of two variables), but I don’t understand how it does it, at the level of…