Click here to Skip to main content
15,893,266 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: Spell-checker for names Pin
Luc Pattyn10-May-09 10:44
sitebuilderLuc Pattyn10-May-09 10:44 
AnswerRe: Spell-checker for names Pin
Henry Minute10-May-09 6:52
Henry Minute10-May-09 6:52 
AnswerRe: Spell-checker for names Pin
Pete O'Hanlon26-May-09 2:23
mvePete O'Hanlon26-May-09 2:23 
Questionpumping lema and regular languages Pin
Sadaiyappan8-May-09 6:39
Sadaiyappan8-May-09 6:39 
AnswerRe: pumping lema and regular languages Pin
Luc Pattyn8-May-09 6:51
sitebuilderLuc Pattyn8-May-09 6:51 
AnswerRe: pumping lema and regular languages Pin
Alan Balkany11-May-09 3:35
Alan Balkany11-May-09 3:35 
QuestionAlgorithm to sort list Pin
TheConfusedGuy7-May-09 11:27
TheConfusedGuy7-May-09 11:27 
AnswerRe: Algorithm to sort list Pin
harold aptroot7-May-09 12:24
harold aptroot7-May-09 12:24 
If I understand you correctly, the data means something like this:
|--------------------------| 25
   |------------| 15
      |----| 10
                |-------| 20

And the lowest value on a vertical line would be the maximum allowed speed at that point.
Then you want to somehow split the ranges and drop the parts that are not the minimum.
Cut:
|--|--|----|------|-------|---| 25
   |--|----|------| 15
      |----| 10
                  |-------| 20

Drop:
|--|                      |---| 25
   |--|    |------| 15
      |----| 10
                  |-------| 20

There is of course an efficient way to do this, but I'm having trouble defining it exactly.
What I can define exactly, is a far less elegant way..
int[] speed = new int[first.high - first.low];
for each section s
{
   for (int i = s.low; i < s.high; i++)
       speed[i] = min(speed[i], s.speed);
}

You can extract the result from this array in O(size-of-longest-section) time.
Being O(|sections| * size-of-longest-section), this algorithm sucks. But hey, it works.
I'm going to think about this some more, I hope I can accurately define splitting the sections.. Removing the not-minimum cuts after that, is nearly trivial.



AnswerRe: Algorithm to sort list Pin
Luc Pattyn7-May-09 12:56
sitebuilderLuc Pattyn7-May-09 12:56 
AnswerRe: Algorithm to sort list Pin
Luc Pattyn7-May-09 13:55
sitebuilderLuc Pattyn7-May-09 13:55 
AnswerRe: Algorithm to sort list [modified] Pin
dybs7-May-09 17:55
dybs7-May-09 17:55 
GeneralRe: Algorithm to sort list (Reply to All) Pin
TheConfusedGuy7-May-09 18:27
TheConfusedGuy7-May-09 18:27 
GeneralRe: Algorithm to sort list (Reply to All) Pin
dybs7-May-09 19:01
dybs7-May-09 19:01 
GeneralRe: Algorithm to sort list (Reply to All) Pin
TheConfusedGuy7-May-09 19:07
TheConfusedGuy7-May-09 19:07 
Questionbearing angle calculation Pin
ranjanguru6-May-09 22:45
ranjanguru6-May-09 22:45 
AnswerRe: bearing angle calculation Pin
molesworth6-May-09 23:38
molesworth6-May-09 23:38 
GeneralRe: bearing angle calculation Pin
ranjanguru6-May-09 23:48
ranjanguru6-May-09 23:48 
GeneralRe: bearing angle calculation Pin
molesworth7-May-09 0:06
molesworth7-May-09 0:06 
GeneralRe: bearing angle calculation Pin
molesworth8-May-09 3:13
molesworth8-May-09 3:13 
AnswerRe: bearing angle calculation Pin
OriginalGriff6-May-09 23:52
mveOriginalGriff6-May-09 23:52 
GeneralRe: bearing angle calculation Pin
ranjanguru6-May-09 23:57
ranjanguru6-May-09 23:57 
AnswerRe: bearing angle calculation Pin
Stuart Cox7-May-09 11:01
Stuart Cox7-May-09 11:01 
AnswerRe: bearing angle calculation Pin
cp98768-May-09 15:30
cp98768-May-09 15:30 
QuestionPolygon Rendering Performance Optimization Pin
StarBP6-May-09 11:27
StarBP6-May-09 11:27 
QuestionWhich language is this Urgent help required Pin
Sanjaykalsi5-May-09 22:55
Sanjaykalsi5-May-09 22:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.