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
-
1
votes0
answers1238
viewsElectronic distribution algorithm
I’m trying to think of a different way to do electronic distribution. The way I did it was this: display the amount of electrons in each layer. However, in the distribution I want (1s² 2s² 2p6...)…
-
1
votes1
answer7307
viewsCheck items from a list in another list
I’m having trouble making a method to check two lists. This method will receive a list which is the list that has been added to the order and the Purchase Order Id to which that order has been…
-
1
votes1
answer568
viewsIs there any software that analyzes the complexity of an algorithm?
is there any software that does the complexity analysis of an algorithm? if yes, I would like to know which
-
1
votes1
answer168
viewsDivision of a line into a number of segments
I need to divide a line into several segments, and all segments need to be formed by whole numbers. But sometimes the division of distância / segmentos results in a truncated number that does not…
-
1
votes1
answer120
viewsHow to resume all students with a common name
I’m developing a program that has to run a school canteen and on the menu I have an option to search student by number and another to search all students who have a first name in common. Here’s my…
-
1
votes1
answer878
viewsTool to Measure Java Software Performance
I wonder if anyone knows any tools to measure theesempenho de um algoritmo. Let me give you an example: I have two sorting algorithms, and I wanted to measure how much tempo, memória and etc.. each…
-
1
votes2
answers1198
viewsMake an algorithm to calculate the number of days elapsed between two dates
I have a algorítimo done in C but I decided to do in PHP. The algorítimo asks for this: It will calculate the number of days elapsed between two dates including leap years, knowing that: a) Each…
-
1
votes2
answers1405
viewsProblem with Struct in C
In that code: #include <stdio.h> #include <stdlib.h> //Usando o struct(Estruturas) struct cadastro { char nome[50]; int idade; char rua[50]; int numero; }; int main() { printf("Digite…
-
1
votes1
answer219
viewsHow to create a Christmas tree algorithm in PHP
I am making the following code, but PHP does not add and assign zero: <?php $linha = "*"; for($i = 0; $i < 6; $i++){ echo($linha)."<br>"; $linha += "*"; //aqui o php nao soma } ?> The…
-
1
votes2
answers1697
viewsAckerman function - Python
Well, I’m still learning to code in python and I came across exercise that I can’t solve. I need to write a function that solves Ackermann’s famous function. I think I will not have problems with…
-
1
votes0
answers443
views -
1
votes1
answer906
viewsHow to implement a linear regression algorithm in python?
I am running a job in college and would like to implement a function that calculates a regressão linear. Given the points and the number of exponents desired, I want to return the coefficients of…
-
1
votes1
answer77
viewsProgram does not execute expected flow
After the "Hello, my name eh Locao......" for me, in logic, I should continue, and if the user wrote 'talk' he would say "Oh, so Voce wants to talk?!". But at that moment it stops, just doesn’t…
-
1
votes1
answer84
views -
1
votes1
answer108
viewsAlgorithm for sorting the elements of a data set
"A team needs to write an algorithm that sorts the elements of a data set, from a certain criterion defined by the function. Knowing that the data set does not have more than 100 elements and that…
-
1
votes1
answer721
viewsHow to generate a matrix of 3 columns where for each column there are 3 different possibilities?
The problem is as follows: In a vector I have 3 sets (A, B and C). Each set can have up to 3 distinct values(0, 1 or 2). This way I need to generate all possible combinations for this case, with…
-
1
votes1
answer3034
viewsAdding up positives in a range using only while
I need to write a program using loop (while) that receives two numbers as input, can be positive or negative and not necessarily in ascending order, and the program must print the sum of all…
-
1
votes4
answers2467
viewsAlgorithm for calculating verifier digit
Create an algorithm to request a five digit code (COD), and generate the digit (DIGV) checker module 7 for the said code. Assuming that the five digits of the code are ABCDE, one way to calculate…
algorithmasked 8 years, 8 months ago Júlio César 137 -
1
votes1
answer646
viewsCharacter Alignment
I wish someone could tell me how do I get the numbers to line up that way with the words in the top index, I’m making a replica of that example for a college job, but I can’t get the numbers to line…
-
1
votes1
answer5079
viewsHow to merge an array?
I am writing a program that merges the values of two arrays, with the same amount of values. The program receives as input amount of values in each array. It then takes the values and at the end…
-
1
votes1
answer620
viewsIs it possible to execute multiple queries in a single run?
I needed some data from a database in mysql. However, the data were in different tables, so the most obvious solution was to filter using relational tables, with the respective indexes. But I don’t…
-
1
votes1
answer693
viewsHow to create an undetermined algorithm using visualg?
I need to create an algorithm that returns me different values each time it is executed, even receiving the same input values. It aims to solve a question where I need to analyze the generation of a…
-
1
votes0
answers152
viewsWhat is the Minimax method?
The Wikipedia defines Minimax as: In decision theory, Minimax (or minmax) is a method for minimizing the maximum possible loss. It can be considered as the maximization of the minimum gain…
algorithmasked 8 years, 9 months ago user28595 -
1
votes1
answer148
viewsJavascript script help Syntaxerror: Missing ; before statement
Good evening, I’m having trouble making if/Else if/Else conditions in javascript, in the js course of Codecademy works, but when I try to make some algorithms in the sublime using the conditional,…
-
1
votes1
answer199
viewsHow to provide a specific amount of strings to be tested?
I can test whether a user-provided string is a palindrome or not (word or phrase that can be read backwards by ignoring upper and lower case spaces and letters such as: Help me get on the bus in…
-
1
votes4
answers12868
viewsHow to print multiples of N in a range?
The program must receive as input three values N, A, and B, and must print the multiples of N contained in the interval between A and B. I am doing it as follows, but it is going wrong: N =…
-
1
votes1
answer1032
viewsTest output value to check if it is INTEGER
I set the function below to check if the output value is integer or real. funcao menu_8():inteiro var logaritmo :real inicio para contador de 0 ate 12 faca logaritmo <- ((log(i[contador])) /…
-
1
votes1
answer245
viewsDatabase in Tupla
I need a code that receives data (values) and prints them according to your key. Each entry corresponds to a given of a hypothetical person, which contains Age, Name, Sex, Marital Status, Number of…
-
1
votes2
answers104
viewsProblems with extensive algorithm
I don’t know what to do, I think I made a mistake I don’t know. In my program the user must think of a number, and the computer must try to guess which number the user thought. The computer may ask…
-
1
votes1
answer981
viewsDoubt about how to fill two-dimensional array in Java
I’m doing an exercise and I need help. That’s the statement: Calculate average temperatures for each month. For this, create a list containing the names of each month in the rows, and the number of…
-
1
votes2
answers696
viewsCalculate the smallest element of a list
Given a sequence of integers (read via Scanner), determine the lower of these values. My code: import java.util.Scanner; public class MenorValorSequencia { public static void main (String args []) {…
-
1
votes2
answers87
viewsWhy is this code not generating the average correctly?
#include <stdio.h> #include <stdlib.h> float media(int n, float* v){ int i; float s; s = 0; for(i=0;i<n;i++){ s += v[i]; return s/n;} } float variancia(int n, float* v, float m){ int…
-
1
votes2
answers160
viewsPHP algorithm 1,2,3,4 = 1 + 2, 2 + 3, 3 + 4
For example, I have this array: $Ids = array(1, 2, 3, 4); Below is the result I would like to get: $Pair [0] = 1 + 2; $Pair [1] = 2 + 3; $Pair [2] = 3 + 4;…
-
1
votes1
answer331
viewsSubtract from a number the values to your right in a list
I have a situation that is as follows: given an array with for example 5 positions [5, 10, 8, 2, 7] I need an algorithm that allows me to do the following: Take the 5 and subtract by the numbers…
-
1
votes0
answers115
viewsHow to detect fraud through a text field?
I must make a program of hiring simple services with evaluation of the service after completed and deal with fraud in this hiring. Fraud in this case would be a server that create multiple profiles…
-
1
votes2
answers285
viewsWhere to use accumulators in a unique peer-review algorithm?
Where should I fit the accumulators of this code I have written for now? #include <stdio.h> int main() { int N; int somapar; int somaimpar; do{ printf("\n Digite um número qualquer: ");…
-
1
votes1
answer100
views -
1
votes2
answers1475
viewsFind the largest palindrome made from the product of two 3-digit numbers - Python
I’m having a problem. I’m creating a Python algorithm to find the largest palindrome made from the product of two 3-digit numbers. Code: i = 0 while i <= 999: temp = str(i * 999) tempInverso =…
-
1
votes1
answer3156
viewsdoubt Array.push() Javascript
Hello! Could anyone tell me why the push method is only saving the last item in the array newArr? My goal is to extract an array with the permutation of past and console.log() it comes out right,…
-
1
votes1
answer4088
viewsHow does the DES algorithm work?
I am in doubt about how the Data Encryption Standard works, someone could explain in a didactic way?
-
1
votes1
answer150
views -
1
votes2
answers166
viewshelp with indentation that is generating error in python 3.6
I’m doing a webcrawler I’m having the following problem. I had to do a separate program to print out how many candidates passed each course. Only that the last line is not running, and it would make…
-
1
votes1
answer281
viewsApplication of algorithms in POO
The programming algorithm/logic is geared towards structured programming. How would it apply algorithm in POO?
-
1
votes1
answer1518
viewsList (static) operations c++
Good afternoon guys, I’m having a hard time understanding the operations in Statist lists, I know create and display, but how do I remove and search within the list, the sorting algorithms I’ve…
-
1
votes1
answer154
viewsInsert node into binary tree
How to insert a node into a binary tree? It always gives segmentation error when the code enters if (arv == NULL) struct no { int info; struct no *esq; struct no *dir; }; typedef struct no node;…
-
1
votes1
answer236
viewsHow to make a MDC algorithm with just sum and subtraction?
How do I make an algorithm that calculates the MDC of two numbers only using sum and subtraction operations? It is prohibited to use operators other than those requested.
-
1
votes0
answers367
viewsPhp script to know how many possible combinations it is possible to have
I would like to create a simple script, just to know number of possible combinations. It would not be to see the list of combinations, but only how many digits you can have, and the numbers and…
-
1
votes3
answers13060
viewsHow to add all the numbers in the sequence in while?
How to add 1 to 64 in while? I wanted to add up 1+2+3+4+...+64 print the sum value when arriving at the end. What I’ve tried so far: #include <stdlib.h> #include <stdio.h> int main(void)…
-
1
votes2
answers608
viewsCan anyone help me with this?
5) Make a program that receives the basic salary of an employee, calculate and show your salary to receive, knowing that the employee has bonus of R $ 50 and pays tax 10% #include <stdio.h>…
-
1
votes1
answer425
viewsHow to calculate the year from the number of days?
Without using any library, and ignoring little scientific facts about the rotation of the earth. The function receives the number of days and must determine how many years have passed judging the…