Skip to main content

Counting Strangers

  • Chapter
  • First Online:
Designing Sorting Networks

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD 54.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Reference

  1. Knuth D (1998) The art of computer programming: volume 3 sorting and searching, 2nd edn. Addison-Wesley Longman, USA, pp 225–228

    Google Scholar 

  2. Cormen T, Leiserson C, Rivest R, Stein C (2001) Introduction to algorithms, 2nd edn. McGraw-Hill Book Company, USA

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Sherenaz W. Al-Haj Baddar .

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics