NAS Parallel Benchmarks

Standard

What are Benchmarks?

a benchmark is the act of running a computer program, a set of programs, or other operations, in order to assess the relative performance of an object, normally by running a number of standard tests and trials against it. The term ‘benchmark’ is also mostly utilized for the purposes of elaborately-designed benchmarking programs themselves.

The NAS Parallel Benchmarks (NPB) are a small set of programs designed to help evaluate the performance of parallel supercomputers. The benchmarks, which are derived from computational fluid dynamics (CFD) applications, consist of five kernels and three pseudo-applications. The NPB come in several “flavors.” NAS solicits performance results for each from all sources.

Continue reading

Non-Recursive Hanoi

Standard

A lot of people can think about how to do the Non-recursive Hanoi algorithm.

There is a Binary Solution(Binary Solution), and a version of a non-recursive on Wikipedia in others sites.

My algorithm was based on:

Hanoi Non-Recursive Solution (Wikipedia)

Moves Hanoi

The Algorithm:

Input: Number of disks(n = number of disks)
Output: Movements of Hanoi Tower

for ( i <- 1,...,2^n -1 )


if( n == even number)


if( i == odd number )
moveright();

else
movenormal();

else

if( i == oddnumber)
moveleft();

else
movenormal();

About the functions:

moveright();

This function moves the smaller disk in right direction.

moveleft();

This function moves the smaller disk in left direction.

movenormal();

This function moves the non-smaller disk in a movement that not involves the smaller disk.

The functions moveright() and moveleft() can be proved by induction.