Home
Archaeology
Astronomy
Biology
Books
Business
Chemistry
Coins
Computers
Conservation
Cooking
Earth Science
Farming
Economics
Finance
Games
Geography
Health Science
History by Date
Hobbies
Law
Mathematics
Medicine
Military Technology
Movies
Music
People
Pharmacology
Philosophy
Physics
Psychology
Religion
Science History
Technology
Sports
Television
Video
Visual Art
Privacy
Contact Us



Majority function

The majority function is a logic function from n inputs to one output, defined as follows: If more inputs are TRUE than are FALSE, then the majority function returns TRUE. Otherwise, the function returns FALSE.

Representing TRUE as 1 and FALSE as 0 provides this alternate definition:

                        /                 
                       |  1   Σ pi - 1/2  |
Majority(p1..n) = floor |  - + ----------  |
                       |  2        n      |
                                        /
where floor(n) represents the greatest integer less than or equal to n. The "- 1/2" in the formula serves to break ties in favor of FALSE.

Copyright 2004. All rights reserved.