complex, plot-driven variety of the detective story in which the audience is given the opportunity to engage in the same process of deduction as the protagonist throughout the investigation of a crime
A whodunit or whodunnit (a colloquial elision of "Who [has] done it?") is a complex, plot-driven variety of a detective story in which the puzzle regarding who committed the crime is the main focus. The reader or viewer is provided with the clues from which the identity of the perpetrator may be deduced before the story provides the revelation itself at its climax. The investigation is usually conducted by an eccentric, amateur, or semi-professional detective. This narrative development has been seen as a form of comedy in which order is restored to a threatened social calm.
Read more or edit on Wikipedia