Skip to main content

More Coding Tricks

  • Chapter
  • First Online:
Good Habits for Great Coding

Abstract

It has often been said that a person does not really understand something until he teaches it to someone else. Actually, a person does not really understand something until he can teach it to a computer, i.e., express it as an algorithm.

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 34.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 44.99
Price excludes VAT (USA)
  • Compact, lightweight 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

Notes

  1. 1.

    In case the reader is unaware, the highest award given in the field of computer science is the Turing Award. It is given annually by the ACM (Association for Computing Machinery) for lasting and important contributions of a technical nature to the computer field. The Turing Award was named for the early computer pioneer Alan Turing (1912–1954). Today Turing is considered to be the father of both computer science and artificial intelligence. In 1945 Turing was awarded the OBE (Order of the British Empire) for his code-breaking efforts during WWII. In 1952 Alan Turing was arrested for a homosexual encounter with a 19-year-old male. To stay out of prison, he submitted to a hormone “treatment” that had a detrimental effect on his body and mind. Two years later, at age 41, he was found dead by cyanide poisoning. The post-mortem ruled it a suicide, but his mother and many of his close friends believed it was an accident. See Wikipedia. In 1966 the Turing Award was established. In 1999, Time magazine declared Alan Turing one of the 100 most important people to live in the twentieth century. On December 24, 2013, Turing was granted a posthumous pardon by the Queen of England (only the fourth since WWII). In 2014, the Hollywood movie The Imitation Game was released. It chronicled Turing’s life as code breaker and his difficulties at the end of his life.

  2. 2.

    Answer: \( \mathrm{ceil}\left({\log}_2\left(10,000,000\right)\right)=\mathrm{ceil}\left(\frac{\log_{10}\left(10,000,000\right)}{\log_{10}(2)}\right)=24. \)

  3. 3.

    Answer: 7 checks. The eccentric shopper must have a $1 check. Then if the next check is for $2, he can buy anything up to $3. So his third check should be for $4. Then he can buy anything up to $7. So his fourth check should be for $8. You see the pattern: $1, $2, $4, $8, $16, $32, $64. By this argument any positive integer can be expressed as the sum of distinct powers of two. So 23 is expressed as the sum 1 + 2 + 4 + 16.

  4. 4.

    My definition: A proof is a convincing argument. Consequently, a proof can be wrong. There are several famous cases of this in the history of mathematics. Kempe’s published proof and Tait’s published proof of the four-color theorem come to mind. Each went unchallenged for 11 years. Also, what is accepted as a proof for one generation is sometimes not sufficient for a later generation. “Sufficient unto the day is the rigor thereof.”—E.H. Moore (1903).

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2018 Michael Stueben

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Stueben, M. (2018). More Coding Tricks. In: Good Habits for Great Coding. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-3459-4_4

Download citation

Publish with us

Policies and ethics