text:
Heap (data structure)

In computer science, a heap is a tree-based data structure that satisfies the heap property: In a max heap, for any given node C, if P is a parent node of C, then the key (the value) of P is greater than or equal to the key of C. In a min heap, the key of P is less than or equal to the key of C. The node at the "top" of the heap (with no parents) is called the root node.

The heap is one maximally efficient implementation of an abstract data type called a priority queue, and in fact, priority queues are often referred to as "heaps", regardless of how they may be implemented. In a heap, the highest (or lowest) priority element is always stored at the root. However, a heap is not a sorted structure; it can be regarded as being partially ordered. A heap is a useful data structure when it is necessary to repeatedly remove the object with the highest (or lowest) priority, or when insertions need to be interspersed with removals of the root node.

A common implementation of a heap is the binary heap, in which the tree is a complete binary tree (see figure). The heap data structure, specifically the binary heap, was introduced by J. W. J. Williams in 1964, as a data structure for the heapsort sorting algorithm. Heaps are also crucial in several efficient graph algorithms such as Dijkstra's algorithm. When a heap is a complete binary tree, it has the smallest possible height—a heap with N nodes and a branches for each node always has loga N height.

Note that, as shown in the graphic, there is no implied ordering between siblings or cousins and no implied sequence for an in-order traversal (as there would be in, e.g., a binary search tree). The heap relation mentioned above applies only between nodes and their parents, grandparents, etc. The maximum number of children each node can have depends on the type of heap.

Heaps are typically constructed in-place in the same array where the elements are stored, with their structure being implicit in the access pattern of the operations. Heaps differ in this way from other data structures with similar or in some cases better theoretic bounds such as Radix trees in that they require no additional memory beyond that used for storing the keys.

Operations
The common operations involving heaps are:
 * Basic
 * find-max (or find-min): find a maximum item of a max-heap, or a minimum item of a min-heap, respectively (a.k.a. peek)
 * insert: adding a new key to the heap (a.k.a., push )
 * extract-max (or extract-min): returns the node of maximum value from a max heap [or minimum value from a min heap] after removing it from the heap (a.k.a., pop )
 * delete-max (or delete-min): removing the root node of a max heap (or min heap), respectively
 * replace: pop root and push a new key. This is more efficient than a pop followed by a push, since it only needs to balance once, not twice, and is appropriate for fixed-size heaps.

 * Creation
 * create-heap: create an empty heap
 * heapify: create a heap out of given array of elements
 * merge (union): joining two heaps to form a valid new heap containing all the elements of both, preserving the original heaps.
 * meld: joining two heaps to form a valid new heap containing all the elements of both, destroying the original heaps.

 * Inspection
 * size: return the number of items in the heap.
 * is-empty: return true if the heap is empty, false otherwise.

 * Internal
 * increase-key or decrease-key: updating a key within a max- or min-heap, respectively
 * delete: delete an arbitrary node (followed by moving last node and sifting to maintain heap)
 * sift-up: move a node up in the tree, as long as needed; used to restore heap condition after insertion. Called "sift" because node moves up the tree until it reaches the correct level, as in a sieve.
 * sift-down: move a node down in the tree, similar to sift-up; used to restore heap condition after deletion or replacement.

Implementation
Heaps are usually implemented with an array, as follows:

 * Each element in the array represents a node of the heap, and
 * The parent / child relationship is defined implicitly by the elements' indices in the array.

For a binary heap, in the array, the first index contains the root element. The next two indices of the array contain the root's children. The next four indices contain the four children of the root's two child nodes, and so on. Therefore, given a node at index $i$, its children are at indices $2i + 1$ and $2i + 2$, and its parent is at index $⌊(i−1)/2⌋$. This simple indexing scheme makes it efficient to move "up" or "down" the tree.

Balancing a heap is done by sift-up or sift-down operations (swapping elements which are out of order). As we can build a heap from an array without requiring extra memory (for the nodes, for example), heapsort can be used to sort an array in-place.

After an element is inserted into or deleted from a heap, the heap property may be violated, and the heap must be re-balanced by swapping elements within the array.

Although different types of heaps implement the operations differently, the most common way is as follows:
 * Insertion: Add the new element at the end of the heap, in the first available free space. If this will violate the heap property, sift up the new element (swim operation) until the heap property has been reestablished.
 * Extraction: Remove the root and insert the last element of the heap in the root. If this will violate the heap property, sift down the new root (sink operation) to reestablish the heap property.
 * Replacement: Remove the root and put the new element in the root and sift down. When compared to extraction followed by insertion, this avoids a sift up step.

Construction of a binary (or d-ary) heap out of a given array of elements may be performed in linear time using the classic Floyd algorithm, with the worst-case number of comparisons equal to 2N − 2s2(N) − e2(N) (for a binary heap), where s2(N) is the sum of all digits of the binary representation of N and e2(N) is the exponent of 2 in the prime factorization of N. This is faster than a sequence of consecutive insertions into an originally empty heap, which is log-linear.

Variants

 * 2–3 heap
 * B-heap
 * Beap
 * Binary heap
 * Binomial heap
 * Brodal queue
 * d-ary heap
 * Fibonacci heap
 * K-D Heap
 * Leaf heap
 * Leftist heap
 * Skew binomial heap
 * Strict Fibonacci heap
 * Min-max heap
 * Pairing heap
 * Radix heap
 * Randomized meldable heap
 * Skew heap
 * Soft heap
 * Ternary heap
 * Treap
 * Weak heap

Applications
The heap data structure has many applications.

 * Heapsort: One of the best sorting methods being in-place and with no quadratic worst-case scenarios.
 * Selection algorithms: A heap allows access to the min or max element in constant time, and other selections (such as median or kth-element) can be done in sub-linear time on data that is in a heap.
 * Graph algorithms: By using heaps as internal traversal data structures, run time will be reduced by polynomial order. Examples of such problems are Prim's minimal-spanning-tree algorithm and Dijkstra's shortest-path algorithm.
 * Priority queue: A priority queue is an abstract concept like "a list" or "a map"; just as a list can be implemented with a linked list or an array, a priority queue can be implemented with a heap or a variety of other methods.
 * K-way merge: A heap data structure is useful to merge many already-sorted input streams into a single sorted output stream. Examples of the need for merging include external sorting and streaming results from distributed data such as a log structured merge tree. The inner loop is obtaining the min element, replacing with the next element for the corresponding input stream, then doing a sift-down heap operation. (Alternatively the replace function.) (Using extract-max and insert functions of a priority queue are much less efficient.)

