`ValuePosition = ValueRangeLength * (1 / PixelRangeLength) * (PixelPosition - PixelRangeBegin) + ValueRangeBegin;`Basically, I feel I'm too slow in this although I do enjoy it somewhat. I suppose a part is talent, but is it possible to improve my skill a bit and how? Thank you.

**0**

# How to improve algorithm skills?

Started by DeadXorAlive, Apr 16 2006 02:02 PM

9 replies to this topic

###
#1
Members - Reputation: **535**

Posted 16 April 2006 - 02:02 PM

Usually I get by, but still, do you have some tips how to improve one's skill in making algorithms?
It took me about an hour to find a way to transform (clamp?) a position in a range to the corresponding position in another range. (range of pixels - slider, to some value range). This is the best I could do if it makes sense:

Sponsor:

###
#2
Members - Reputation: **300**

Posted 16 April 2006 - 02:28 PM

all you need is a simple ratio.

(SliderLength/MaxValue) * value + offset

this will give you the value scaled to the slider.

Ah, this isn't what you wanted. I start with an equation, and solve for it. Try to have as few floating point operations as possible. Sometimes this is as simple as reorganising an equation. Other times you have to do some wicked assembly optomisation. Go look for the equation for carmack's reverse and inverse. They will blow your mind.

(SliderLength/MaxValue) * value + offset

this will give you the value scaled to the slider.

Ah, this isn't what you wanted. I start with an equation, and solve for it. Try to have as few floating point operations as possible. Sometimes this is as simple as reorganising an equation. Other times you have to do some wicked assembly optomisation. Go look for the equation for carmack's reverse and inverse. They will blow your mind.

###
#3
Members - Reputation: **535**

Posted 16 April 2006 - 02:51 PM

Quote:

Original post by KaptainKomunist

all you need is a simple ratio.

(SliderLength/MaxValue) * value + offset

this will give you the value scaled to the slider.

Ah, this isn't what you wanted. I start with an equation, and solve for it. Try to have as few floating point operations as possible. Sometimes this is as simple as reorganising an equation. Other times you have to do some wicked assembly optomisation. Go look for the equation for carmack's reverse and inverse. They will blow your mind.

You are still right:

`( ValueLength / SliderLength ) * SliderOffset + ValueOffset`[smile]

So basically I could focus on solving equations? Thanks.

I'm getting reasonably nice things done lately, but my code still sucks too much at a higher level to justify the effort of assembler optimizations.

###
#5
Members - Reputation: **1207**

Posted 16 April 2006 - 08:44 PM

I would go so far as to say that what is required to up your algorithin skill is practing and learning about algorithim design. Read on it and try to plan and then implement your own algorithims.

The problem solving methods of math and physics do not quite lend themselves well to programming because they are two different domains. There exists similarities but that is all they are, similarities. You must practice programming as well. With math there is generally a destination you wish to reach and theres is a vague idea of how to get there and you have a fair number of items to help get there. These items also allow you to construct more complex combinations to hasten your approach to your destination. In physics there is a puzzle that you are trying to put together and you make guesses at its original shape and use prior knowledge and tools to help do this.

In programming there is a general destination like math (indeed, you could say it takes place in the same landscape as your math travels) but there is not as much freedom and there are limits as to how you may operate everywhere. There is also a strong requirement of order in how you take your steps and plan. Heuristics and implications are not allowed, everything must be spelled out in a correct manner. Simply doing math will not prepare you for this. You must also program. In fact, you may find that programming helps to gather your thoughts and better grasp the internal details of some math while also inversely, math may help in better grasping a general external overview.

Desining a program is an engineering problem with strong aspects of planning,designing and foresight. Learning about programming, its structures and math simply increases the tools in your arsenal allowing you to approach desing problems from more angles and thus act more flexibly.

The problem solving methods of math and physics do not quite lend themselves well to programming because they are two different domains. There exists similarities but that is all they are, similarities. You must practice programming as well. With math there is generally a destination you wish to reach and theres is a vague idea of how to get there and you have a fair number of items to help get there. These items also allow you to construct more complex combinations to hasten your approach to your destination. In physics there is a puzzle that you are trying to put together and you make guesses at its original shape and use prior knowledge and tools to help do this.

In programming there is a general destination like math (indeed, you could say it takes place in the same landscape as your math travels) but there is not as much freedom and there are limits as to how you may operate everywhere. There is also a strong requirement of order in how you take your steps and plan. Heuristics and implications are not allowed, everything must be spelled out in a correct manner. Simply doing math will not prepare you for this. You must also program. In fact, you may find that programming helps to gather your thoughts and better grasp the internal details of some math while also inversely, math may help in better grasping a general external overview.

Desining a program is an engineering problem with strong aspects of planning,designing and foresight. Learning about programming, its structures and math simply increases the tools in your arsenal allowing you to approach desing problems from more angles and thus act more flexibly.

###
#6
Members - Reputation: **157**

Posted 16 April 2006 - 09:03 PM

algoritim skills come with experience.

I really recommend you to try programming challanges at ACM : http://acm.uva.es/

this site offer tons of programming challanges mostly related to optimization and algoritims. there are very hard challanges there and will advance you to the next level.

this may seems like a waste of time but it will affect you brain pretty fast :)

give it a try,

Nuno1

I really recommend you to try programming challanges at ACM : http://acm.uva.es/

this site offer tons of programming challanges mostly related to optimization and algoritims. there are very hard challanges there and will advance you to the next level.

this may seems like a waste of time but it will affect you brain pretty fast :)

give it a try,

Nuno1

###
#8
Members - Reputation: **205**

Posted 17 April 2006 - 02:16 AM

Some universities have classes devoted to algorithms. Case in point, my Data Structures and Algorithms class. To study for our final, my prof told us to just "practice solving problems." It's really vague, but if you like to program in your free time, I'm sure you can find problems to improve upon.

Things you learn in an algorithms class really are great -- you learn all about big-O notation and how to apply it to programs that you create.

HTH

Things you learn in an algorithms class really are great -- you learn all about big-O notation and how to apply it to programs that you create.

HTH