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
8 views
Can someone explain this Miller-Rabin Primality test pseudo-code in simple terms?
Here it is...
Input: n > 3, an odd integer to be tested for primality;
Input: k, a parameter that determines the accuracy of the test
Output: composite if n is composite, otherwise probably prime
...
-1
votes
1answer
45 views
How to sort a number sequence that wraps around
I have a sequence of objects, that each have a sequence number that goes from 0 to ushort.MaxValue (0-65535). I have at max about 10 000 items in my sequence, so there should not be any duplicates, ...
0
votes
1answer
31 views
Hash table ,Open addressing Unsuccessful lookup
hi i am working on hash tables these days , i am now doing a past exam paper question on open addressing , but i could not resolve it , i tried so hard by reading tutorials but nothing helped ,
...
0
votes
1answer
26 views
Detect if point within current view area?
i want to check if the current view area contains Point(x,y).
My input for this case is :
1) Point (lat, lng)
2) Current view (minLatitude, minLongitude, maxLatitude, maxLongitude)
Any java lib ...
-1
votes
0answers
54 views
Finding longest arithmetic sequence of numbers [closed]
I encountered this problem while looking for Interview Questions.
http://www.careercup.com/question?id=16436689
I have read Longest Increasing sub sequence problem which can be solved using DP. I ...
0
votes
1answer
30 views
What is the best way to master algorithms? [closed]
I am a beginner, and can only solve a few questions (1-2) from the 5 question sets given by codeforces. I wanted to know if there is any website that makes you learn all the types of algo with ...
-6
votes
0answers
53 views
unsigned long long: A particular function [closed]
unsigned function( unsigned n , unsigned long long p , unsigned long long q )
{
unsigned result;
/*statements*/
return result;
}
I'm trying to work with the code above to produce an ...
0
votes
3answers
37 views
Bresenham's line algorithm. Does exist ncurses output for file?
I have homework, ASCII line plot drawer. I must print graph into to file. All algoritms of Bresenham's line algoritm have function SetPixel ( x, y ); in loops. This function must print pixel by x and ...
2
votes
2answers
41 views
Why is insertion sort Θ(n^2) in the average case?
Insertion sort has a runtime that is Ω(n) (when the input is sorted) and O(n2) (when the input is reverse sorted). On average, it runs in Θ(n2) time.
Why is this? Why isn't the average ...
4
votes
2answers
131 views
Open a lock with the least number of moves
Consider a lock, made of a system of wheels. Each wheel has 26 letters of the alphabet, in order, and each wheel is initialized with 'a'. If you move one wheel up, the display for that wheel moves to ...
0
votes
2answers
34 views
Graham scan c++ won't work
My code for the graham scan is not working, it is supposed to get the perimeter of the convex hull. It gets the input of n points, which can have decimals. The algorithm returns a value higher than ...
0
votes
2answers
24 views
Constraint Satisfaction with Uncertainty
I'm trying to solve a problem in which the satisfaction of constraints cannot always be verified. I can find lots of papers on flexible constraint satisfaction, but that's not quite what I want. ...
1
vote
1answer
17 views
Building a partial data downloader / caching mechanism
I'm trying to write a .NET/MS SQL application that will download daily weather data from a web service and I'd like to store/cache that data in the local database.
The way it's going to be used is:
...
1
vote
2answers
83 views
List of Numbers - How to Efficiently Find Largest Less Than or Equal to N [duplicate]
Say I have a fixed set of numbers that happens to be sorted:
static readonly int[] numbers = new int {
1, 200, 204, 228, 298, 300, 331, 332, ... 2983
};
How would I efficiently find the largest ...
-5
votes
1answer
46 views
UVa 10656- Maximum Sum(||) [closed]
I get Presentation Error for This Problem
But why is that?
It should take the number of integers in a sequence and then the integers then it outputs the integers making the maximum sum.
Here is my ...