C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Comparison NetworksA comparison network is made of wires and comparators. A comparator is a device with two inputs, x and y, and two outputs, x' and y,' where x'= min (x, y) In Comparison Networks input appear on the left and outputs on the right, with the smallest input value appearing on the top output and the largest input value appearing on the bottom output. Each comparator operates in O (1) time. In other words, we consider that the time between the appearance of the input values x and y and the production of the output values x' and y' is a constant. A wire transmits a value from place to place. A comparison network contains n input wires a1,a2,........an through which the benefits to be sorted enter the network, and n output wires b1,b2,......bn which produce the results computed by the network. Comparison Network is a set of comparators interconnected by wires. Running time of comparator can define regarding depth. Depth of a Wire: An input wire of a comparison network has depth 0. Now, if a comparator has two input wires with depths dx and dy' then its output wires have depth max (dx,dy) + 1. A sorting network is a comparison network for which the output sequence is monotonically increasing (that is b1≤ b2 ≤ ....bn) for every input sequence. Fig: A Sorting network based on Insertion Sort
Next TopicBitonic Sorting Network
|