Tagged Questions
An algorithm is a sequence of well-defined steps that defines an abstract solution to a problem. Use this tag when your issue is related to algorithm design.
0
votes
0answers
10 views
Estimate and simulate autoregression in Matlab
I have a time series.
I need to estimate autoregression parameters and simulate the "similar" process again.
Here is my Matlab code:
nn = 40;
ps1 = pps1;
for q = 1:nn-1
pps1 = horzcat(pps1,ps1);
...
0
votes
1answer
19 views
What is fastest way to calculate factorial in common lisp?
What is fastest way to calculate factorial in Common Lisp? For start there is end-tail recursion
(defun factorial (n &optional (acc 1))
(if (<= n 1)
acc
(factorial (- n 1) (* acc n))))
...
0
votes
3answers
32 views
How to make factorial faster?
I make simple factorial program in Clojure.
(defn fac [x y]
(if (= x 1) y (recur (- x 1) (* y x)))
)
(def fact [n] (fac n 1))
How can it be done faster? If it can be done some faster way.
0
votes
3answers
51 views
Time complexity for sorting an array of binary numbers
Given the following array: | 0 | 1 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 1 |
we have to sort the above array like all 1's on the right side and 0's on left.
i have come up with 2 algorithms in C++.
1st ...
-1
votes
1answer
33 views
How to translate equation sloving in PHP?
Faced a real problem: can't solve a simple equation in php... On paper it looks simple but how to translate it in php cant think...
function discriminant($a = FALSE, $b = FALSE, $c = FALSE){
$di ...
1
vote
0answers
27 views
Pathfinding algorithm for trains
I'm trying to find a solution for pathfinding in a trains game where there are different kinds of bifurcations. I want the train to go from one rail to another, everything is implemented except the ...
-4
votes
2answers
48 views
How to search database within less time [on hold]
I have near about 10 lakh (1 lakh = 100,000, so 1 million) entries in my database table and
I need to use some logic by which I can search within minimum time,
is there any algorithms or logic by ...
-4
votes
0answers
39 views
JAVA minimax algorithm not working
making TicTacToe game, using MiniMax algorythm.
I have wrote the function which choses bestValue, but It is not working correctly.
Now computer just puts the values starting from the end of field ...
0
votes
1answer
66 views
Java Sort Array of Strings with Algorithm
So I am trying to sort an array of strings with an algorithm.
NOTE: For this assignment I am not allowed to use any of the built in sort functions.
public boolean insert(String s) {
...
1
vote
3answers
45 views
SICP exercise 1.41
Exercise 1.41. Define a procedure double that takes a procedure of one argument as
argument and returns a procedure that applies the original procedure
twice. For example, if inc is a procedure ...
-2
votes
1answer
41 views
Deriving a Recurrence from a method
Derive a recurrence T(n) which represents the time complexity of the
compareDigit method on the worst case example.
compareDigit method:
public int compareDigit(int nv, LinkedList y) {
int dx, ...
0
votes
0answers
18 views
Algorithm for motion blur and stitching images
Is there an algorithm (or algorithms) to remove motion blur from a sequence of images and then stitch the reconstructed images to form a panoramic view?
0
votes
0answers
41 views
Real-time Optimum vs. Global Optimum?
Let's consider a general case, where you have a real-time data input and you wish to manipulate the data to lower a certain cost function of the data.
Say a new data flows in every 1 second. One way ...
-1
votes
0answers
23 views
Permutation with some restrictions [on hold]
What is the number of permutation of n distincts elements numbered {1, 2,..n} when for each position we make some particular restriction ?
for example if the set is {1,2,3} and for position 1 only ...
-1
votes
0answers
27 views
Animated Kanji Letter [on hold]
I am coding a website that will teaach to users Chineese Kanji letters and japaneese alphabet. There are some stroke orders in Kanji letters. I want to make an animation for all letters. Now, there is ...