Programming language implementations

 * The C++ Standard Library provides the make_heap, push_heap and pop_heap algorithms for heaps (usually implemented as binary heaps), which operate on arbitrary random access iterators. It treats the iterators as a reference to an array, and uses the array-to-heap conversion. It also provides the container adaptor priority_queue, which wraps these facilities in a container-like class. However, there is no standard support for the replace, sift-up/sift-down, or decrease/increase-key operations.
 * The Boost C++ libraries include a heaps library. Unlike the STL, it supports decrease and increase operations, and supports additional types of heap: specifically, it supports d-ary, binomial, Fibonacci, pairing and skew heaps.
 * There is a generic heap implementation for C and C++ with D-ary heap and B-heap support. It provides an STL-like API.
 * The standard library of the D programming language includes std.container.BinaryHeap, which is implemented in terms of D's ranges. Instances can be constructed from any random-access range. BinaryHeap exposes an input range interface that allows iteration with D's built-in foreach statements and integration with the range-based API of the std.algorithm package.
 * For Haskell there is the Data.Heap module.
 * The Java platform (since version 1.5) provides a binary heap implementation with the class in the Java Collections Framework. This class implements by default a min-heap; to implement a max-heap, programmer should write a custom comparator. There is no support for the replace, sift-up/sift-down, or decrease/increase-key operations.
 * Python has a heapq module that implements a priority queue using a binary heap. The library exposes a heapreplace function to support k-way merging.
 * PHP has both max-heap (SplMaxHeap) and min-heap (SplMinHeap) as of version 5.3 in the Standard PHP Library.
 * Perl has implementations of binary, binomial, and Fibonacci heaps in the Heap distribution available on CPAN.
 * The Go language contains a heap package with heap algorithms that operate on an arbitrary type that satisfies a given interface. That package does not support the replace, sift-up/sift-down, or decrease/increase-key operations.
 * Apple's Core Foundation library contains a CFBinaryHeap structure.
 * Pharo has an implementation of a heap in the Collections-Sequenceable package along with a set of test cases. A heap is used in the implementation of the timer event loop.
 * The Rust programming language has a binary max-heap implementation, BinaryHeap, in the collections module of its standard library.
 * .NET has PriorityQueue class which uses quaternary (d-ary) min-heap implementation. It is available from .NET 6.

title: Heap (data structure)


text:
Hierarchy

A hierarchy (from Greek: ἱεραρχία, from, 'president of sacred rites') is an arrangement of items (objects, names, values, categories, etc.) that are represented as being "above", "below", or "at the same level as" one another. Hierarchy is an important concept in a wide variety of fields, such as architecture, philosophy, design, mathematics, computer science, organizational theory, systems theory, systematic biology, and the social sciences (especially political science).

A hierarchy can link entities either directly or indirectly, and either vertically or diagonally. The only direct links in a hierarchy, insofar as they are hierarchical, are to one's immediate superior or to one of one's subordinates, although a system that is largely hierarchical can also incorporate alternative hierarchies. Hierarchical links can extend "vertically" upwards or downwards via multiple links in the same direction, following a path. All parts of the hierarchy that are not linked vertically to one another nevertheless can be "horizontally" linked through a path by traveling up the hierarchy to find a common direct or indirect superior, and then down again. This is akin to two co-workers or colleagues; each reports to a common superior, but they have the same relative amount of authority. Organizational forms exist that are both alternative and complementary to hierarchy. Heterarchy is one such form.

Nomenclature
Hierarchies have their own special vocabulary. These terms are easiest to understand when a hierarchy is diagrammed (see below).

In an organizational context, the following terms are often used related to hierarchies:
 * Object: one entity (e.g., a person, department or concept or element of arrangement or member of a set)
 * System: the entire set of objects that are being arranged hierarchically (e.g., an administration)
 * Dimension: another word for "system" from on-line analytical processing (e.g. cubes)
 * Member: an (element or object) at any (level or rank) in a (class-system, taxonomy or dimension)
 * Terms about Positioning
 * Rank: the relative value, worth, complexity, power, importance, authority, level etc. of an object
 * Level or Tier: a set of objects with the same rank OR importance
 * Ordering: the arrangement of the (ranks or levels)
 * Hierarchy: the arrangement of a particular set of members into (ranks or levels). Multiple hierarchies are possible per (dimension taxonomy or Classification-system), in which selected levels of the dimension are omitted to flatten the structure
 * Terms about Placement
 * Hierarch, the apex of the hierarchy, consisting of one single orphan (object or member) in the top level of a dimension. The root of an inverted-tree structure
 * Member, a (member or node) in any level of a hierarchy in a dimension to which (superior and subordinate) members are attached
 * Orphan, a member in any level of a dimension without a parent member. Often the apex of a disconnected branch. Orphans can be grafted back into the hierarchy by creating a relationship (interaction) with a parent in the immediately superior level
 * Leaf, a member in any level of a dimension without subordinates in the hierarchy
 * Neighbour: a member adjacent to another member in the same (level or rank). Always a peer.
 * Superior: a higher level or an object ranked at a higher level (A parent or an ancestor)
 * Subordinate: a lower level or an object ranked at a lower level (A child or a descendant)
 * Collection: all of the objects at one level (i.e. Peers)
 * Peer: an object with the same rank (and therefore at the same level)
 * Interaction: the relationship between an object and its direct superior or subordinate (i.e. a superior/inferior pair)
 * a direct interaction occurs when one object is on a level exactly one higher or one lower than the other (i.e., on a tree, the two objects have a line between them)
 * Distance: the minimum number of connections between two objects, i.e., one less than the number of objects that need to be "crossed" to trace a path from one object to another
 * Span: a qualitative description of the width of a level when diagrammed, i.e., the number of subordinates an object has
 * Terms about Nature
 * Attribute: a heritable characteristic of (members and their subordinates) in a level (e.g. hair-colour)
 * Attribute-value: the specific value of a heritable characteristic (e.g. Auburn)

In a mathematical context (in graph theory), the general terminology used is different.

Most hierarchies use a more specific vocabulary pertaining to their subject, but the idea behind them is the same. For example, with data structures, objects are known as nodes, superiors are called parents and subordinates are called children. In a business setting, a superior is a supervisor/boss and a peer is a colleague.

Degree of branching
Degree of branching refers to the number of direct subordinates or children an object has (in graph theory, equivalent to the number of other vertices connected to via outgoing arcs, in a directed graph) a node has. Hierarchies can be categorized based on the "maximum degree", the highest degree present in the system as a whole. Categorization in this way yields two broad classes: linear and branching.

In a linear hierarchy, the maximum degree is 1. In other words, all of the objects can be visualized in a line-up, and each object (excluding the top and bottom ones) has exactly one direct subordinate and one direct superior. This is referring to the objects and not the levels; every hierarchy has this property with respect to levels, but normally each level can have an infinite number of objects.

In a branching hierarchy, one or more objects has a degree of 2 or more (and therefore the minimum degree is 2 or higher). For many people, the word "hierarchy" automatically evokes an image of a branching hierarchy. Branching hierarchies are present within numerous systems, including organizations and classification schemes. The broad category of branching hierarchies can be further subdivided based on the degree.

A flat hierarchy (also known for companies as flat organization) is a branching hierarchy in which the maximum degree approaches infinity, i.e., that has a wide span. Most often, systems intuitively regarded as hierarchical have at most a moderate span. Therefore, a flat hierarchy is often not viewed as a hierarchy at all. For example, diamonds and graphite are flat hierarchies of numerous carbon atoms that can be further decomposed into subatomic particles.

