Click here to Skip to main content
15,881,715 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: finger search algorithm using data structure in c-program Pin
harold aptroot8-Oct-14 6:37
harold aptroot8-Oct-14 6:37 
GeneralRe: finger search algorithm using data structure in c-program Pin
Member 111385019-Oct-14 3:33
Member 111385019-Oct-14 3:33 
QuestionHow do I manipulate a series of data chart points against their Y-Axis so they are evenly distributed along the axis? Pin
Brady Kelly20-Sep-14 21:39
Brady Kelly20-Sep-14 21:39 
AnswerRe: How do I manipulate a series of data chart points against their Y-Axis so they are evenly distributed along the axis? Pin
Bernhard Hiller21-Sep-14 21:32
Bernhard Hiller21-Sep-14 21:32 
GeneralRe: How do I manipulate a series of data chart points against their Y-Axis so they are evenly distributed along the axis? Pin
Brady Kelly21-Sep-14 22:00
Brady Kelly21-Sep-14 22:00 
GeneralRe: How do I manipulate a series of data chart points against their Y-Axis so they are evenly distributed along the axis? Pin
Bernhard Hiller22-Sep-14 2:03
Bernhard Hiller22-Sep-14 2:03 
QuestionOptimizing memory usage Pin
CDP180214-Sep-14 2:14
CDP180214-Sep-14 2:14 
AnswerRe: Optimizing memory usage Pin
Daniel Pfeffer15-Sep-14 22:41
professionalDaniel Pfeffer15-Sep-14 22:41 
Assuming that you subdivide the code into N snippets, each terminated by an unconditional jump (e.g. procedures), you could test each possible sequence out of the N! possibilities.

Note that the maximum savings in bytes that you could achieve are the number of jumps that may be converted from 16-bit form to 8-bit form. If this number is smaller than the length of the smallest code snippet, you would not be able to use any sort of pruning of the search tree, but would be forced to evaluate all N! leaves of the tree, which might take a long time...

Borland's Turbo Assembler (for x86 processors) had an option whereby it attempted to optimize (conditional) jumps:

1. All jumps were written without qualifiers.
2. The assembler would make multiple passes through the code, applying the following algorithm:
a. If a jump target was within +127/-128 bytes, output a short (2-byte) jump.
b. If an unconditional jump target was outside that range, output a 3-byte jump.
b. If a conditional jump target was outside that range, output a 5-byte sequence - jump <inverted condition=""> over the following jump (2 bytes) / jump unconditional to the target (3 bytes).

This was applied in a loop until either no more jumps could be optimized or a predetermined number of loops was reached. Typically, only 2-3 loops were necessary.

In addition to the automatic method given above, I would try to write each procedure so that the jumps are all 8-bit forms. Optimizing a procedure by hand is likely to be much easier than attempting global optimization.

I hope that this helps.
GeneralRe: Optimizing memory usage Pin
harold aptroot16-Sep-14 6:28
harold aptroot16-Sep-14 6:28 
QuestionHow .NET CLR understands More languages Pin
pitchaiyan12-Sep-14 5:12
pitchaiyan12-Sep-14 5:12 
GeneralRe: How .NET CLR understands More languages Pin
PIEBALDconsult12-Sep-14 5:31
mvePIEBALDconsult12-Sep-14 5:31 
GeneralRe: How .NET CLR understands More languages Pin
pitchaiyan12-Sep-14 5:42
pitchaiyan12-Sep-14 5:42 
RantRe: How .NET CLR understands More languages Pin
George Jonsson14-Sep-14 16:23
professionalGeorge Jonsson14-Sep-14 16:23 
AnswerRe: How .NET CLR understands More languages Pin
Richard MacCutchan12-Sep-14 5:58
mveRichard MacCutchan12-Sep-14 5:58 
QuestionAlgorithm to find a given number is prime or not. Pin
Member 110631236-Sep-14 1:21
Member 110631236-Sep-14 1:21 
GeneralRe: Algorithm to find a given number is prime or not. Pin
harold aptroot6-Sep-14 2:32
harold aptroot6-Sep-14 2:32 
GeneralRe: Algorithm to find a given number is prime or not. Pin
Member 110631236-Sep-14 4:01
Member 110631236-Sep-14 4:01 
GeneralRe: Algorithm to find a given number is prime or not. Pin
harold aptroot6-Sep-14 4:10
harold aptroot6-Sep-14 4:10 
GeneralRe: Algorithm to find a given number is prime or not. Pin
Member 110631236-Sep-14 4:14
Member 110631236-Sep-14 4:14 
GeneralRe: Algorithm to find a given number is prime or not. Pin
Member 110631236-Sep-14 4:18
Member 110631236-Sep-14 4:18 
GeneralRe: Algorithm to find a given number is prime or not. Pin
harold aptroot6-Sep-14 4:49
harold aptroot6-Sep-14 4:49 
GeneralRe: Algorithm to find a given number is prime or not. Pin
Member 110631236-Sep-14 6:33
Member 110631236-Sep-14 6:33 
GeneralRe: Algorithm to find a given number is prime or not. Pin
harold aptroot6-Sep-14 7:22
harold aptroot6-Sep-14 7:22 
GeneralRe: Algorithm to find a given number is prime or not. Pin
Member 110631236-Sep-14 7:53
Member 110631236-Sep-14 7:53 
GeneralRe: Algorithm to find a given number is prime or not. Pin
Member 110631237-Sep-14 6:23
Member 110631237-Sep-14 6:23 

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.