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
-
4
votes1
answer265
viewsHow do I calculate the size of the tag source in a tag cloud?
I have a cloud of tags and want to change the font size of each tag as you use them. I need to have a minimum size and a maximum size. What would be the formula to calculate tag size?…
-
4
votes3
answers491
viewsLogica de Distribuição Igualada
I was wondering if anyone knows any matching distribution algorithms. For example I have 10 spaces and I have 4 a, 2 b, 3 c, 1 d. And I have to distribute these variables within these 10 positions…
algorithmasked 10 years, 8 months ago JunioorCelistre 111 -
4
votes1
answer491
viewsFind isolated components in graph
What is the best algorithm for finding isolated components in a graph? That is, components that do not lose information. In this image, the only isolated component is H, because it only receives…
-
4
votes4
answers1341
viewsAn algorithm for finding repeated files?
I need to make a program that finds repeated files on my computer, so that the user decides what action to take with these files (e.g.: delete the copies). For now, I only care about a binary file…
-
4
votes1
answer966
viewsHow to implement the six degree separation theory algorithm?
What is? Theory that in the world it takes no more than six bonds of friendship for any two people to be connected. Question: I’ve been trying for some time to implement this algorithm, but I can’t…
-
4
votes2
answers2008
viewsHow to pre-process a text for the application in the Weka classification algorithms in Java?
I am doing my TCC where the idea, roughly, part of the collection of tweets and a training of an algorithm machine Learning to classify this data. How I would pre-process this tweet, and the idea…
-
4
votes3
answers7464
viewsRound numbers in C# to decimal 0 or 5
I need to round up numbers in such a way that they only have a decimal value of 0 or 5. For example 1 -> 1 1.1 -> 1.5 1.4 -> 1.5 1.5 -> 1.5 1.6 -> 2 2 -> 2 Someone knows a simple…
-
4
votes2
answers581
viewsLocation of a point within the arc range
I’m looking for a Javascript function that returns a random value within a range in the area of a circle. The interval would be along the radius with distances equivalent to the center point and the…
-
4
votes1
answer536
viewsDisplay student grade in C
I wanted to display the student grade when all the notes were typed, in an array of 10 positions, I tried out for, but it returns me only the last. #include <stdio.h> #include <stdlib.h>…
-
4
votes2
answers130
viewsWhat is the equivalent of a functional specification for games?
I work in a company that writes software for commercial use, usually in style sistema. To specify the software we use several documents among them: Functional Specification MER (Database Modeling)…
-
4
votes1
answer201
viewsBinary search on a list with no fixed size
There is a reliable algorithm capable of performing a binary search on a list where one cannot consider the size (length or count) of the list? I know that one of the requirements for a binary…
algorithmasked 9 years, 3 months ago Marco Antonio 151 -
4
votes2
answers670
viewsHow can I make a variable wait for the user to press 1 of 4 buttons?
Well, I’ll try to be clearer. I have a variable called int tentativa and I want it to receive a specific value depending on the button the user presses. The buttons are btPedra[0], btPedra[1],…
-
4
votes1
answer203
viewsOrdering structures, why is the representation made in matrix?
Studying methods of sorting, I realized that even the method receiving a vector, its graphical representation of the functioning and explanation of the method in many materials is using a matrix. As…
-
4
votes4
answers872
viewsI need different ways to rearrange characters within a string, how do I do that?
I would like answers in C, C#, or just an algorithm, but preferably an implementation already in the C# language because that’s what I’m using. For example, suppose I have to find out if a number is…
-
4
votes6
answers41177
viewsHow to find the position of an item on a list?
I am writing a program that takes a specific amount of values, and returns the lowest value of the list and its position. It is as follows: quantidade = int(raw_input()) numeros = raw_input()…
-
4
votes1
answer563
viewsAlgorithm to find common word sequence
I’m looking for a logic where I can find in an exorbitant amount of data, phrases that are common. Phrase in this context is word sequence. For example in these prayers: I’m traveling to South…
-
4
votes1
answer1765
viewsC menu that moves with the arrow keys on the keyboard?
I saw once an algorithm in C where the menu selection had a "mini navigation" if I can call it that, where I used the arrow keys to navigate the menu and enter to select the option, I was curious to…
-
4
votes2
answers4751
viewsHow to do Table Test for a particular algorithm?
I have this algorithm, in a pseudocode: Knowing that n1 receives the value 20. inicio inteiro: n1,n2,n3; leia (n1); n2<-n1*3; n3<-n1-1+n2; imprima("O resultado final será n3=",n3); fim.…
-
4
votes1
answer9945
viewsHow to know if a number is integer
I need to develop an algorithm where, it divides a number by 2, until I get to the rest of the division, and I need to know if the rest of this division is an integer, what method can I apply to…
-
4
votes1
answer124
viewsHelp in struct C, unable to feed
Guys, good morning, I’m creating this simple code, just to read, and display, this vector information, like struct. Only that in executing this code, in the act of execution, I can not feed neither…
-
4
votes2
answers4812
viewsHow do I check if there is a special character or number in a string in C?
I am confused in logic to check if it has other characters than alphabetic ones. I thought of the following logic, but I think it is wrong: char nome[30]; scanf("%s", nome); int especial = 0;…
-
4
votes1
answer359
viewsWhat is the main difference between the Knuth-Morris-Pratt and Boyer-Moore algorithms
I know that the KMP(Knuth-Morris-Pratt) is used to find a Y text in X, tries to define a pattern in Y, and then saves this pattern in an array. And I also know that the BM(Boyer-Moore) works best…
-
4
votes2
answers1511
viewsCipher de Vigenere
private static void algoritmo(String input, String chave, Boolean b) { Console.WriteLine("Digite a mensagem: "); input = Console.ReadLine(); Console.WriteLine("Digite a chave: "); chave =…
-
4
votes2
answers181
viewsHow does an automatic categorization algorithm work?
I have that doubt. I’ve noticed on sites like Yahoo Answers, that there’s a recognition of the semantics of the questions and they’re categorized automatically. Sure, there are mistakes, but it’s…
-
4
votes2
answers947
viewsHow to convert gray image to RGB?
To convert a RGB image to grayscale is relatively easy, just do a linear( or average) combination of the 3 channels. For example : Gray = 0.3*R +0.59*G +0.11*B By the expression above you get a…
-
4
votes1
answer126
viewsWhat is the most performative way to convert an int into the sum of its digits?
I have a certain int and would like to turn it into another that is the result of the sum of your digits in the best possible way. For example: int n = 2601; Should result in 9 since this is the…
-
4
votes1
answer2544
viewsHow is the basic functioning of algorithm A*?
I’m reading regarding the search algorithm A* to be able to implement it in the future. I know it’s used to find a path in a graph, but I can’t visualize very well how it’s done. However, I am…
-
4
votes2
answers208
viewsDo not allow repeating values in different dropdownlists using jQuery?
I have 3 DropDownList where they have 4 items with the same valor (1,2,3,4). I need to respect each DropDownList do not repeat the value selected in the others. Example: ddl0= 1 ddl1= 2 (não…
-
4
votes1
answer482
viewsAlgorithm for Helicopter Escape Solution
I recently managed to solve an algorithmic problem by enumerating all possible conditions. However, I believe that through some mathematical artifice, it would be possible to solve the problem more…
algorithmasked 5 years, 10 months ago Jeanderson Candido 230 -
4
votes2
answers253
viewsIs it OK to use a switch inside a for?
Came to me a question related to the use of a switch within a for. I saw that it works for my purpose but this is correct to do in the world of programming? There is a better way to get the result…
-
4
votes3
answers214
viewsCalculate increments so that 2 numbers become equal
The problem: With a very creative name, the Protagonist is in his first episode of its incredible saga! In an afternoon any Z, the Protagonist’s best friend, challenged the even for a super fun…
-
3
votes2
answers585
viewsAlgorithm for calculation and distribution of elements on the screen
We are here at the company wanting to create a showcase with the effect of reorganizing style which is used by the stackexchange itself http://stackexchange.com/sites I’ve been thinking about…
-
3
votes3
answers2284
viewsDoubts binary search
Assuming that the binary search works only with array of ordered integers, if I had to search for an integer in an ordered vector the speed of the search would be much faster than a sequential…
-
3
votes3
answers165
viewsWhat defines good logic?
I was thinking about some code questions that I changed and I remembered what my development teacher android I said, "A good logic has few lines of code". I asked some people who told me that it…
algorithmasked 10 years, 4 months ago Rogers Corrêa 2,596 -
3
votes2
answers2180
viewsGenerating a pseudo-random number based on an input
I need to generate a random number based on another input number, so that for the same input number, the function should always generate the same output number. For example, meuRand(4) would always…
-
3
votes3
answers1231
viewsFunction that writes the first 50 numbers whose sum of the formant digits is 10
I have a question, I need to do a function in Javascript that shows the 50 numbers that the sum of their digits is equal to 10, example: Number 19, digits 1 and 9, sum of digits: 1+9 =10. The…
-
3
votes1
answer586
viewsInterpretation of an algorithm
I have to solve a problem with the following statement: The houses on that street Context A computer programmer lives on a street with houses only on one side. The houses on this street are numbered…
-
3
votes1
answer5913
viewsWhat is the master theorem (master Theorem)?
What is the master theorem (master Theorem)? What is its importance in the complexity analysis of algorithms?
algorithmasked 10 years, 1 month ago Carlos Cinelli 16,826 -
3
votes1
answer12649
viewsAlgorithm that reads 50 numbers, calculates and shows the arithmetic mean, the largest and smallest number
I’m a beginner in programming and I came across an algorithm that I need to solve but I’m not getting it. Read the 50 numbers using the "for i from 1 to 50 knife" I did, now I can’t insert the…
-
3
votes1
answer1283
viewsHow to make a screen recorder?
I am wanting to make a screen recorder. What I thought to do was the following: From the recording event hit 30 screenshots per second and then join them in sequence to form a video. At this point…
-
3
votes4
answers935
viewsStep-by-step operation of binary search algorithm
I’m trying to solve the following problem: Create a graphical representation by illustrating ALL steps (where the start, middle and end) of the search for the value element 57 of the following list:…
-
3
votes1
answer3473
viewsText translation algorithm
I’m a beginner in JS I’ve studied up to the part of loops, then I stopped to review everything I saw and do some exercises. I made an algorithm that translates to English, Spanish and Portuguese a…
-
3
votes1
answer667
viewsHours calculation
I need to calculate the exact time that a given record has to be analyzed. Each registration has a intermission where it can be analysed and, a maximum value in hours, referring to deadline for…
-
3
votes2
answers279
viewsAlgorithm for (A+Bi) n
I need to make a program that given the formula : A + B*i n You have to find the lowest value of n for it to be a real number Being A and B inputs and i is part of the complex numbers. I have a…
-
3
votes1
answer118
viewsSorting algorithm does not work
Something is missing in the program. It checks the order with a single number or a single time. #include <stdio.h> #include <stdlib.h> /*4)escrever 10 números e ordenar em forma…
-
3
votes0
answers162
viewsDecryption code error using Vb.net!
I’m having trouble decrypting with the code below that I found on the net: When debugging you can see that in the property TripleDES.Key has the value 16 in length and the Buffer 15, is that why?…
-
3
votes1
answer2933
viewsSending a message to a local network broadcast via UDP
I made a question about P2P connection, then with one of the answers the question arose: How to send a message on a local network via UDP in style broadcast, without a specific recipient? With this…
-
3
votes3
answers161
viewsThis Javascript loop is taking down my browser. Any idea why?
I’m solving the following coderbyte Problem.com: Using the Javascript language, have the Function Runlength(str) take the str Parameter being passed and Return a Compressed version of the string…
-
3
votes1
answer205
viewsPath between nodes of a binary search tree
I need to create an algorithm that will define if a path between the value a and b are valid, my doubt is in relation to these rules, for example between node 3 and 7 there is a valid path, but…
-
3
votes3
answers3097
viewsHow to generate random matrices without repeating numbers on the same line?
I want to store random numbers from 1 to 60 in an array. When there are equal numbers on the lines, it is to generate another random number. Type, cannot be: 11 55 55 43 49 30, and yes should be 11…