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.
4
votes
0answers
22 views
Design Pattern to track partial results of a complex process
I'm facing a programming problem that I don't know how to solve in a object oriented and flexible way. I have in mind some bad solutions, but I'm searching for a good one. I develop in Java, so I ...
0
votes
0answers
10 views
Artificial inteligence “ranking algorithms” open source
I wanted to ask if anyone knows any open source projects related ranking algorithms.
I am working on a recommendation system which analyzes past data, gives a certain ranking to some characteristics ...
2
votes
1answer
45 views
Is O(n) + O(n log n) equals to O(n log n)?
One code I've done follows this schema:
for (i = 0; i < N; i++){ // O(N)
//do some processing...
}
sort(array, array + N); // O(N log N)
Whats the complexity in Big-O notation?
Thanks in ...
0
votes
3answers
31 views
How can I get these java line algorithms working?
I'm trying to demonstrate Bresenham's line algorithm as opposed to a less sophisticated approach. I'm very new to programming and I'm sure my problems are elementary, but a solution and an explanation ...
0
votes
0answers
18 views
magic sequence of cards recursive algorithm
I was asked this question in an interview and I couldnt answer completely. Infact the interviewer himself was confused. Was wondering if anyone knew the clear details of the question and the answer as ...
0
votes
0answers
39 views
Perform a diff on 2 texts, using only part of each line in the texts
I have two texts.
T0 ID A
T1 ID B
T2 ID C
T4 ID D
and
T5 ID A
T6 ID E
T7 ID F
T8 ID D
I really am only interested in comparing the differences in the sequence of ID's, the letters. But I want to ...
1
vote
2answers
71 views
Our prof says for a double loop, T(n) is a*(n^2) + b*n + c. I think it's just a*(n^2). What's the exact answer?
This is the slide by our prof.
Example 4: Consider this simple program:
s = 0
for i = 1 to n do
for j = 1 to n do
s= s+i+j
endfor
endfor
T(n) = ?
It's hard to get the exact expression of ...
-4
votes
1answer
40 views
Distance of two Rectangle Center's Connecting Line Outside of the Rectangles
Well excuse me for the long title, i dont really know how to call it.
I would like you to explain me how to calculate the image's red line's length, knowing the rectangles position and dimensions.
...
3
votes
2answers
29 views
Algorithm to cover all edges given starting node
Working on an algorithm for a game I am developing with a friend and we got stuck. Currently, we have a cyclic undirected graph, and we are trying to find the quickest path from starting node S that ...
0
votes
3answers
74 views
What is wrong with this algorithm?
I was trying to solve Project Euler Problem #2 : Find the sum of the even terms of the fibonaci series upto 4,000,000. Ex : Upto 1000, the sum is 2+8+34+144+610 = 798.
Now, my algo was to add every ...
0
votes
1answer
15 views
Nearest road given latitude & longitude
I have a database which contains all the waypoints for each road in the UK.
I am trying to build a navigation app, given the users latitude & longitude it will calculate the nearest road from the ...
0
votes
5answers
109 views
Find random numbers in a given range with certain possible numbers excluded
This is an interview question. Suppose you are given a range and a few numbers in the range (exceptions). Now you need to generate a random number in the range except the given exceptions.
For ...
0
votes
0answers
47 views
Simple allocation algorithms
I have a simple case where I have a set of 10 landing pages. Similar to how google adsense works, I would like to send 70% of the traffic through the top performing landing page, some of the traffic ...
2
votes
3answers
33 views
Find the dominant cyclic substring of a given string
I am looking for an algorithm to find the dominant cyclic substring of a given string.
A cyclic substring:
a substring which is repeated two or more times adjacently.
A dominant cyclic ...
-6
votes
0answers
40 views
which of the sorting algorithms below can be parallelized? [on hold]
I want to know that whether which of the following algorithm can be parallelized?
Bubble Sort
Insertion Sort
Selection Sort
Shell Sort
Quick Sort
Merge Sort
Radix Sort
Those which can't be, please ...