An overlapping hierarchy is a branching hierarchy in which at least one object has two parent objects. For example, a graduate student can have two co-supervisors to whom the student reports directly and equally, and who have the same level of authority within the university hierarchy (i.e., they have the same position or tenure status).

Etymology
Possibly the first use of the English word hierarchy cited by the Oxford English Dictionary was in 1881, when it was used in reference to the three orders of three angels as depicted by Pseudo-Dionysius the Areopagite (5th–6th centuries). Pseudo-Dionysius used the related Greek word (ἱεραρχία, ) both in reference to the celestial hierarchy and the ecclesiastical hierarchy. The Greek term hierarchia means 'rule of a high priest', from (ἱεράρχης, 'president of sacred rites, high-priest') and that from hiereus (ἱερεύς, 'priest') and arche (ἀρχή, 'first place or power, rule'). Dionysius is credited with first use of it as an abstract noun.

Since hierarchical churches, such as the Roman Catholic (see Catholic Church hierarchy) and Eastern Orthodox churches, had tables of organization that were "hierarchical" in the modern sense of the word (traditionally with God as the pinnacle or head of the hierarchy), the term came to refer to similar organizational methods in secular settings.

Representing hierarchies
A hierarchy is typically depicted as a pyramid, where the height of a level represents that level's status and width of a level represents the quantity of items at that level relative to the whole. For example, the few Directors of a company could be at the apex, and the base could be thousands of people who have no subordinates.

These pyramids are often diagrammed with a triangle diagram which serves to emphasize the size differences between the levels (but not all triangle/pyramid diagrams are hierarchical; for example, the 1992 USDA food guide pyramid). An example of a triangle diagram appears to the right.

Another common representation of a hierarchical scheme is as a tree diagram. Phylogenetic trees, charts showing the structure of, and playoff brackets in sports are often illustrated this way.

More recently, as computers have allowed the storage and navigation of ever larger data sets, various methods have been developed to represent hierarchies in a manner that makes more efficient use of the available space on a computer's screen. Examples include fractal maps, TreeMaps and Radial Trees.

Visual hierarchy
In the design field, mainly graphic design, successful layouts and formatting of the content on documents are heavily dependent on the rules of visual hierarchy. Visual hierarchy is also important for proper organization of files on computers.

An example of visually representing hierarchy is through nested clusters. Nested clusters represent hierarchical relationships using layers of information. The child element is within the parent element, such as in a Venn diagram. This structure is most effective in representing simple hierarchical relationships. For example, when directing someone to open a file on a computer desktop, one may first direct them towards the main folder, then the subfolders within the main folder. They will keep opening files within the folders until the designated file is located.

For more complicated hierarchies, the stair structure represents hierarchical relationships through the use of visual stacking. Visually imagine the top of a downward staircase beginning at the left and descending on the right. Child elements are towards the bottom of the stairs and parent elements are at the top. This structure represents hierarchical relationships through the use of visual stacking.

Informal representation
In plain English, a hierarchy can be thought of as a set in which: The first requirement is also interpreted to mean that a hierarchy can have no circular relationships; the association between two objects is always transitive. The second requirement asserts that a hierarchy must have a leader or root that is common to all of the objects.
 * 1) No element is superior to itself, and
 * 2) One element, the (apex or hierarch), is superior to all of the other elements in the set.

Mathematical representation
Mathematically, in its most general form, a hierarchy is a partially ordered set or poset. The system in this case is the entire poset, which is constituted of elements. Within this system, each element shares a particular unambiguous property. Objects with the same property value are grouped together, and each of those resulting levels is referred to as a class.

"Hierarchy" is particularly used to refer to a poset in which the classes are organized in terms of increasing complexity. Operations such as addition, subtraction, multiplication and division are often performed in a certain sequence or order. Usually, addition and subtraction are performed after multiplication and division has already been applied to a problem. The use of parentheses is also a representation of hierarchy, for they show which operation is to be done prior to the following ones. For example: (2 + 5) × (7 - 4). In this problem, typically one would multiply 5 by 7 first, based on the rules of mathematical hierarchy. But when the parentheses are placed, one will know to do the operations within the parentheses first before continuing on with the problem. These rules are largely dominant in algebraic problems, ones that include several steps to solve. The use of hierarchy in mathematics is beneficial to quickly and efficiently solve a problem without having to go through the process of slowly dissecting the problem. Most of these rules are now known as the proper way into solving certain equations.

Nested hierarchy
A nested hierarchy or inclusion hierarchy is a hierarchical ordering of nested sets. The concept of nesting is exemplified in Russian matryoshka dolls. Each doll is encompassed by another doll, all the way to the outer doll. The outer doll holds all of the inner dolls, the next outer doll holds all the remaining inner dolls, and so on. Matryoshkas represent a nested hierarchy where each level contains only one object, i.e., there is only one of each size of doll; a generalized nested hierarchy allows for multiple objects within levels but with each object having only one parent at each level. The general concept is both demonstrated and mathematically formulated in the following example:

 * $$ \text{square} \subset \text{quadrilateral} \subset \text{polygon} \subset \text{shape} \, $$

A square can always also be referred to as a quadrilateral, polygon or shape. In this way, it is a hierarchy. However, consider the set of polygons using this classification. A square can only be a quadrilateral; it can never be a triangle, hexagon, etc.

Nested hierarchies are the organizational schemes behind taxonomies and systematic classifications. For example, using the original Linnaean taxonomy (the version he laid out in the 10th edition of Systema Naturae), a human can be formulated as:

 * $$\text{H. sapiens} \subset \text{Homo} \subset \text{Primates} \subset \text{Mammalia} \subset \text{Animalia}$$

Taxonomies may change frequently (as seen in biological taxonomy), but the underlying concept of nested hierarchies is always the same.

In many programming taxonomies and syntax models (as well as fractals in mathematics), nested hierarchies, including Russian dolls, are also used to illustrate the properties of self-similarity and recursion. Recursion itself is included as a subset of hierarchical programming, and recursive thinking can be synonymous with a form of hierarchical thinking and logic.

Containment hierarchy
A containment hierarchy is a direct extrapolation of the nested hierarchy concept. All of the ordered sets are still nested, but every set must be "strict"—no two sets can be identical. The shapes example above can be modified to demonstrate this:

 * $$ \text{square} \subsetneq \text{quadrilateral} \subsetneq \text{polygon} \subsetneq \text{shape} \, $$

The notation $$ x \subsetneq y \, $$ means x is a subset of y but is not equal to y.

A general example of a containment hierarchy is demonstrated in class inheritance in object-oriented programming.

Two types of containment hierarchies are the subsumptive containment hierarchy and the compositional containment hierarchy. A subsumptive hierarchy "subsumes" its children, and a compositional hierarchy is "composed" of its children. A hierarchy can also be both subsumptive and compositional.

