Click here to Skip to main content
15,905,229 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: How to generate a grid where nodes have certain number of neighbors on average Pin
Meanwhale9-Apr-20 19:46
Meanwhale9-Apr-20 19:46 
GeneralRe: How to generate a grid where nodes have certain number of neighbors on average Pin
Meanwhale9-Apr-20 19:53
Meanwhale9-Apr-20 19:53 
Question>net Pin
Member 147935355-Apr-20 19:51
Member 147935355-Apr-20 19:51 
AnswerRe: >net Pin
Richard MacCutchan5-Apr-20 21:31
mveRichard MacCutchan5-Apr-20 21:31 
QuestionLooking for an optimized algorithm to create a nested dictionaries and dump the same into yam format Pin
Member 120989893-Apr-20 9:25
Member 120989893-Apr-20 9:25 
AnswerRe: Looking for an optimized algorithm to create a nested dictionaries and dump the same into yam format Pin
Richard MacCutchan3-Apr-20 21:55
mveRichard MacCutchan3-Apr-20 21:55 
QuestionString reversal algorithm Pin
Pita3227-Mar-20 13:36
Pita3227-Mar-20 13:36 
AnswerRe: String reversal algorithm Pin
k505427-Mar-20 14:26
mvek505427-Mar-20 14:26 
Something like:
let pos1 = first_of(str)
let pos2 = last_of(str)

while ( pos1 < pos2 )
do
   while ( isdigit(str[pos1]) AND pos1 < pos2 )
   do
       incr pos1
   done

   while ( isdigit(str[pos2]) and pos1 < pos2 )
   do
       decr pos2
   done

   # having got here, we know that either
   # pos1 and pos2 are non-digits, so we can swap them
   # or pos2 < pos1, which means we are done (while loop will terminate)

   if ( pos1 < pos2)
   then
       swap(str[pos1], str[pos2])
       incr pos1
       decr pos2
   endif
done
Keep Calm and Carry On

RantRe: String reversal algorithm Pin
Richard Deeming31-Mar-20 1:14
mveRichard Deeming31-Mar-20 1:14 
GeneralRe: String reversal algorithm Pin
Richard MacCutchan31-Mar-20 2:32
mveRichard MacCutchan31-Mar-20 2:32 
GeneralRe: String reversal algorithm Pin
Member 147935355-Apr-20 19:52
Member 147935355-Apr-20 19:52 
QuestionTravelling Salesman Problem Pin
wscwt0118-Mar-20 7:39
wscwt0118-Mar-20 7:39 
AnswerRe: Travelling Salesman Problem Pin
k505418-Mar-20 8:48
mvek505418-Mar-20 8:48 
GeneralRe: Travelling Salesman Problem Pin
wscwt0118-Mar-20 11:12
wscwt0118-Mar-20 11:12 
GeneralRe: Travelling Salesman Problem Pin
Member 147935355-Apr-20 19:53
Member 147935355-Apr-20 19:53 
AnswerRe: Travelling Salesman Problem Pin
Greg Utas18-Mar-20 9:28
professionalGreg Utas18-Mar-20 9:28 
GeneralRe: Travelling Salesman Problem Pin
wscwt0118-Mar-20 11:11
wscwt0118-Mar-20 11:11 
QuestionVehicle routing problem for large graph Pin
Member 147325527-Mar-20 12:23
Member 147325527-Mar-20 12:23 
GeneralRe: Vehicle routing problem for large graph Pin
harold aptroot7-Mar-20 13:35
harold aptroot7-Mar-20 13:35 
GeneralRe: Vehicle routing problem for large graph Pin
Member 147325528-Mar-20 0:51
Member 147325528-Mar-20 0:51 
GeneralRe: Vehicle routing problem for large graph Pin
harold aptroot8-Mar-20 4:28
harold aptroot8-Mar-20 4:28 
GeneralRe: Vehicle routing problem for large graph Pin
Member 147325528-Mar-20 6:41
Member 147325528-Mar-20 6:41 
GeneralRe: Vehicle routing problem for large graph Pin
harold aptroot8-Mar-20 7:48
harold aptroot8-Mar-20 7:48 
GeneralRe: Vehicle routing problem for large graph Pin
Member 147325528-Mar-20 8:07
Member 147325528-Mar-20 8:07 
AnswerRe: Vehicle routing problem for large graph Pin
Hailu Worku Obsse17-Mar-20 20:15
professionalHailu Worku Obsse17-Mar-20 20:15 

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.