Abstract
The number of strangers in each group must be found for each bracket case in order to help implement the strategy described in Sect.7.4. Thus, a new command, SHOW.STRNGR.CNTS, was added to the Sortnet program to perform this step. For b brackets, SHOW.STRNGR.CNTS displays a table with b columns and b + 1 rows—each entry in the table shows the maximum number of strangers in the corresponding group for the corresponding bracket. In order to implement the strategy in Sect.7.4, strangers need to be compared with other keys. We conjecture that the best choice is the key that eliminates the stranger in the largest number of 0/1-cases . A new command, SHOW.MATCHES, was added to the Sortnet program to help make these choices. The Sortnet SHOW.STRNGR.CNTS command counts strangers for the group -bracket cases. It doesn’t count strangers for 0/1-cases between the group brackets. Instead of counting strangers for the group-bracket cases, it’s better to count strangers from 0/1-cases which have one more and one less zero than the group-bracket cases. Thus, the SHOW.CNTS.PM1 was added to Sortnet. Also, the SHOW.CASES command was added to show every 0/1-case in the set of cases generated by GEN.CASES.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Reference
Knuth D (1998) The art of computer programming: volume 3 sorting and searching, 2nd edn. Addison-Wesley Longman, USA, pp 225–228
Cormen T, Leiserson C, Rivest R, Stein C (2001) Introduction to algorithms, 2nd edn. McGraw-Hill Book Company, USA
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
Copyright information
© 2011 Springer Science+Business Media, LLC
About this chapter
Cite this chapter
Al-Haj Baddar, S.W., Batcher, K.E. (2011). Counting Strangers . In: Designing Sorting Networks. Springer, New York, NY. https://doi.org/10.1007/978-1-4614-1851-1_8
Download citation
DOI: https://doi.org/10.1007/978-1-4614-1851-1_8
Published:
Publisher Name: Springer, New York, NY
Print ISBN: 978-1-4614-1850-4
Online ISBN: 978-1-4614-1851-1
eBook Packages: Computer ScienceComputer Science (R0)