Subsumptive containment hierarchy
A subsumptive containment hierarchy is a classification of object classes from the general to the specific. Other names for this type of hierarchy are "taxonomic hierarchy" and "IS-A hierarchy". The last term describes the relationship between each level—a lower-level object "is a" member of the higher class. The taxonomical structure outlined above is a subsumptive containment hierarchy. Using again the example of Linnaean taxonomy, it can be seen that an object that is a member of the level Mammalia "is a" member of the level Animalia; more specifically, a human "is a" primate, a primate "is a" mammal, and so on. A subsumptive hierarchy can also be defined abstractly as a hierarchy of "concepts". For example, with the Linnaean hierarchy outlined above, an entity name like Animalia is a way to group all the species that fit the conceptualization of an animal.

Compositional containment hierarchy
A compositional containment hierarchy is an ordering of the parts that make up a system—the system is "composed" of these parts. Most engineered structures, whether natural or artificial, can be broken down in this manner.

The compositional hierarchy that every person encounters at every moment is the hierarchy of life. Every person can be reduced to organ systems, which are composed of organs, which are composed of tissues, which are composed of cells, which are composed of molecules, which are composed of atoms. In fact, the last two levels apply to all matter, at least at the macroscopic scale. Moreover, each of these levels inherit all the properties of their children.

In this particular example, there are also emergent properties—functions that are not seen at the lower level (e.g., cognition is not a property of neurons but is of the brain)—and a scalar quality (molecules are bigger than atoms, cells are bigger than molecules, etc.). Both of these concepts commonly exist in compositional hierarchies, but they are not a required general property. These level hierarchies are characterized by bi-directional causation. Upward causation involves lower-level entities causing some property of a higher level entity; children entities may interact to yield parent entities, and parents are composed at least partly by their children. Downward causation refers to the effect that the incorporation of entity x into a higher-level entity can have on x's properties and interactions. Furthermore, the entities found at each level are autonomous.

Contexts and applications
Kulish (2002) suggests that almost every system of organization which humans apply to the world is arranged hierarchically. Some conventional definitions of the terms "nation" and "government"  suggest that every nation has a government and that every government is hierarchical. Sociologists can analyse socioeconomic systems in terms of stratification into a social hierarchy (the social stratification of societies), and all systematic classification schemes (taxonomies) are hierarchical. Most organized religions, regardless of their internal governance structures, operate as a hierarchy under deities and priesthoods. Many Christian denominations have an autocephalous ecclesiastical hierarchy of leadership. Families can be viewed as hierarchical structures in terms of cousinship (e.g., first cousin once removed, second cousin, etc.), ancestry (as depicted in a family tree) and inheritance (succession and heirship). All the requisites of a well-rounded life and lifestyle can be organized using Maslow's hierarchy of human needs - according to Maslow's hierarchy of human needs. Learning steps often follow a hierarchical scheme—to master differential equations one must first learn calculus; to learn calculus one must first learn elementary algebra; and so on. Nature offers hierarchical structures, as numerous schemes such as Linnaean taxonomy, the organization of life, and biomass pyramids attempt to document.

While the above examples are often clearly depicted in a hierarchical form and are classic examples, hierarchies exist in numerous systems where this branching structure is not immediately apparent. For example, most postal-code systems are hierarchical. Using the Canadian postal code system as an example, the top level's binding concept, the "postal district", consists of 18 objects (letters). The next level down is the "zone", where the objects are the digits 0–9. This is an example of an overlapping hierarchy, because each of these 10 objects has 18 parents. The hierarchy continues downward to generate, in theory, 7,200,000 unique codes of the format A0A 0A0 (the second and third letter positions allow 20 objects each). Most library classification systems are also hierarchical. The Dewey Decimal System is infinitely hierarchical because there is no finite bound on the number of digits can be used after the decimal point.

Organizations
Organizations can be structured as a dominance hierarchy. In an organizational hierarchy, there is a single person or group with the most power or authority, and each subsequent level represents a lesser authority. Most organizations are structured in this manner, including governments, companies, armed forces, militia and organized religions. The units or persons within an organization may be depicted hierarchically in an organizational chart.

In a reverse hierarchy, the conceptual pyramid of authority is turned upside-down, so that the apex is at the bottom and the base is at the top. This mode represents the idea that members of the higher rankings are responsible for the members of the lower rankings.

Biology
Empirically, when we observe in nature a large proportion of the (complex) biological systems, they exhibit hierarchic structure. On theoretical grounds we could expect complex systems to be hierarchies in a world in which complexity had to evolve from simplicity. System hierarchies analysis performed in the 1950s, laid the empirical foundations for a field that would become, from the 1980s, hierarchical ecology.

The theoretical foundations are summarized by thermodynamics. When biological systems are modeled as physical systems, in the most general abstraction, they are thermodynamic open systems that exhibit self-organised behavior, and the set/subset relations between dissipative structures can be characterized in a hierarchy.

Other hierarchical representations related to biology include ecological pyramids which illustrate energy flow or trophic levels in ecosystems, and taxonomic hierarchies, including the Linnean classification scheme and phylogenetic trees that reflect inferred patterns of evolutionary relationship among living and extinct species.

Computer-graphic imaging
CGI and computer-animation programs mostly use hierarchies for models. On a 3D model of a human for example, the chest is a parent of the upper left arm, which is a parent of the lower left arm, which is a parent of the hand. This pattern is used in modeling and animation for almost everything built as a 3D digital model.

Linguistics
Many grammatical theories, such as phrase-structure grammar, involve hierarchy.

Direct–inverse languages such as Cree and Mapudungun distinguish subject and object on verbs not by different subject and object markers, but via a hierarchy of persons.

In this system, the three (or four with Algonquian languages) persons occur in a hierarchy of salience. To distinguish which is subject and which object, inverse markers are used if the object outranks the subject.

On the other hand, languages include a variety of phenomena that are not hierarchical. For example, the relationship between a pronoun and a prior noun-phrase to which it refers commonly crosses grammatical boundaries in non-hierarchical ways.

Music
The structure of a musical composition is often understood hierarchically (for example by Heinrich Schenker (1768–1835, see Schenkerian analysis), and in the (1985) Generative Theory of Tonal Music, by composer Fred Lerdahl and linguist Ray Jackendoff). The sum of all notes in a piece is understood to be an all-inclusive surface, which can be reduced to successively more sparse and more fundamental types of motion. The levels of structure that operate in Schenker's theory are the foreground, which is seen in all the details of the musical score; the middle ground, which is roughly a summary of an essential contrapuntal progression and voice-leading; and the background or Ursatz, which is one of only a few basic "long-range counterpoint" structures that are shared in the gamut of tonal music literature.

The pitches and form of tonal music are organized hierarchically, all pitches deriving their importance from their relationship to a tonic key, and secondary themes in other keys are brought back to the tonic in a recapitulation of the primary theme.

Information-based

 * Library classification
 * Dewey Decimal Classification

City planning-based

 * Green transport hierarchy
 * Roads
 * Streets
 * Settlement hierarchy
 * As of 2010
 * As of 2100 (estimate according to Doxiadis, 1968)

Linguistics-oriented

 * Language family tree
 * Levels of adequacy for evaluating grammars
 * Direct–inverse languages
 * Structural linguistics
 * Parse tree
 * Formal grammars
 * Abstract syntax tree
 * Evolution of basic color terminology in languages

