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
-
-3
votes4
answers201
viewsHow to reduce Python code 3?
a simple algorithm to read an X integer and print the next 6 odd ones (including the odd X) X = int(input()) if X % 2 == 1: print(X) X+=2 for i in range(5): if X % 2 == 1: print(X) X+=2 else: X+=1…
-
-3
votes1
answer167
viewsShow F(n) of the Algorithm sequence of Fibonacci
I need to know the last term of the Fibonacci sequence, I’ve done it to show all the terms, but I need you to show me the last I’m using the Visualg Algoritmo "Fibonacci" Var v1, v2, v3, limite,…
-
-3
votes0
answers36
viewsMachine Learning Usage Tip to Rank Small Phrases
I have a script that gives me 3 short sentences (about 20 words) in English to sort. I’ve never done it before, but I thought a machine learning algorithm could learn how to classify these 3…
python algorithm machine-learning artificial-intelligence machine-learningasked 3 years, 7 months ago thecuriousironman 1 -
-3
votes1
answer86
viewsCan anyone identify the error in this code?
Guys I’m sorry for the kinds of questions I’m starting #include <iostream> using namespace std; int main(){ //essa parte até o "for(Nm1==Fim)" o geany encontrou erro string Nm1; float PrC=0,…
-
-3
votes2
answers136
viewsWin function in Tic-tac-toe - Python
Hello! Facing the construction of an old game in Python, I’m doing a victory function, which will alert which of the players won the match. Below is the game algorithm under construction: def…
-
-3
votes2
answers157
viewsHow to optimize this code?
A music loop is an excerpt of music that has been composed to repeat continuously (i.e., the excerpt starts again every time it reaches the end). Loops can be scanned for example using PCM. PCM,…
-
-4
votes1
answer804
viewsCount amount of "holes" in the letters of a text
I need to write a program in Python that counts the amount of "holes" in a string. Imagine, for example, that the letters "A", "D", "O", "P", "R" have only one hole. Similarly, the letter "B" has…
-
-4
votes1
answer523
viewsHow to know how many numbers there are from x to y?
For example from 0 to 60. Obviously I know how many numbers there are, but what I know is how to make my algorithm figure that out mathematically.
-
-4
votes2
answers96
viewsWhat is the mistake in logic?
Given the values of x real and n natural positive, calculate: #include <stdio.h> int main(){ float x = 0.0; int n = 0; int soma = 0; int fat = 1; printf("Digite um valor:"); scanf("%f",…
-
-4
votes2
answers53
viewsDoubts about an algorithm problem
I do not understand what the question asks to do, someone can give me a light?…
-
-4
votes1
answer94
viewsJava List Algorithm - Remove music from playlist
I need to create a java playlist algorithm that removes music from a playlist, I already have the forward, back, random and play buttons; I need to remove music from the playlist with a playlist…
-
-4
votes2
answers132
viewsI need the replay to stop when I type "F"
#include<stdio.h> main() { int O,i; float F,VI=0,VF=0; printf("Valor Inicial:"); scanf("%f",&VI); printf("Valor Final:"); scanf("%f",&VF); while (VI!=F) { if(VI<=VF) O=1; else O=-1;…
-
-4
votes2
answers112
viewsWill someone please explain to me how I get to this algorithm?
public class Binary { public static void main(String[] args) { // Print binary representation of n. int n = Integer.parseInt(args[0]); int power = 1; while (power <= n/2) power *= 2; // Now power…
-
-4
votes2
answers59
viewsHow to ensure that three conditions are met? Is there a better way to do it?
Program that asks a person’s age, weight and height and decides if they are fit to join the army. To enter, it is necessary to age, weigh more or equal 60 kg and measure more or equal 1,70 meters.…
-
-4
votes3
answers748
viewsURI 1021 gives 5% error
Read a floating point value to two decimal places. This value represents a monetary value. Then calculate the fewest possible banknotes and coins in which the value can be broken down. The banknotes…
-
-4
votes1
answer658
views -
-4
votes2
answers159
viewsHow do I repeat an algorithm in Python?
I’m starting to study programming and I’m making a simple Python calculator in Pycharm, and I wanted to know how to repeat an algorithm when the user decides to continue using the calculator. I…
-
-4
votes1
answer152
viewsHow to verify and print repeating values in an algorithm vector
Create an algorithm that given a sequence of n real numbers, determine the numbers that make up the sequence and the number of times each of them occurs in it. Example: n = 8 Sequel: -1.7, 3.0, 0.0,…
-
-5
votes1
answer1367
viewsHow to elaborate an algorithm that writes the odd numbers between 100 and 200?
I’m stuck on this question I saw in a PDF of programming logic, how can I fix this? Develop an algorithm that generates and writes the odd numbers of the numbers read between 100 and 200.…
-
-5
votes1
answer503
viewsCreate a numerical sequence by storing in Arraylist
I need to develop a Java algorithm that returns the following sequence: 9, 16, 25, 36, 49... I’ve identified that the pattern is as follows: 9 = 3² 16 = 4² 25 = 5² 36 = 6² Values need to be stored…
-
-5
votes1
answer530
viewsAlgorithm to identify bass and treble sounds of songs
Hello. I’d like to know if anyone’s been able to make a code that identifies music beats. For example a Bass sound of electronic songs. I say this because I wanted to make a game that it generates…
-
-5
votes1
answer5325
viewsValidate agency DV and federal savings account
I could not find any documentation that says which account should be made to validate the DV of the federal savings bank, someone knows which account should be made or where I find this information?…
algorithmasked 6 years, 4 months ago PauloHDSousa 3,509 -
-5
votes1
answer84
viewsCritography in Python
I just entered the programming area and my college ended up applying a work that we will have to create a program in Python that can perform encryption/ decryption of any message, encrypted or not.…