Click here to Skip to main content
15,898,874 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: Graph algorithms on bitgraphs Pin
Tim Craig23-Dec-09 10:02
Tim Craig23-Dec-09 10:02 
GeneralRe: Graph algorithms on bitgraphs Pin
harold aptroot24-Jan-10 6:44
harold aptroot24-Jan-10 6:44 
AnswerRe: Speed comparison of data types [modified] Pin
harold aptroot21-Dec-09 5:30
harold aptroot21-Dec-09 5:30 
GeneralRe: Speed comparison of data types Pin
harold aptroot21-Dec-09 6:40
harold aptroot21-Dec-09 6:40 
AnswerRe: Speed comparison of data types Pin
Luc Pattyn21-Dec-09 6:37
sitebuilderLuc Pattyn21-Dec-09 6:37 
GeneralRe: Speed comparison of data types Pin
harold aptroot21-Dec-09 6:43
harold aptroot21-Dec-09 6:43 
QuestionFluid Layout By Custom Polygon Shapes Pin
Som Shekhar15-Dec-09 18:36
Som Shekhar15-Dec-09 18:36 
QuestionWhat will be the height of fluid columns in a variable width cylinder Pin
Som Shekhar15-Dec-09 7:26
Som Shekhar15-Dec-09 7:26 
Assume that there is a vertical cylinder with a diameters as follows

1cm at base
3cm at the height of 2cm
2cm at the height of 4cm
1cm at the height of 7cm
etc etc

Now, what would be the height of different colored fluid columns one over the other (Assuming there are no other forces). The columns are on top of each other and movable by drag and drop. Hence the calculation of each column depends on the bottom column.

Its not necessary to consider volumetric analysis because the solution could be in 2D for area also.

The function should take parameters of volume/area of each column at which it starts.

This is required for a graphical application where the movement of a liquid is shown in 2D.

I am looking for a faster alternative to "for" or "while" loops. It needs to be very fast so that a fluid motion could be achieved. Current algorithm is damn slow.

my current solution looks like:

while (volumeToAdjust > 0)
{
    volumeCovered = Min (volumeToAdjust, volumePossibleInCurrentWidth)

    if(volumeCovered>volumePossibleInCurrentWidth)
        height += heightForCurrentWidth
    else
        height += CalculateHeightForThisVolumeInCurrentWidth

    volumeToAdjust -= volumeCovered

}



This solution works fine for a single column of fluid. Multiple columns, multiple widths, the program slows down. Any better ideas?
AnswerRe: What will be the height of fluid columns in a variable width cylinder Pin
Dr.Walt Fair, PE15-Dec-09 7:57
professionalDr.Walt Fair, PE15-Dec-09 7:57 
GeneralRe: What will be the height of fluid columns in a variable width cylinder Pin
Som Shekhar15-Dec-09 8:05
Som Shekhar15-Dec-09 8:05 
QuestionPrime Numbers List Website Pin
Tadeusz Westawic14-Dec-09 5:31
Tadeusz Westawic14-Dec-09 5:31 
AnswerRe: Prime Numbers List Website Pin
Luc Pattyn14-Dec-09 6:16
sitebuilderLuc Pattyn14-Dec-09 6:16 
GeneralRe: Prime Numbers List Website Pin
Tadeusz Westawic14-Dec-09 14:44
Tadeusz Westawic14-Dec-09 14:44 
GeneralRe: Prime Numbers List Website Pin
Tim Craig14-Dec-09 17:16
Tim Craig14-Dec-09 17:16 
QuestionSample code to encode/decode the plain text using ecc in C# Pin
udayanuk14-Dec-09 4:24
udayanuk14-Dec-09 4:24 
AnswerRe: Sample code to encode/decode the plain text using ecc in C# Pin
Luc Pattyn14-Dec-09 6:18
sitebuilderLuc Pattyn14-Dec-09 6:18 
AnswerRe: Sample code to encode/decode the plain text using ecc in C# Pin
Tim Craig14-Dec-09 14:17
Tim Craig14-Dec-09 14:17 
QuestionImaging Algorithm Pin
Member 323506112-Dec-09 20:50
Member 323506112-Dec-09 20:50 
QuestionRe: Imaging Algorithm Pin
Tim Craig13-Dec-09 17:43
Tim Craig13-Dec-09 17:43 
Questionabout K-Means algorithm for image Pin
nel7son11-Dec-09 16:13
nel7son11-Dec-09 16:13 
AnswerRe: about K-Means algorithm for image Pin
Richard MacCutchan12-Dec-09 2:43
mveRichard MacCutchan12-Dec-09 2:43 
Questionabout search msg. handler in wndproc and addr. in vtable Pin
Vixelor11-Dec-09 14:50
Vixelor11-Dec-09 14:50 
AnswerRe: about search msg. handler in wndproc and addr. in vtable Pin
Luc Pattyn11-Dec-09 15:45
sitebuilderLuc Pattyn11-Dec-09 15:45 
AnswerRe: about search msg. handler in wndproc and addr. in vtable Pin
Richard MacCutchan12-Dec-09 1:33
mveRichard MacCutchan12-Dec-09 1:33 
GeneralRe: about search msg. handler in wndproc and addr. in vtable Pin
Luc Pattyn12-Dec-09 1:48
sitebuilderLuc Pattyn12-Dec-09 1:48 

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.