Power- or authority-based

 * Aristocratic hierarchies
 * In Europe
 * In China
 * Ecclesiastical hierarchies
 * Catholic Church hierarchy
 * LDS Church hierarchy
 * Kimbanguist Church hierarchy
 * Raëlism Church hierarchy
 * see also autocephaly
 * Prussian three-class franchise
 * Political party hierarchies
 * Nazi Party (pace overlapping fields )
 * SS
 * Hierarchy of subdivisions within the Gau
 * Communist Party of the Soviet Union
 * Chinese Communist Party
 * Chain of command
 * Military ranks
 * Military units
 * U.S. Military Combatant Commands
 * Intraspecial dominance
 * Pecking order
 * Social classes
 * Caste system in India
 * Hierarchical structure of Feudal Japan
 * White racist hierarchy
 * Hierarchy of Exclusion (Ender's Game)

Value-related

 * Hierarchy of genres in art
 * Evidence
 * Human needs
 * Precious substances
 * Judicial hierarchy of social values

Perception-based

 * Color wheel
 * Primary colors
 * Secondary colors
 * Tertiary colors

History-oriented

 * Three-age system
 * Cyclic theory of civilization
 * Oswald Spengler
 * Arnold J. Toynbee
 * Spiral dynamics

Science-focussed

 * Hierarchy of organization within the Universe
 * Star systems
 * Biological classification
 * Biological organization
 * Phylogenetic tree
 * Evolutionary development
 * Hierarchy of ecological georegions

Technology-based

 * Memory hierarchy
 * Cache hierarchy
 * Clusters
 * Class constructs
 * Data organization
 * Hierarchical query
 * Data storage
 * Computer files
 * Devices
 * IP addresses
 * Memory
 * Virtual memory allocation
 * Networks
 * Radio cells
 * States (configurations)
 * Web addresses
 * Structure
 * Data Structure
 * Inheritance (object-oriented programming)

Religion-related

 * Levels of consciousness
 * Chakras
 * Great chain of being
 * G.I. Gurdjieff
 * Timothy Leary
 * Levels of spiritual development
 * In Theravada Buddhism
 * In Mahayana Buddhism
 * Ages in the evolution of society
 * In Astrology
 * In Hellenism (the Ancient Greek Religion)
 * Dispensations in Protestantism
 * Dispensations in Mormonism
 * Degrees of communion between various Christian churches
 * UFO religions
 * Command hierarchy of the Ashtar Galactic Command flying saucer fleet
 * Deities
 * In Japanese Buddhism
 * In Theosophy
 * Angels
 * In Christianity
 * In Islam
 * In Judaism
 * Kabbalistic
 * In Zoroastrianism
 * Devils and Demons
 * Devils
 * Demons
 * Hells
 * In Catholicism (Nine Levels of Hell)
 * In Buddhism (Sixteen Levels of Hell)
 * Religions in society
 * (organizational hierarchies are listed under "Power- or authority-based")

Methods using hierarchy
• Analytic Hierarchy Process

• * Hierarchical Decision Process

• Hierarchic Object-Oriented Design

• Hierarchical Bayes model

• Hierarchical clustering

• * Hierarchical clustering of networks

• Hierarchical constraint satisfaction

• Hierarchical linear modeling

• Hierarchical modulation

• Hierarchical proportion

• Hierarchical radial basis function

• Hierarchical storage management

• Hierarchical task network

• Hierarchical temporal memory

• Hierarchical token bucket

• Hierarchical visitor pattern

• Presentation-abstraction-control

• * Hierarchical-Model-View-Controller

Criticisms
In the work of diverse theorists such as William James (1842 to 1910), Michel Foucault (1926 to 1984) and Hayden White (1928 to 2018), important critiques of hierarchical epistemology are advanced. James famously asserts in his work Radical Empiricism that clear distinctions of type and category are a constant but unwritten goal of scientific reasoning, so that when they are discovered, success is declared. But if aspects of the world are organized differently, involving inherent and intractable ambiguities, then scientific questions are often considered unresolved.

Feminists, Marxists, anarchists, communists, critical theorists and others, all of whom have multiple interpretations, criticize the hierarchies commonly found within human society, especially in social relationships. Hierarchies are present in all parts of society: in businesses, schools, families, etc. These relationships are often viewed as necessary. Entities that stand in hierarchical arrangements are animals, humans, plants, etc.

Ethics, behavioral psychology, philosophies of identity
In ethics, various virtues are enumerated and sometimes organized hierarchically according to certain brands of virtue theory.

In some of these random examples, there is an asymmetry of 'compositional' significance between levels of structure, so that small parts of the whole hierarchical array depend, for their meaning, on their membership in larger parts. There is a hierarchy of activities in human life: productive activity serves or is guided by the moral life; the moral life is guided by practical reason; practical reason (used in moral and political life) serves contemplative reason (whereby we contemplate God). Practical reason sets aside time and resources for contemplative reason.

Structure-related concepts
(For example, in )
 * Is-a
 * Hypernymy (and supertype)
 * Hyponymy (and subtype)
 * Has-a
 * Holonymy
 * Meronymy

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

title: Hierarchy


text:
Outline of health sciences

The following outline is provided as an overview of and topical guide to health sciences:

Health sciences – those sciences that focus on health, or health care, as core parts of their subject matter. Health sciences relate to multiple academic disciplines, including STEM disciplines and emerging patient safety disciplines (such as social care research).

Medicine and its branches
Medicine is an applied science or practice of the diagnosis, treatment, and prevention of disease. It encompasses a variety of health care practices evolved to maintain and restore health by the prevention and treatment of illness. Below are some of the branches of medicine.

 * Anesthesiology is the brand of medicine that deals with life support and anesthesia during surgery.
 * Angiology deals with the diseases of the circulatory system.
 * Audiology focuses on preventing and curing hearing damage.
 * Bariatrics deals with the causes, prevention, and treatment of obesity.
 * Cardiology deals with disorders of the heart and the blood vessels.
 * Critical care medicine focuses on life support and the intensive care of the seriously ill.
 * Dentistry is the branch of medicine that consists of the study, diagnosis, prevention, and treatment of diseases, disorders, and conditions of the oral cavity, commonly in the dentition but also the oral mucosa, and of adjacent and related structures and tissues, particularly in the maxillofacial (jaw and facial) area.
 * Dermatology deals with the skin, its structure, functions, and diseases.
 * Emergency medicine focuses on care provided in the emergency department.
 * Endocrinology deals with disorders of the endocrine system.
 * Family medicine is a medical specialty devoted to comprehensive health care for people of all ages.
 * Gastroenterology deals with the study and care of the digestive system.
 * General Practice (often called Family Medicine) is a branch of medicine that specializes in primary care.
 * Geriatrics is the branch of medicine that deals with the general health and well-being of the elderly.
 * Gynecology deals with the health of the female reproductive systems and the breasts.
 * Hematology deals with the blood and the circulatory system.
 * Hepatology deals with the liver, gallbladder and the biliary system.
 * Infectious disease is a branch of medicine that deals with the diagnosis and management of infectious disease, especially for complex cases and immunocompromised patients.
 * Kinesiology is the scientific study of human or non-human body movement.
 * Laboratory medicine deals with diagnostic laboratory examinations and tests and their interpretation what makes in a medical laboratory.
 * Medical physics is the branch of medicine and science that deals with applications of physics concepts, theories, and methods to medicine or health care.
 * Neurology deals with the brain and the nervous system.
 * Nephrology is the branch of medicine which deals with the kidneys.
 * Oncology is the branch of medicine that studies of cancer.
 * Ophthalmology deals with the eyes.
 * Orthopedics is a branch of surgery concerned with conditions involving the musculoskeletal system
 * Otolaryngology deals the ears, nose and throat.
 * Pathology is the study of diseases, and the causes, processes, nature, and development of the disease.
 * Pediatrics is the branch of medicine that deals with the general health and well-being of children.
 * Pharmacy is the art and practice of preparing, preserving, compounding, and dispensing medical drugs
 * Pharmacology is study and practical application of preparation, use, and effects of drugs and synthetic medicines.
 * Public health and preventive medicine is the branch of medicine concerned with the health of populations.
 * Pulmonology is the branch of medicine that deals with the respiratory system.
 * Psychiatry deals with the study, diagnosis, treatment, and prevention of mental disorders.
 * Clinical psychology is a health discipline concerned with the biopsychosocial study of the mind, brain, behavior and the diagnosis, treatment and prevention of psychological disorders.
 * Radiology is the branch of medicine that employs medical imaging to diagnose and treat disease.
 * Rheumatology deals with the diagnosis and treatment of rheumatic diseases.
 * Splanchnology deals with visceral organs.
 * Surgery is the branch of medicine that uses operative techniques to investigate or treat both disease and injury, or to help improve bodily function or appearance.
 * Urology is the branch of medicine that deals with the urinary system and the male reproductive system.
 * Veterinary medicine is the branch of medicine that deals with the prevention, diagnosis, and treatment of disease, disorder, and injury in nonhuman/animals.

History of health sciences

 * History of medicine

General health sciences concepts

 * Disease
 * Healing
 * Health
 * Doctor
 * Dentist
 * Physician
 * Surgeon
 * Veterinarian
 * Hospital
 * Nurse
 * Medication
 * Operation

Diagnostic methods

 * Physical examination
 * Auscultation
 * Percussion
 * Medical history
 * Medical imaging
 * X-ray
 * CT scan
 * PET scan
 * MRI
 * SPECT (Single-photon emission computed tomography)
 * Ultrasound
 * Microscopy
 * Phlebotomy
 * Rating scales

title: Outline of health sciences


text:
Hour

An hour (symbol: h; also abbreviated hr) is a unit of time historically reckoned as $1/undefined$ of a day and defined contemporarily as exactly 3,600 seconds (SI). There are 60 minutes in an hour, and 24 hours in a day.

The hour was initially established in the ancient Near East as a variable measure of $1/undefined$ of the night or daytime. Such seasonal hours, also known as temporal hours or unequal hours, varied by season and latitude.

Equal hours or equinoctial hours were taken as $1/undefined$ of the day as measured from noon to noon; the minor seasonal variations of this unit were eventually smoothed by making it $1/undefined$ of the mean solar day. Since this unit was not constant due to long term variations in the Earth's rotation, the hour was finally separated from the Earth's rotation and defined in terms of the atomic or physical second.

In the modern metric system, hours are an accepted unit of time defined as 3,600 atomic seconds. However, on rare occasions an hour may incorporate a positive or negative leap second, effectively making it appear to last 3,599 or 3,601 seconds, in order to keep UTC within 0.9 seconds of UT1, the latter of which is based on measurements of the mean solar day.

Etymology
Hour is a development of the Anglo-Norman houre and Middle English ure, first attested in the 13th century.

It displaced tide tīd, 'time' and stound stund, span of time. The Anglo-Norman term was a borrowing of Old French ure, a variant of ore, which derived from Latin hōra and Greek hṓrā.

Like Old English tīd and stund, hṓrā was originally a vaguer word for any span of time, including seasons and years. Its Proto-Indo-European root has been reconstructed as  ("year, summer"), making hour distantly cognate with year.

The time of day is typically expressed in English in terms of hours. Whole hours on a 12-hour clock are expressed using the contracted phrase o'clock, from the older of the clock. (10 am and 10 pm are both read as "ten o'clock".)

Hours on a 24-hour clock ("military time") are expressed as "hundred" or "hundred hours". (1000 is read "ten hundred" or "ten hundred hours"; 10 pm would be "twenty-two hundred".)

Fifteen and thirty minutes past the hour is expressed as "a quarter past" or "after" and "half past", respectively, from their fraction of the hour. Fifteen minutes before the hour may be expressed as "a quarter to", "of", "till", or "before" the hour. (9:45 may be read "nine forty-five" or "a quarter till ten".)

Antiquity
The ancient Greeks kept time differently than is done today. Instead of dividing the time between one midnight and the next into 24 equal hours, they divided the time from sunrise to sunset into 12 "seasonal hours" (their actual duration depending on season), and the time from sunset to the next sunrise again in 12 "seasonal hours". Initially, only the day was divided into 12 seasonal hours and the night into three or four night watches.

By the Hellenistic period the night was also divided into 12 hours. The day-and-night (νυχθήμερον) was probably first divided into twenty-four hours by Hipparchus of Nicaea. The Greek astronomer Andronicus of Cyrrhus oversaw the construction of a horologion called the Tower of the Winds in Athens during the first century BCE. This structure tracked a 24-hour day using both sundials and mechanical hour indicators.

The canonical hours were inherited into early Christianity from Second Temple Judaism. By AD 60, the Didache recommends disciples to pray the Lord's Prayer three times a day; this practice found its way into the canonical hours as well. By the second and third centuries, such Church Fathers as Clement of Alexandria, Origen, and Tertullian wrote of the practice of Morning and Evening Prayer, and of the prayers at the third, sixth and ninth hours. In the early church, during the night before every feast, a vigil was kept. The word "Vigils", at first applied to the Night Office, comes from a Latin source, namely the Vigiliae or nocturnal watches or guards of the soldiers. The night from six o'clock in the evening to six o'clock in the morning was divided into four watches or vigils of three hours each, the first, the second, the third, and the fourth vigil.

The Horae were originally personifications of seasonal aspects of nature, not of the time of day. The list of twelve Horae representing the twelve hours of the day is recorded only in Late Antiquity, by Nonnus. The first and twelfth of the Horae were added to the original set of ten:

 * 1) Auge (first light)
 * 2) Anatole (sunrise)
 * 3) Mousike (morning hour of music and study)
 * 4) Gymnastike (morning hour of exercise)
 * 5) Nymphe (morning hour of ablutions)
 * 6) Mesembria (noon)
 * 7) Sponde (libations poured after lunch)
 * 8) Elete (prayer)
 * 9) Akte (eating and pleasure)
 * 10) Hesperis (start of evening)
 * 11) Dysis (sunset)
 * 12) Arktos (night sky)

