Questions tagged as 'algoritmo'

3
answers

Rotate matrix in 90º

I need to create an algorithm in C to rotate a 10x10 matrix by 90 degrees, though I can not use an auxiliary array for that. Simplifying what was asked to try to find some pattern and use it to solve the problem I used a 3x3 array and compare...
asked by 24.08.2015 / 15:53
2
answers

Search by tree depth

I would like to develop an algorithm that does the depth search in a binary tree, but I am not getting it. When we make the tree we assign to each node the cost (cost to move from one node to the other) and the heuristic (heuristic value of e...
asked by 09.06.2015 / 19:28
3
answers

Counter of a subsequence of strings repeated in C

Consider a string composed of several subsequences.    For example: cccaaaabbbbxdddddddddaaannn. The smallest substring is the letter x, with only one element; the largest subsequence is that of letter d, with 9 elements. Make an algorith...
asked by 01.11.2018 / 21:18
1
answer

Algorithm for cutting plane

I do not know if this is the best place to ask this question, but I searched a lot on the internet for some algorithm for cutting plan - which, by informing the dimensions of the pieces, shows the best arrangement so that it is minimized as litt...
asked by 04.08.2014 / 19:53
3
answers

Algorithm with structure PARA and SE

An algorithm that reads the name and gender of fifty-six people and gives the name and whether it is a man or a woman. In the end, report the total number of men and women. I need the program to run in VisualG. I made this code but it is not...
asked by 30.09.2015 / 01:47
1
answer

Why does String hashCode () in Java use 31 as a multiplier?

In Java, the hash code for an object String is computed as s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1] using integer arithmetic, where s[i] is the i -th character of the string, n is the length of the string,...
asked by 02.01.2019 / 17:54
1
answer

How to execute a loop while waiting for input?

I want to know if you can execute a loopback while waiting for an input () input, and immediately after receiving the input the for loop or while starts processing she immediately. something like: imputs = [] parar = false def faca_algo...
asked by 31.12.2016 / 13:42
1
answer

Segmentation fault: branch and bound in c

I'm having a persistent error in my code. My goal is to find the path in a maze mounted on an array with an algorithm of type branch and bound . Here is the code: FILE *ent; FILE *saida; int NL; int temp; char c; struct labirintos{ int **...
asked by 24.02.2015 / 02:52
1
answer

Precedence of operators with pointers

Having, for example, the following instructions: int i=10, j=20; int *pti, *ptj; pti = &i; ptj = &j; What is the meaning of j = pti == ptj; and i = pti || ptj; ? In addition, I've read that summing the subtraction b...
asked by 03.08.2015 / 14:46
1
answer

How does the seed influence the generation of random numbers?

The question is quite simple, I would like to know how the System.Random class generates random pseudorandom numbers from a seed, which I think is rather strange. I know they are not totally random, and so I have my doubt as to how they a...
asked by 09.04.2017 / 06:59