1. A method by which a tracking apparatus tracks a target object in an image, the method comprising: acquiring a first tree structure indicating an order of analyzing a plurality of frames, each frame including a tracking area in which the target object is located; acquiring a plurality of frame groups, each of the frame groups consisting of two frames, from the plurality of frames, and acquiring a distance evaluation value of each frame group; determining truncation probabilities of connection portions of the first tree structure according to distance evaluation values of first frame groups, each of the first frame groups consisting of two frames corresponding to connected nodes in the first tree structure; acquiring a third tree structure and a fourth tree structure by randomly truncating one of the connection portions in the first tree structure according to the truncation probabilities of the first frame groups; determining connection probabilities according to distance evaluation values of second frame groups, each of the second frame groups consisting of a frame in the third tree structure and a frame in the fourth tree structure; acquiring a second tree structure by randomly connecting a node in the third tree structure and a node in the fourth tree structure according to the connection probabilities of the second frame groups; and tracking the target object based on the acquired second tree structure, wherein each of the distance evaluation values is determined based on at least one of locations of tracking areas included in two frames belonging to each of the frame groups and pixel values in the tracking areas.