Middle Ages

Medieval astronomers such as al-Biruni and Sacrobosco,  divided the hour into 60 minutes, each of 60 seconds; this derives from Babylonian astronomy, where the corresponding terms denoted the time required for the Sun's apparent motion through the ecliptic to describe one minute or second of arc, respectively. In present terms, the Babylonian degree of time was thus four minutes long, the "minute" of time was thus four seconds long and the "second" 1/15 of a second. )

In medieval Europe, the Roman hours continued to be marked on sundials but the more important units of time were the canonical hours of the Orthodox and Catholic Church. During daylight, these followed the pattern set by the three-hour bells of the Roman markets, which were succeeded by the bells of local churches. They rang prime at about 6am, terce at about 9am, sext at noon, nones at about 3pm, and vespers at either 6pm or sunset. Matins and lauds precede these irregularly in the morning hours; compline follows them irregularly before sleep; and the midnight office follows that. Vatican II ordered their reformation for the Catholic Church in 1963, though they continue to be observed in the Orthodox churches.

When mechanical clocks began to be used to show hours of daylight or nighttime, their period needed to be changed every morning and evening (for example, by changing the length of their pendula). The use of 24 hours for the entire day meant hours varied much less and the clocks needed to be adjusted only a few times a month.

Modernity
The minor irregularities of the apparent solar day were smoothed by measuring time using the mean solar day, using the Sun's movement along the celestial equator rather than along the ecliptic. The irregularities of this time system were so minor that most clocks reckoning such hours did not need adjustment. However, scientific measurements eventually became precise enough to note the effect of tidal deceleration of the Earth by the Moon, which gradually lengthens the Earth's days.

