Refresh to get another 5 random questions

Max of two integers

Max of two integers without using any conditional operators.

Tags: algorithm

Spanning trees of a two-dimensional n-by-n grid graph

Given a graph G constructed from a two-dimensional n-by-n grid, what is the number of spanning trees of G?


In-place perfect shuffle permutation

Define the perfect shuffle permutation of order n to be the permutation:
i -> 2*i mod (n+1), i = 1,2, ..., n
where n is an even number.


Keep splitting

1. A pile of 1000 stones, split it to two piles x and y, you get a number xy. Split x and y further, you a number for each of ...


The total number of squares on a chessboard

Determine the total number of squares of all sizes and positions on an ordinary 8x8 chessboard. Also compute the total number of rectangles.