Questions tagged as 'algoritmo'

2
answers

Algorithm in C - Prime numbers

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...
asked by 16.04.2015 / 22:48
1
answer

How to stop a loop using the input provided by the user?

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...
asked by 17.04.2016 / 15:27
1
answer

Doubt in the complexity analysis of an algorithm

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...
asked by 08.09.2014 / 16:49
1
answer

Quicksort vs Radix-sort

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...
asked by 10.08.2018 / 14:37
1
answer

How is the basic operation of the algorithm A *?

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...
asked by 07.09.2018 / 07:30
1
answer

When and where to use the terms: time complexity, space complexity?

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...
asked by 14.09.2018 / 03:37
1
answer

Do irreversible operations exist? [closed]

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."...
asked by 17.05.2018 / 19:41
1
answer

Select period between times

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...
asked by 06.03.2018 / 00:37
1
answer

Find position in an array through the position in the array?

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 -------------...
asked by 03.10.2018 / 18:01
1
answer

Convert lambda java predicates

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...
asked by 27.12.2017 / 01:16