During the French Revolution, a general decimalisation of measures was enacted, including decimal time between 1794 and 1800. Under its provisions, the French hour was $1/undefined$ of the day and divided formally into 100 decimal minutes (minute décimale) and informally into 10 tenths (). Mandatory use for all public records began in 1794, but was suspended six months later by the same 1795 legislation that first established the metric system. In spite of this, a few localities continued to use decimal time for six years for civil status records, until 1800, after Napoleon's Coup of 18 Brumaire.

The metric system bases its measurements of time upon the second, defined since 1952 in terms of the Earth's rotation in AD1900. Its hours are a secondary unit computed as precisely 3,600 seconds. However, an hour of Coordinated Universal Time (UTC), used as the basis of most civil time, has lasted 3,601 seconds 27 times since 1972 in order to keep it within 0.9 seconds of universal time, which is based on measurements of the mean solar day at 0° longitude. The addition of these seconds accommodates the very gradual slowing of the rotation of the Earth.

In modern life, the ubiquity of clocks and other timekeeping devices means that segmentation of days according to their hours is commonplace. Most forms of employment, whether wage or salaried labour, involve compensation based upon measured or expected hours worked. The fight for an eight-hour day was a part of labour movements around the world. Informal rush hours and happy hours cover the times of day when commuting slows down due to congestion or alcoholic drinks being available at discounted prices. The hour record for the greatest distance travelled by a cyclist within the span of an hour is one of cycling's greatest honours.

Counting hours

Many different ways of counting the hours have been used. Because sunrise, sunset, and, to a lesser extent, noon, are the conspicuous points in the day, starting to count at these times was, for most people in most early societies, much easier than starting at midnight. However, with accurate clocks and modern astronomical equipment (and the telegraph or similar means to transfer a time signal in a split-second), this issue is much less relevant.

Astrolabes, sundials, and astronomical clocks sometimes show the hour length and count using some of these older definitions and counting methods.

Counting from dawn
In ancient and medieval cultures, the counting of hours generally started with sunrise. Before the widespread use of artificial light, societies were more concerned with the division between night and day, and daily routines often began when light was sufficient.

"Babylonian hours" divide the day and night into 24 equal hours, reckoned from the time of sunrise. They are so named from the false belief of ancient authors that the Babylonians divided the day into 24 parts, beginning at sunrise. In fact, they divided the day into 12 parts (called kaspu or "double hours") or into 60 equal parts.

Unequal hours
Sunrise marked the beginning of the first hour, the middle of the day was at the end of the sixth hour and sunset at the end of the twelfth hour. This meant that the duration of hours varied with the season. In the Northern hemisphere, particularly in the more northerly latitudes, summer daytime hours were longer than winter daytime hours, each being one twelfth of the time between sunrise and sunset. These variable-length hours were variously known as temporal, unequal, or seasonal hours and were in use until the appearance of the mechanical clock, which furthered the adoption of equal length hours.

