Alogorithm for line subdivision
===

I trying to draw tick marks on a line of arbitrary number of segments. I want to draw n tick marks along the line (where n is an input to algorithm). I also need to draw a tick on the beginning and ending of the line. Does anyone have any pointers of where I could find such an algorithm?