[1] Find a linear (O(n) in time) algorithm which does in-place
riffle shuffle of an array of size 2n.
[2] Write a program to check for balanced brackets (and braces, and parentheses)
without using a stack.
"{[]()" false.
"{[]()}" true.
")))(((" false
"((()))" true
"{}([]())" true
"[(]){}" false
Use O(n) time and O(1) space.
Amazon
Saturday, February 2, 2008
Algorithm interview questions
Posted by
innersmile
at
8:59 PM
0
comments
Wednesday, January 30, 2008
A probabalility question
You have N balls with N different colors. Randomly you draw two at a time,
then painting the first ball to match the second. What is the expected
number of drawings before all balls are the same color?
then painting the first ball to match the second. What is the expected
number of drawings before all balls are the same color?
Posted by
innersmile
at
10:27 PM
0
comments
Labels: brain teaser, expectation, probability, puzzle
Saturday, January 19, 2008
from MATLAB to Python/NumPy
Recently I started to translate the
MATLAB and Octave Functions for Computer Vision and Image Processing.
by Peter Kovesi into a Python package.
See
http://cvgmi.googlecode.com/files/fundamental_matrix.py
Posted by
innersmile
at
8:50 PM
0
comments
Labels: computer vision, MATLAB, python
Tuesday, January 15, 2008
Python tips and tricks
Q: How to add current path into system?
A: sys.path.append(os.path.abspath('./'))
Posted by
innersmile
at
8:35 PM
0
comments
Labels: python
Subscribe to:
Posts (Atom)