This is also the system used in Jewish law and frequently called "Talmudic hour" (Sha'a Zemanit) in a variety of texts. The Talmudic hour is one twelfth of time elapsed from sunrise to sunset, day hours therefore being longer than night hours in the summer; in winter they reverse.

The Indic day began at sunrise. The term hora was used to indicate an hour. The time was measured based on the length of the shadow at day time. A hora translated to 2.5 pe. There are 60 pe per day, 60 minutes per pe and 60 kshana (snap of a finger or instant) per minute. Pe was measured with a bowl with a hole placed in still water. Time taken for this graduated bowl was one pe. Kings usually had an officer in charge of this clock.

Counting from sunset

In so-called "Italian time", "Italian hours", or "old Czech time", the first hour started with the sunset Angelus bell (or at the end of dusk, i.e., half an hour after sunset, depending on local custom and geographical latitude). The hours were numbered from 1 to 24. For example, in Lugano, the sun rose in December during the 14th hour and noon was during the 19th hour; in June the sun rose during the 7th hour and noon was in the 15th hour. Sunset was always at the end of the 24th hour. The clocks in church towers struck only from 1 to 12, thus only during night or early morning hours.

This manner of counting hours had the advantage that everyone could easily know how much time they had to finish their day's work without artificial light. It was already widely used in Italy by the 14th century and lasted until the mid-18th century; it was officially abolished in 1755, or in some regions customary until the mid-19th century.

The system of Italian hours can be seen on a number of clocks in Europe, where the dial is numbered from 1 to 24 in either Roman or Arabic numerals. The St Mark's Clock in Venice, and the Orloj in Prague are famous examples. It was also used in Poland, Silesia, and Bohemia until the 17th century.

Its replacement by the more practical division into twice twelve (equinoctial) hours (also called small clock or civic hours) began as early as the 16th century.

An advantage of the evening counting start was that on a corresponding clock the difference to 24 was easy to see and so one knew how many hours could still be worked in daylight.

The Islamic day begins at sunset. The first prayer of the day (maghrib) is to be performed between just after sunset and the end of twilight. Until 1968 Saudi Arabia used the system of counting 24 equal hours with the first hour starting at sunset.

Counting from noon
For many centuries, up to 1925, astronomers counted the hours and days from noon, because it was the easiest solar event to measure accurately. An advantage of this method (used in the Julian Date system, in which a new Julian Day begins at noon) is that the date doesn't change during a single night's observing.

Counting from midnight
In the modern 12-hour clock, counting the hours starts at midnight and restarts at noon. Hours are numbered 12, 1, 2, ..., 11. Solar noon is always close to 12 noon (ignoring artificial adjustments due to time zones and daylight saving time), differing according to the equation of time by as much as fifteen minutes either way. At the equinoxes sunrise is around 6 a.m. (ante meridiem, before noon), and sunset around 6 p.m. (post meridiem, after noon).

In the modern 24-hour clock, counting the hours starts at midnight, and hours are numbered from 0 to 23. Solar noon is always close to 12:00, again differing according to the equation of time. At the equinoxes sunrise is around 06:00, and sunset around 18:00.

Egypt
The ancient Egyptians began dividing the night into wnwt at some time before the compilation of the Dynasty V Pyramid Texts in the 24thcenturyBC. By 2150BC (Dynasty IX), diagrams of stars inside Egyptian coffin lids—variously known as "diagonal calendars" or "star clocks"—attest that there were exactly 12 of these. Clagett writes that it is "certain" this duodecimal division of the night followed the adoption of the Egyptian civil calendar, usually placed c. 2800BC on the basis of analyses of the Sothic cycle, but a lunar calendar presumably long predated this and also would have had twelve months in each of its years. The coffin diagrams show that the Egyptians took note of the heliacal risings of 36 stars or constellations (now known as "decans"), one for each of the ten-day "weeks" of their civil calendar. (12 sets of alternate "triangle decans" were used for the 5 epagomenal days between years.) Each night, the rising of eleven of these decans were noted, separating the night into twelve divisions whose middle terms would have lasted about 40minutes each. (Another seven stars were noted by the Egyptians during the twilight and predawn periods, although they were not important for the hour divisions.) The original decans used by the Egyptians would have fallen noticeably out of their proper places over a span of several centuries. By the time of Amenhotep III (c. 1350BC), the priests at Karnak were using water clocks to determine the hours. These were filled to the brim at sunset and the hour determined by comparing the water level against one of its twelve gauges, one for each month of the year. During the New Kingdom, another system of decans was used, made up of 24 stars over the course of the year and 12 within any one night.

The later division of the day into 12 hours was accomplished by sundials marked with ten equal divisions. The morning and evening periods when the sundials failed to note time were observed as the first and last hours.

The Egyptian hours were closely connected both with the priesthood of the gods and with their divine services. By the New Kingdom, each hour was conceived as a specific region of the sky or underworld through which Ra's solar barge travelled. Protective deities were assigned to each and were used as the names of the hours. As the protectors and resurrectors of the sun, the goddesses of the night hours were considered to hold power over all lifespans and thus became part of Egyptian funerary rituals. Two fire-spitting cobras were said to guard the gates of each hour of the underworld, and Wadjet and the rearing cobra (uraeus) were also sometimes referenced as wnwt from their role protecting the dead through these gates. The Egyptian word for astronomer, used as a synonym for priest, was wnwty, "one of the wnwt", as it were "one of the hours". The earliest forms of wnwt include one or three stars, with the later solar hours including the determinative hieroglyph for "sun".

East Asia

Ancient China divided its day into 100 "marks" (Chinese:, oc *kʰək, p kè) running from midnight to midnight. The system is said to have been used since remote antiquity, credited to the legendary Yellow Emperor, but is first attested in Han-era water clocks and in the 2nd-century history of that dynasty. It was measured with sundials and water clocks. Into the Eastern Han, the Chinese measured their day schematically, adding the 20-ke difference between the solstices evenly throughout the year, one every nine days. During the night, time was more commonly reckoned during the night by the "watches" (Chinese:, oc *kæŋ, p gēng) of the guard, which were reckoned as a fifth of the time from sunset to sunrise.

Imperial China continued to use ke and geng but also began to divide the day into 12 "double hours" ( t, s , oc *də, p shí, lit. "time[s]") named after the earthly branches and sometimes also known by the name of the corresponding animal of the Chinese zodiac. The first shi originally ran from 11pm to 1am but was reckoned as starting at midnight by the time of the History of Song, compiled during the early Yuan. These apparently began to be used during the Eastern Han that preceded the Three Kingdoms era, but the sections that would have covered them are missing from their official histories; they first appear in official use in the Tang-era Book of Sui. Variations of all these units were subsequently adopted by Japan and the other countries of the Sinosphere.

The 12 shi supposedly began to be divided into 24 hours under the Tang, although they are first attested in the Ming-era Book of Yuan. In that work, the hours were known by the same earthly branches as the shi, with the first half noted as its "starting" and the second as "completed" or "proper" shi. In modern China, these are instead simply numbered and described as "little shi". The modern ke is now used to count quarter-hours, rather than a separate unit.

As with the Egyptian night and daytime hours, the division of the day into twelve shi has been credited to the example set by the rough number of lunar cycles in a solar year, although the 12-year Jovian orbital cycle was more important to traditional Chinese and Babylonian reckoning of the zodiac.

Southeast Asia
In Thailand, Laos, and Cambodia, the traditional system of noting hours is the six-hour clock. This reckons each of a day's 24 hours apart from noon as part of a fourth of the day. The first hour of the first half of daytime was 7 am; 1 pm the first hour of the latter half of daytime; 7 pm the first hour of the first half of nighttime; and 1 am the first hour of the latter half of nighttime. This system existed in the Ayutthaya Kingdom, deriving its current phrasing from the practice of publicly announcing the daytime hours with a gong and the nighttime hours with a drum. It was abolished in Laos and Cambodia during their French occupation and is uncommon there now. The Thai system remains in informal use in the form codified in 1901 by King Chulalongkorn.

India

The Vedas and Puranas employed units of time based on the sidereal day (nakṣatra ahorātra). This was variously divided into 30 muhūrta-s of 48 minutes each or 60 dandas or nadī-s of 24 minutes each. The solar day was later similarly divided into 60 ghaṭikás of about the same duration, each divided in turn into 60 vinadis. The Sinhalese followed a similar system but called their sixtieth of a day a peya.

Derived measures

 * air changes per hour (ACH), a measure of the replacements of air within a defined space used for indoor air quality
 * ampere hour (Ah), a measure of electrical charge used in electrochemistry
 * BTU-hour, a measure of power used in the power industry and for air conditioners and heaters
 * credit hour, a measure of an academic course's contracted instructional time per week for a semester
 * horsepower-hour (hph), a measure of energy used in the railroad industry
 * hour angle, a measure of the angle between the meridian plane and the hour circle passing through a certain point used in the equatorial coordinate system
 * kilometres per hour (km/h), a measure of land speed
 * kilowatt-hour (kWh), a measure of energy commonly used as an electrical billing unit
 * knot (kn), a measure of nautical miles per hour, used for maritime and aerial speed
 * man-hour, the amount of work performed by the average worker in one hour, used in productivity analysis
 * metre per hour (m/h), a measure of slow speeds
 * mile per hour (mph), a measure of land speed
 * passengers per hour per direction (p/h/d), a measure of the capacity of public transportation systems
 * pound per hour (PPH), a measure of mass flow rate used for engines' fuel flow
 * work or working hour, a measure of working time used in various regulations, such as those distinguishing part- and full-time employment and those limiting truck drivers' working hours or hours of service

title: Hour