Posts by Felipe • 823 points
14 posts
-
1
votes1
answer77
viewsA: Findall using Elementtree does not return expected result
Look for the tag attribute of each element, which will have the xml namespace and tag name. Then, just check if the tag is substring Emailaddress and not Emailaddresses. If this happens, we find the…
-
7
votes2
answers1128
viewsA: What is the difference of use between Keypressed and Actionperformed?
General difference: The Actionperformed is used to handle any event that a user can perform. Examples: click a button, select a menu item or press enter on a text field. So, for example, if you add…
-
1
votes1
answer84
viewsA: Generate all possible paths
Yes. Your idea works in this case. Your code can be written like this: void Permuta(struct cidade *sequencia, int inicio, int termino) { int j; if(inicio == termino) { for (int i = 0; i < N; ++i)…
-
3
votes1
answer158
viewsA: Function with template
As you may know, the way to declare functions with templates is: template <class identificador> declaração_da_função; Then, a function that returns the highest value out of two values can be…
-
10
votes3
answers953
viewsA: How do you relate the hash which is also called the python dictionary to the encryption hash function?
The hash function, in general, is a function that takes arbitrary size data and transforms that data into a numerical alpha value. As you noticed, the hash function is used in different contexts…
-
0
votes2
answers257
viewsA: Quicksort in Java does not work
I believe that the following amendment will work properly. The biggest problem was in their comparisons (< or >) where it should be (<= or >=) and vice versa. I put some comments in the…
-
7
votes4
answers602
viewsA: How can I replace "String.isEmpty()" in Java?
Assuming Voce is on android: You can use it Textutils.isEmpty(string) String.Trim(). equals("") also works Source…
-
2
votes1
answer559
viewsQ: Is there an insertion method for binary tree search faster than trivial?
I’m trying to solve this problem in an online Judge. The problem provides N integers that must be inserted, in the given order, into an insertion algorithm of a binary search tree. After Q queries…
-
1
votes2
answers446
viewsA: In the POO when to use Re-turn?
In java every object is passed as a reference. Therefore, if Voce wants to change an object in a method, it is sufficient to pass it as a parameter and without return. In your case, the first option…
-
7
votes2
answers767
viewsQ: Path between 2 nos of a graph using smaller number of colored edges
I’m trying to solve this programming problem. In summary, the problem describes several bus lines as an undirected graph and says that a bus ticket costs 1 real. Can someone give me a hint on how I…
-
3
votes2
answers813
viewsA: Treat Arithmeticexception in another method
Try to take a divisional arithmeticexception by 0 (doubled) in Java will not work. Because, java implements the standard IEEE 754 for the double type. Therefore, instead of exception, Voce has a…
-
0
votes2
answers126
viewsA: Std::out_of_range error when using substring C++
In c++, the substr method returns an out_of_range exception if the user tries to use the method with values that are larger than the string size (See end of Reference c++ on the substr method)…
-
1
votes2
answers12386
viewsA: Problem to remove chained list element in C
Assuming by your code that the list does not admit elements with equal names... I believe this solution solves your problem. Good studies =) PLista remover(PLista p) { //lista vazia if(p == NULL){…
-
1
votes1
answer601
viewsA: How do I define the push_back function for a c++ structure?
You have only one vector of vectors (2D). Soon the correct use would be this: Df[i].push_back(Arco(u,v)); If your need is to use Df[i][j].push_back(Arco(u,v)); Then a vector vector of vector (3D)…