Public Group

# How to improve algorithm skills?

This topic is 4624 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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: 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.

##### Share on other sites
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.

##### Share on other sites
Quote:
 Original post by KaptainKomunistall you need is a simple ratio.(SliderLength/MaxValue) * value + offsetthis 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.

##### Share on other sites
Take some courses in mathematics and physics. That will increase your algorithmic and problem skills dramatically.

##### Share on other sites
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.

##### Share on other sites
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

##### Share on other sites
@Daerax: Well, you certainly put things into place, thanks.

@Nuno1: bookmarked, I'll try some of these.

Thanks for the replies, it has motivated me to hear this skill can be improved.

##### Share on other sites
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

##### Share on other sites
Quote:
 Original post by BTownTKDSome universities have classes devoted to algorithms.

I'd be scared if there are any that don't have those classes. At least, if they claim to teach comp. science...

##### Share on other sites
There is a book called Algorthmics. I believe the most recent edition was 2004. I recommend it since it focuses on algorithms as the core of computer science. Check it out.

1. 1
2. 2
Rutin
16
3. 3
4. 4
5. 5

• 11
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633721
• Total Posts
3013537
×