Questions tagged as 'algoritmo'

1
answer

Path 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 between nodes 3 and 10 I would need to take a...
asked by 14.10.2015 / 04:29
1
answer

Add typed values without using array

Create a program that asks the user to type 10 values, add these results and present them on the screen. I've only been able to do with an integer array. #include <stdio.h> #include <stdlib.h> int main() { int i, soma; soma...
asked by 22.07.2015 / 04:29
2
answers

Sorting does not work

I had to implement my own sort using the sort sort. However, the simple code (I analyzed several times, and for me is correct) gives strange results. template <typename T> void swap(T& var, T& var1) { T temp = var; var =...
asked by 02.05.2014 / 16:56
1
answer

Read each existing row in StringBuffer or String

I have a text with the following format: Data Valor 20140901 278 20140902 248 20140903 458 20141004 545 20141005 125 20141106 1020 20141207 249 The same is stored in an object of t...
asked by 04.10.2014 / 10:19
1
answer

Is there any way to round a negative value to zero in VisuAlg?

I would like to always display Vida: 0 in the last block, even if the value is negative, without doing this "Gambiarra" that I made just below. Is there a function that rounds vidaInimigo , without having to create an additional...
asked by 06.06.2018 / 13:07
1
answer

Error in sorting numbers

The even numbers I was able to sort, only odd numbers I can not sort. The number memory address is displayed. Link to the question: Couple and Odd ones Here's my code: #include <stdio.h> int main(int argc, char** argv) { int...
asked by 14.12.2017 / 04:00
1
answer

Api for organizing files similar to tree structure

I'm developing a meeting module, which contains schedule management, the schedules are organized as follows: 1. pauta c 1.1.pauta x 2. pauta v 2.1. pauta b 2.1.1. pauta y Each staff of this is a record in the database. I tried...
asked by 06.11.2017 / 00:30
1
answer

How to put string and variables together in Portuguese?

Hello, I'm learning Portugol for academic purposes and I'm having trouble with a code I'm doing. ButwhenIrun,itrunsuntilit'stimetoaverage.Thenhesayshedidnotfindthestudentvariable.BeautyItookthestudentanddidsoescreval("sua média é " media)...
asked by 25.10.2017 / 22:53
1
answer

Algorithm C. Why does the "why" string return and do not return numeric values?

I wrote an algorithm in C to write on the screen ordered pairs of a function, with input of x integers. int main(int argc, char *argv[]) { int x,i; x = -1; do{ system("cls"); scanf("%i",&x); if(x>10...
asked by 20.08.2017 / 22:31
1
answer

Selection Sort - Is it correct?

I have implemented a sort sort logic and would like to ask if it is correct. Because at the end of the process the result is expected, but was to do a real test and found several algorithms but none like my. Follow the code. int vetor[] = {...
asked by 12.07.2017 / 19:08