Questions tagged as 'algoritmos'

2
answers

what is the difference between a class and a structure

I can see that in some languages like swift there are both, however, I do not understand very well what the difference is. I am learning the language and it is very important to learn everything you have.     
asked by 23.06.2018 / 05:30
1
answer

Problem with Ruby algorithm

I have a list of numbers generated by a division: #encoding:UTF-8 a = Array(1 .. 100) a.each do |number| b = number / 2.0 puts "El resultado de #{number} entre 2 es: #{b}" end And this is the result, just as I wanted: El resultado d...
asked by 15.03.2018 / 04:03
1
answer

c ++ problem with operator overload [duplicate]

I try to make a simple sum of two objects and I skip error took time trying to solve it.    Complejo.cpp #include "Complejo.h" Complejo::Complejo(double real, double complejo) { this->real = real; this->complejo = complejo...
asked by 01.03.2018 / 06:56
1
answer

How can I implement this pseudocode in java?

Good day for everyone I hope you are very well. My question is this, I am trying to implement this pseudocodigo in java programming language: But the truth is I'm very new to issues of using recursion, I've tried in many ways but I r...
asked by 30.11.2017 / 14:48
2
answers

Error in sorting by selection in java

I'm doing an exercise with sort ordering algorithm ascending, however when I execute it orders only the index 0 of the vector and I repeat this same value for the index 1 of the vector, and the other value is lost, the I have actually looked at...
asked by 22.11.2017 / 17:45
2
answers

Store a multidimensional array in a variable without knowing how many rows it will get (Javascript)

reviewing one of the freecodecamp algorithms in which we work with javascript I have the following code: function largestOfFour(arr) { var largestNumber = [0,0,0,0]; for(var arrayIndex = 0; arrayIndex < arr.length; arrayIndex++) { for(va...
asked by 07.11.2017 / 11:47
1
answer

Java: Array is read or miswritten from a file

I would like to solve a problem of getting all the possible combinations for several people to cross a path, so that two nodes can not be visited by several people. The ideal case would be to store the elements in a list but when using recurs...
asked by 05.06.2016 / 13:07
1
answer

search for data from one table to another and print

Good to everyone, I have two lists that I call from a database of different tables: listat = personNE.list(); listah = historicot2NE.list(); int inter1 = listat.size(); // 81 datos int inter2 = listah.size(); // 18 datos...
asked by 23.11.2018 / 18:21
1
answer

Algorithm Non-deterministic For a problem

Given a set A of integers and an integer s, the exact sum problem consists of in determining if there exists a subset B ⊆ A such that the elements of B add s. I need to write a non-deterministic polynomial algorithm for this problem. Do this...
asked by 15.11.2018 / 19:19
0
answers

Find a cycle of 'n' nodes using DFS

I have a function with the following header: def DFS(G,s,n): G: Graph to walk. s: Node source or parent node. n: Number of nodes for the cycle. Input: We will pass to the function a graph G, a node 's' from where our dfs search wil...
asked by 24.10.2018 / 17:03