Click here to Skip to main content
15,885,216 members
Home / Discussions / Algorithms
   

Algorithms

 
General[edit][edit]Re: Base building in a RTS based on a queue of orders Pin
Calin Negru30-Apr-23 5:23
Calin Negru30-Apr-23 5:23 
GeneralRe: [edit][edit]Re: Base building in a RTS based on a queue of orders Pin
Gerry Schmitz30-Apr-23 6:14
mveGerry Schmitz30-Apr-23 6:14 
GeneralRe: [edit][edit]Re: Base building in a RTS based on a queue of orders Pin
Calin Negru30-Apr-23 22:12
Calin Negru30-Apr-23 22:12 
GeneralRe: [edit][edit]Re: Base building in a RTS based on a queue of orders Pin
Gerry Schmitz1-May-23 0:08
mveGerry Schmitz1-May-23 0:08 
GeneralRe: [edited]Re: Base building in a RTS based on a queue of orders Pin
Calin Negru30-Apr-23 5:10
Calin Negru30-Apr-23 5:10 
GeneralRe: [edited]Re: Base building in a RTS based on a queue of orders Pin
Gerry Schmitz30-Apr-23 6:29
mveGerry Schmitz30-Apr-23 6:29 
QuestionEfficiently finding position in sorted list Pin
Robert Ellis26-Mar-23 13:52
Robert Ellis26-Mar-23 13:52 
AnswerRe: Efficiently finding position in sorted list Pin
Mircea Neacsu26-Mar-23 14:42
Mircea Neacsu26-Mar-23 14:42 
Hmm, if I understand correctly, we have a list of Q positions where each one has a specific range say:
1 - [m_1, u_1]
2 - [m_2, u_2]
...
q - [m_q, u_q]
where m_1 to m_q are the minimum values and u_1 to u_q are the maximum (upper) values. A valid arrangement (I wouldn't call it a permutation) V = [v_1, v_2, ... v_q] can be "normalized" by subtracting the vector M = [m_1, m_2, ..., m_q] of minimum values. Let N = V-M be the normalized vector and R = U-M be the vector of ranges. Note that n_i < r_i.

I will change your problem to set the least significant position to be position 1 just for ease of notation. Then position of V in the list of arrangements is given by the sum:
S = n_1 + n_2*r_1+n3*r_1*r_2 + ...n_q * r_1*r_2*...*r_q-1

This is a bit like expressing a number in a "variable" base. The number of "digits" available at position i is r_i.
Mircea

QuestionDijkstra Pin
Calin Negru13-Dec-22 7:46
Calin Negru13-Dec-22 7:46 
AnswerRe: Dijkstra Pin
jschell13-Dec-22 10:39
jschell13-Dec-22 10:39 
GeneralRe: Dijkstra Pin
Calin Negru13-Dec-22 22:34
Calin Negru13-Dec-22 22:34 
GeneralRe: Dijkstra Pin
jschell20-Dec-22 13:21
jschell20-Dec-22 13:21 
GeneralRe: Dijkstra Pin
Calin Negru26-Dec-22 9:26
Calin Negru26-Dec-22 9:26 
GeneralRe: Dijkstra Pin
jschell29-Dec-22 11:20
jschell29-Dec-22 11:20 
GeneralRe: Dijkstra Pin
Calin Negru30-Dec-22 8:56
Calin Negru30-Dec-22 8:56 
GeneralRe: Dijkstra Pin
harold aptroot2-Jan-23 6:45
harold aptroot2-Jan-23 6:45 
AnswerRe: Dijkstra Pin
Eddy Vluggen2-Jan-23 10:48
professionalEddy Vluggen2-Jan-23 10:48 
GeneralRe: Dijkstra Pin
Graeme_Grant2-Jan-23 11:41
mvaGraeme_Grant2-Jan-23 11:41 
QuestionRe: Dijkstra Pin
Eddy Vluggen2-Jan-23 11:59
professionalEddy Vluggen2-Jan-23 11:59 
AnswerRe: Dijkstra Pin
Graeme_Grant2-Jan-23 12:16
mvaGraeme_Grant2-Jan-23 12:16 
NewsRe: Dijkstra Pin
Eddy Vluggen2-Jan-23 12:27
professionalEddy Vluggen2-Jan-23 12:27 
GeneralRe: Dijkstra Pin
Calin Negru3-Jan-23 0:19
Calin Negru3-Jan-23 0:19 
GeneralRe: Dijkstra Pin
Eddy Vluggen3-Jan-23 0:25
professionalEddy Vluggen3-Jan-23 0:25 
GeneralRe: Dijkstra Pin
Calin Negru3-Jan-23 3:37
Calin Negru3-Jan-23 3:37 
GeneralRe: Dijkstra Pin
Calin Negru14-Jan-23 8:47
Calin Negru14-Jan-23 8:47 

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.