Relative Content

Tag Archive for algorithms

Tiling Problem Solutions for Various Size “Dominoes”

I’ve got an interesting tiling problem, I have a large square image (size 128k so 131072 squares) with dimensons 256×512… I want to fill this image with certain grain types (a 1×1 tile, a 1×2 strip, a 2×1 strip, and 2×2 square) and have no overlap, no holes, and no extension past the image boundary. Given some probability for each of these grain types, a list of the number required to be placed is generated for each.

How to calculate Sin function quicker and more precisely?

I want to calculate y(n)=32677Sin(45/1024•n), where y is an integer and n ranges from 0 to 2048. How can I make this process quicker and more precisely?
Now I want to show you a reference answer:
Since Sin(a+b)=Sin(a)Cos(b)+Cos(a)Sin(b)
And Cos(a+b)=Cos(a)Cos(b)-Sin(a)Cos(b).
So I can store Sin(45/1024•1) and Cos(45/1024•1) only.Then use this formula:

What are algorithmic paradigms?

We generally talk about paradigms of programming as functional, procedural, object oriented, imperative etc but what should I reply when I am asked the paradigms of algorithms?