The program has to perform a prime number check, where the user enters a number and the program finds the largest prime number prior to it. the problem with my program is that it does not verify until the end, for example, if I write 10, I shoul...
I am writing a program that receives entries and creates a dictionary from them. I need the loop that I use to insert the entries in the dictionary to be broken when the entry is "9999", but it is not working. I'm doing this: dic = dict ()
dic...
I need to know how to calculate the complexity of this algorithm using the recurrence equation.
public int qdr(int x, int n) {
if(n == 0)
return 1;
else
return x * qdr(x, n-1);
}
It is a recursive algorithm that reads tw...
I'd like to know why Quicksort is more fuzzy than Radix-sort . Since the quicksort uses as a basis for the sort order and radix-sort the second can not be faster than O < in n ), and in fact it is mn where m is the number of bits use...
I'm reading about the A * search algorithm to be able to implement it in the future. I know it is used to find a path in a graph, but I can not see very well how it is done.
However, I am having difficulty understanding certain aspects of i...
I'm using the book Data Structures: Algorithms, Complexity Analysis, and Implementations in JAVA and C / C ++ as it helps with practical examples of implementation.
In chapter 1 have the following excerpt that left me in doubt
The execu...
In mathematics (therefore in programming) there are mathematical operations (+, -, *, /). But all mathematical operations I know of are perfectly reversible, for example, by dividing a number, multiplying it, and so the operation was "reversed."...
I'm trying to set up a sql to check if there is any record between informed times, but it's not coming out, I've done some tests but I have not been successful.
For example, a bank record that contains these two times, as initial and f...
If I have an array, eg:
[1, 2, 3, 4, 5, 6, 7, 8, 9]
and I transform this array into an array, eg:
y[0] y[1] y[2]
x[0] = 1 | 2 | 3
---------------
x[1] = 4 | 5 | 6
-------------...
I'm trying to do a template transformation using java lambda. Here is a code block that exemplifies what I want to do:
public String translatePrimitivePredicate(){
Predicate<Integer> predicate = a -> a == 1;
return transl...