Questions tagged as 'algoritmo'

2
answers

Undefined infinite loop no while

I made a program to calculate within a sequence the sum of the positive numbers and the sum of the negative numbers. When I use the command while , the idea is to be within a sequence of 7 numbers, and then the program exits from while...
asked by 05.10.2017 / 03:59
1
answer

MergeSort, logic problem

Gentlemen, I'm having a problem with my MergeSort sorting algorithm, I feel the problem is in logic. Merge Code: static void mergesort(int[] x,int inicio,int fim){ if(inicio<fim){ int meio; meio=((inicio+f...
asked by 04.11.2017 / 03:37
1
answer

How to calculate the use of a football team in a championship?

I want to do a calculation of average use of a football team in a certain championship, for example, my team played two matches and won one. He would have 3 points from 6 points and a 50% advantage. public final class Time { private String...
asked by 11.08.2017 / 00:02
1
answer

What is the best way to work with queues in java?

In what scenarios is a queue necessary? What is the advantage of using this algorithm?     
asked by 09.11.2017 / 15:11
1
answer

Backtracking in Python

I'm trying to find a subset, of size M, of binary strings of length n, where any string has a distance greater than 2 for any other string in the subset. Where the distance between two strings is the number of positions where they differ. For...
asked by 24.02.2017 / 21:09
1
answer

How to store vector values?

I am a beginner in C and I am 2 days into this exercise, I was able to do it so that if you increase the vector with the realloc function, it will increase everything right, but I need it to save the values you typed . For example, I w...
asked by 25.06.2017 / 14:13
2
answers

Recursive Algorithm does not work

I have to solve an exercise, and it says:    Do a procedure that receives an integer n positive number. O   procedure should print all numbers in the range between 0 and n   which are divisible by 2 and 3 (simultaneously). I'm starting at...
asked by 08.10.2017 / 18:55
1
answer

How to calculate proof notes?

I am writing a code that prints a student's grade according to the number of questions he hits. But I need the program to do the calculation in a specific amount of times. The program should receive the number of questions in the test, the feedb...
asked by 04.04.2016 / 21:36
1
answer

Partial sum of elements of a vector in O (n) or O (log n)

I have a vector A of size n. I have to calculate the partial sum of each element and write in matrix B [i, j]. The pseudo-code shows a solution O (n ^ 2); For i = 1, 2, . . . , n For j = i + 1, i + 2, . . . , n B[i, j] <- A[i...
asked by 20.03.2016 / 23:09
1
answer

Algorithms and programming [closed]

What do I need to learn before going to the subjects?     
asked by 31.08.2015 / 03:02