SlideShare a Scribd company logo
1 of 3
Download to read offline
SPECIAL SECTION


      Guest Editor
      Peter Neumann                 The Complexity
                                    of Songs



                                    DONALD E. KNUTH




      Every day brings new evidence that the concepts of                              By the Distributive Law and the Commutative Law [4],
      computer science are applicable to areas of life which                          we have
      have little or nothing to do with computers. The pur-
                                                                                                        c= n-          (V+R)m   + mV
      pose of this survey paper is to demonstrate that impor-
      tant aspects of popular songs are best understood in                                                 = n-        Vm-Rm    + Vm                   (3)
      terms of modern complexity theory.
                                                                                                           =n-Rm.
        It is known [3] that almost all songs of length n re-
      quire a text of length ~ n. But this puts a considerable                        The lemma follows.          [3
      space requirement on one's memory if many songs are
      to be learned; hence, our ancient ancestors invented                               (It is possible to generalize this lemma to the case of
      the concept of a refrain [14]. When the song has a                              verses of differing lengths V1, V2. . . . ~Vm, provided that
      refrain, its space complexity can be reduced to cn,                             the sequence (Vk) satisfies a certain smoothness condi-
      where c < 1 as shown by the following lemma.                                    tion. Details will appear in a future paper.)
                                                                                         A significant improvement on Lemma 1 was discov-
      LEMMA 1.                                                                        ered in medieval European Jewish communities where
      Let S be a song containing m verses of length V and a                           an anonymous composer was able to reduce the com-
      refrain of length R where the refrain is to be sung first,                      plexity to O(x/n). His song "Ehad Mi Yode'a" or "Who
      last, and between adjacent verses. Then, the space                              Knows One?" is still traditionally sung near the end of
      complexity of S is ( V / ( V + R)) n + O(1) for fixed V                         the Passover ritual, reportedly in order to keep the chil-
      and R as m ~ oo.                                                                dren awake [6]. It consists of a refrain and 13 verses
                                                                                      vl . . . . . v13, where v~ is followed by vk-1 • .. v2vl before
      PROOF.                                                                          the refrain is repeated; hence m verses of text lead to
      T h e l e n g t h of S when s u n g i s                                         1/2m2 .-F O(m) verses of singing. A similar song called
                                                                                      "Green Grow the Rushes O" or "The Dilly Song" is
                                n =R+(V+R)m                                     (1)
                                                                                      often sung in western Britain at Easter time [1], but it
                                                                                      has only twelve verses (see [1]), where Breton, Flemish,
      while its space complexity is
                                                                                      German, Greek, Medieval Latin, Moldavian, and Scottish
                                    c = R + Vm.                                 (2)   versions are cited.
                                                                                         The coefficient of ~n was further improved by a Scot-
                                                                                      tish farmer named O. MacDonald, whose construction~
                                                                                      appears in Lemma 2.
      The research reported here was supported in part by the National Institute of
      Wealth under grant $262,144.                                                        ActuallyMacDonald'spriorityhas beendisputedby somescholars;Peter
                                                                                      Kennedy([8],p. 676)claimsthat "1BoughtMyselfa Cock"and similarfarm-
      ©1984ACMO001-0782/84/0400-0344 75¢                                              yard songsare actuallymucholder.




344   Communications of the ACM                                                                                         April 1984 Volume 27 Number 4
Special Section


L E M M A 2.                                                           when a is fixed. Therefore if MacDonald's farm animals
Given positive integers a and X, there exists a song                   ultimately have long names they should make slightly
whose complexity is (20 + X + a) ~/n/(30 + 2)0 + O(1).                 shorter noises.
                                                                          Similar results were achieved by a French Canadian
PROOF.                                                                 ornithologist, who named his song schema "Alouette"
Consider the following schema [9].                                     [2, 15]; and at about the same time by a Tyrolean
                                                                       butcher whose schema [5] is popularly called "Ist das
               V o = 'Old MacDonald had a farm, ' Ri
                                                                       nicht ein Schnitzelbank?" Several other cumulative
               R1 = 'Ee-igh, ,2 'oh! '                                 songs have been collected by Peter Kennedy [8], in-
                                                                       cluding "The Mallard" with 17 verses and "The Barley
         R2(x) -- Vo 'And on this farm he had                          Mow" with 18. More recent compositions, like "There's
                                                                       a Hole in the Bottom of the Sea" and "I Know an Old
                     some' x', ' R1 'With a'
                                                                       Lady Who Swallowed a Fly" unfortunately have com-
     U~(x, x') = x', ' x' ' here and a ' x', ' x ' ' there; '          paratively large coefficients.
                                                                          A fundamental improvement was claimed in England
      U2(x, y) = x'here a ' y, ' '                                     in 1824, when the true love of U. Jack gave to him a
     U3(x, x') = Ui(x, x')         U2(g, x)   U2('t', x ' )            total of 12 ladies dancing, 22 lords a-leaping, 30 drum-
                                                                       mers drumming, 36 pipers piping, 40 maids a-milking,
                     U2('everyw', x ' , ' x')                          42 swans a-swimming, 42 geese a-laying, 40 golden
                                                                       rings, 36 collie birds, 30 french hens, 22 turtle doves,
               Vk = U3(Wk, W~)Vk-i            for    k _> 1            and 12 partridges in pear trees during the twelve days
where                                                                  of Christmas [11]. This amounted to 1/6 m 3 -.b 1/2 m 2 -b 1/a
                                                                       m gifts in m days, so the complexity appeared to be
                    W1 = 'chick', W2 = 'quack',                        O(3~n); however, it was soon pointed out [10] that his
                    W3 = 'gobble', Wk = 'oink',                 (5)    computation was based on n gifts rather than n units of
                                                                       singing. A complexity of order ~/n/log n was finally
                    W5 = 'moo', W6 = 'hee' ,                           established (.see [7]).
                                                                          We have seen that the p a r t r i ~ in the pear tree gave
and
                                                                       an improvement of only 1/Vlog n; but the importance
                W~- = W k    for     k#6;W~          ='haw'.    (6)    of this discovery should not be underestimated since it
                                                                       showed that the n °5 barrier could be broken. The next
The song of order m is defined by
                                                                       big breakthrough was in fact obtained by generalizing
                                                                 (7)   the partridge schema in a remarkably simple way. It
                                                                       was J. W. Blatz of Milwaukee, Wisconsin who first dis-
                J~,~ = R2(W;[i)VmJ'~-I         for    m_>l,            covered a class of songs known as "m Bottles of Beer on
where                                                                  the Wall"; her elegant construction2 appears in the fol-
                                                                       lowing proof of the first major result in the theory.
                  W~' = 'chicks', W~' = 'ducks',
                                                                       THEOREM 1.
                  W3 = 'turkeys', W ~ = 'pigs',
                   "                                             (8)   There exis t songs of complexity O(log n).
                  W~' = 'cows', W~' = ' d o n k e y s ' .              PROOF.
                                                                       Consider the schema
The length of Y (m) is
                                                                                     Vk = TkBW', '
         n = 30m 2 + 153m
                                                                                             TkB'; '
                       + 4(m/1 + (m - 1)/2 -4- . . . + /m)
                                                                                             If one of those bottles should                       (12)
                       + (al + . . . + am)                       (9)
                                                                                                happen to fall, '
while the length of the corresponding schema is
                                                                                             Tk-iB W'.'
                 c = 20m + 211 + (/1 + . . . + / , , )
                                                                       where
                             + (al + . . . + a,,).              (10)
                                                                                               B = ' bottles of beer' ,                           (13)
HereA = IWkl + IW/I and ak = IW~Yl,where Ixl
denotes the length of string x. The result follows at                                         W = ' on the wall' ,
once, if we assume that ,~ = X and ak = a for all
large k. [3                                                            and where Tk is a translation of the integer k into Eng-
  Note that the coefficient (20 + X + a ) / ~ / ~ + 2X
                                                                           2 Again Kennedy ([8], p. 631) claims priority for the English, in this case
assumes its m i n i m u m value at                                     because of the song "I'11 drink m if you'll drink m + 1." However, the English
                                                                       start at m = 1 and get no higher than m = 9, possibly because they actually
                            k = max(l, a-lO)                   (11)    drink the beer instead of allowing the bottles to fall.




April 1984       Volume 27    Number 4                                                                                Communications of the ACM              34S
Special Section


         lish. It requires only O(m) space to define Tk for all                        Acknowledgment I wish to thank J. M. Knuth and J. S.
         k < 10" since we can define                                                   Knuth for suggesting the topic of this paper.
              Tq.lo.,.r = Tq ' times 10 to the ' Tin' plus ' T,                 (14)
                                                                                       REFERENCES
         for 1 _< q _< 9 and 0 _< r < 10m-L                                             1. Rev. S. Baring-Gould, Rev. H. Fleetwood Sheppard, and F.W. Bus-
                                                                                           sell, Songs of the West (London: Methuen, 1905}, 23, 160-161.
           Therefore the songs Sk defined by                                            2. Oscar Brand, Singing Holidays (New York: Alfred Knopf, 1957), 68-
                                                                                           69.
                        So=e,Sk=           VkSk-1 for k>_ 1                     (15)    3. G.J. Chaitin, "On the length of programs for computing finite binary
                                                                                           sequences: Statistical considerations," J. ACM 16 (1969), 145-159.
        have length n X k log k, but the schema which defines                           4. G. Chrystal, Algebra, an Elementary Textbook (Edinburgh: Adam and
        them has length O(log k); the result follows. [3                                   Charles Black, 1886), Chapter 1.
                                                                                        5. A. D6rrer, Tiroler Fasnacht (Wien, 1949), 480 pp.
          Theorem 1 was the best result known until recently 3,                         6. Encyclopedia Judaica (New York: Macmillan, 1971), v. 6 p. 503; The
        perhaps because it satisfied all practical requirements                            Jewish Encyclopedia (New York: Funk and Wagnalls, 1903); articles
        for song generation with limited memory space. In fact,                            on Ehad Mi Yode'a.
                                                                                        7. U. Jack, "Logarithmic growth of verses," Acta Perdix 15 (1826),
        99 bottles of beer usually seemed to be more than suffi-                           1-65535.
        cient in most cases.                                                            8. Peter Kennedy, Folksongs of Britain and Ireland (New York: Schirmer,
                                                                                           1975), 824 pp.
          However, the advent of modern drugs has led to
                                                                                        9. Norman Lloyd. The New Golden Song Book (New York: Golden Press,
        demands for still less memory, and the ultimate im-                                1955), 20-21.
        provement of Theorem 1 has consequently just been                              10. N. Picker, "Once sefiores brincando al mismo tiempo," Acta Perdix
                                                                                           12 (1825), 1009.
        announced:                                                                     11. ben shahn, a partridge in a pear tree (New York: the museum of
                                                                                           modern art, 1949), 28 pp. (unnumbered).
        THEOREM 2.                                                                     12. Cecil J. Sharp, ed., One Hundred English Folksongs (Boston: Oliver
        There exist arbitrarily long songs of complexity O(1).                             Ditson, 1916), xlii.
                                                                                       13. Christopher J. Shaw, "that old favorite, A p i a p t / a Christmastime al-
        PROOF: (due to Casey and the Sunshine Band). Consider                              gorithm," with illustrations by Gene Oltan, Datamation 10, 12 (De-
                                                                                           cember 1964), 48-49. Reprinted in Jack Moshman, ed., Faith, Hope
        the songs Sk defined by (15), but with                                             and Parity (Washington, D.C.: Thompson, 1966), 48-51.
                                                                                       14. Gustav Thurau, Beitr~ge zur Geschichte und Charakteristik des Refrains
                    Vk = 'That's the way,' U 'I like it, ' U                   (16)        in derfranzosischen Chanson (Weimar: Felber, 1899), 47 pp.
                                                                                       15. Marcel Vigneras, ed., Chansons de France (Boston: D.C. Heath. 1941),
                    U = 'uh huh,' 'uh huh'                                                 52 pp.

        for all k. [3
                                                                                       Permission to copy without fee all or part of this material is granted
          It remains an open problem to study the complexity                           provided that the copies are not made or distributed for direct commer-
        of nondeterministic songs.                                                     cial advantage, the ACM copyright notice and the title of the publication
                                                                                       and its date appear, and notice is given that copying is by permission of
          3 The chief rival for this honor was "This old man, he played m, he played   the Association for Computing Machinery. To copy otherwise, or to
        knick-knack...'.                                                               republish, requires a fee a n d / o r specific permission.




346     Communications of the ACM                                                                                          April 1984     Volume 27      Number 4

More Related Content

Recently uploaded

Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaCzechDreamin
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty SecureFemke de Vroome
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyJohn Staveley
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfFIDO Alliance
 
THE BEST IPTV in GERMANY for 2024: IPTVreel
THE BEST IPTV in  GERMANY for 2024: IPTVreelTHE BEST IPTV in  GERMANY for 2024: IPTVreel
THE BEST IPTV in GERMANY for 2024: IPTVreelreely ones
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Patrick Viafore
 
The UX of Automation by AJ King, Senior UX Researcher, Ocado
The UX of Automation by AJ King, Senior UX Researcher, OcadoThe UX of Automation by AJ King, Senior UX Researcher, Ocado
The UX of Automation by AJ King, Senior UX Researcher, OcadoUXDXConf
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityScyllaDB
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoTAnalytics
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...CzechDreamin
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfFIDO Alliance
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024Stephanie Beckett
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...marcuskenyatta275
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Julian Hyde
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomCzechDreamin
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutesconfluent
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIES VE
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGDSC PJATK
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekCzechDreamin
 

Recently uploaded (20)

Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty Secure
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
THE BEST IPTV in GERMANY for 2024: IPTVreel
THE BEST IPTV in  GERMANY for 2024: IPTVreelTHE BEST IPTV in  GERMANY for 2024: IPTVreel
THE BEST IPTV in GERMANY for 2024: IPTVreel
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
The UX of Automation by AJ King, Senior UX Researcher, Ocado
The UX of Automation by AJ King, Senior UX Researcher, OcadoThe UX of Automation by AJ King, Senior UX Researcher, Ocado
The UX of Automation by AJ King, Senior UX Researcher, Ocado
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Knuth song complexity

  • 1. SPECIAL SECTION Guest Editor Peter Neumann The Complexity of Songs DONALD E. KNUTH Every day brings new evidence that the concepts of By the Distributive Law and the Commutative Law [4], computer science are applicable to areas of life which we have have little or nothing to do with computers. The pur- c= n- (V+R)m + mV pose of this survey paper is to demonstrate that impor- tant aspects of popular songs are best understood in = n- Vm-Rm + Vm (3) terms of modern complexity theory. =n-Rm. It is known [3] that almost all songs of length n re- quire a text of length ~ n. But this puts a considerable The lemma follows. [3 space requirement on one's memory if many songs are to be learned; hence, our ancient ancestors invented (It is possible to generalize this lemma to the case of the concept of a refrain [14]. When the song has a verses of differing lengths V1, V2. . . . ~Vm, provided that refrain, its space complexity can be reduced to cn, the sequence (Vk) satisfies a certain smoothness condi- where c < 1 as shown by the following lemma. tion. Details will appear in a future paper.) A significant improvement on Lemma 1 was discov- LEMMA 1. ered in medieval European Jewish communities where Let S be a song containing m verses of length V and a an anonymous composer was able to reduce the com- refrain of length R where the refrain is to be sung first, plexity to O(x/n). His song "Ehad Mi Yode'a" or "Who last, and between adjacent verses. Then, the space Knows One?" is still traditionally sung near the end of complexity of S is ( V / ( V + R)) n + O(1) for fixed V the Passover ritual, reportedly in order to keep the chil- and R as m ~ oo. dren awake [6]. It consists of a refrain and 13 verses vl . . . . . v13, where v~ is followed by vk-1 • .. v2vl before PROOF. the refrain is repeated; hence m verses of text lead to T h e l e n g t h of S when s u n g i s 1/2m2 .-F O(m) verses of singing. A similar song called "Green Grow the Rushes O" or "The Dilly Song" is n =R+(V+R)m (1) often sung in western Britain at Easter time [1], but it has only twelve verses (see [1]), where Breton, Flemish, while its space complexity is German, Greek, Medieval Latin, Moldavian, and Scottish c = R + Vm. (2) versions are cited. The coefficient of ~n was further improved by a Scot- tish farmer named O. MacDonald, whose construction~ appears in Lemma 2. The research reported here was supported in part by the National Institute of Wealth under grant $262,144. ActuallyMacDonald'spriorityhas beendisputedby somescholars;Peter Kennedy([8],p. 676)claimsthat "1BoughtMyselfa Cock"and similarfarm- ©1984ACMO001-0782/84/0400-0344 75¢ yard songsare actuallymucholder. 344 Communications of the ACM April 1984 Volume 27 Number 4
  • 2. Special Section L E M M A 2. when a is fixed. Therefore if MacDonald's farm animals Given positive integers a and X, there exists a song ultimately have long names they should make slightly whose complexity is (20 + X + a) ~/n/(30 + 2)0 + O(1). shorter noises. Similar results were achieved by a French Canadian PROOF. ornithologist, who named his song schema "Alouette" Consider the following schema [9]. [2, 15]; and at about the same time by a Tyrolean butcher whose schema [5] is popularly called "Ist das V o = 'Old MacDonald had a farm, ' Ri nicht ein Schnitzelbank?" Several other cumulative R1 = 'Ee-igh, ,2 'oh! ' songs have been collected by Peter Kennedy [8], in- cluding "The Mallard" with 17 verses and "The Barley R2(x) -- Vo 'And on this farm he had Mow" with 18. More recent compositions, like "There's a Hole in the Bottom of the Sea" and "I Know an Old some' x', ' R1 'With a' Lady Who Swallowed a Fly" unfortunately have com- U~(x, x') = x', ' x' ' here and a ' x', ' x ' ' there; ' paratively large coefficients. A fundamental improvement was claimed in England U2(x, y) = x'here a ' y, ' ' in 1824, when the true love of U. Jack gave to him a U3(x, x') = Ui(x, x') U2(g, x) U2('t', x ' ) total of 12 ladies dancing, 22 lords a-leaping, 30 drum- mers drumming, 36 pipers piping, 40 maids a-milking, U2('everyw', x ' , ' x') 42 swans a-swimming, 42 geese a-laying, 40 golden rings, 36 collie birds, 30 french hens, 22 turtle doves, Vk = U3(Wk, W~)Vk-i for k _> 1 and 12 partridges in pear trees during the twelve days where of Christmas [11]. This amounted to 1/6 m 3 -.b 1/2 m 2 -b 1/a m gifts in m days, so the complexity appeared to be W1 = 'chick', W2 = 'quack', O(3~n); however, it was soon pointed out [10] that his W3 = 'gobble', Wk = 'oink', (5) computation was based on n gifts rather than n units of singing. A complexity of order ~/n/log n was finally W5 = 'moo', W6 = 'hee' , established (.see [7]). We have seen that the p a r t r i ~ in the pear tree gave and an improvement of only 1/Vlog n; but the importance W~- = W k for k#6;W~ ='haw'. (6) of this discovery should not be underestimated since it showed that the n °5 barrier could be broken. The next The song of order m is defined by big breakthrough was in fact obtained by generalizing (7) the partridge schema in a remarkably simple way. It was J. W. Blatz of Milwaukee, Wisconsin who first dis- J~,~ = R2(W;[i)VmJ'~-I for m_>l, covered a class of songs known as "m Bottles of Beer on where the Wall"; her elegant construction2 appears in the fol- lowing proof of the first major result in the theory. W~' = 'chicks', W~' = 'ducks', THEOREM 1. W3 = 'turkeys', W ~ = 'pigs', " (8) There exis t songs of complexity O(log n). W~' = 'cows', W~' = ' d o n k e y s ' . PROOF. Consider the schema The length of Y (m) is Vk = TkBW', ' n = 30m 2 + 153m TkB'; ' + 4(m/1 + (m - 1)/2 -4- . . . + /m) If one of those bottles should (12) + (al + . . . + am) (9) happen to fall, ' while the length of the corresponding schema is Tk-iB W'.' c = 20m + 211 + (/1 + . . . + / , , ) where + (al + . . . + a,,). (10) B = ' bottles of beer' , (13) HereA = IWkl + IW/I and ak = IW~Yl,where Ixl denotes the length of string x. The result follows at W = ' on the wall' , once, if we assume that ,~ = X and ak = a for all large k. [3 and where Tk is a translation of the integer k into Eng- Note that the coefficient (20 + X + a ) / ~ / ~ + 2X 2 Again Kennedy ([8], p. 631) claims priority for the English, in this case assumes its m i n i m u m value at because of the song "I'11 drink m if you'll drink m + 1." However, the English start at m = 1 and get no higher than m = 9, possibly because they actually k = max(l, a-lO) (11) drink the beer instead of allowing the bottles to fall. April 1984 Volume 27 Number 4 Communications of the ACM 34S
  • 3. Special Section lish. It requires only O(m) space to define Tk for all Acknowledgment I wish to thank J. M. Knuth and J. S. k < 10" since we can define Knuth for suggesting the topic of this paper. Tq.lo.,.r = Tq ' times 10 to the ' Tin' plus ' T, (14) REFERENCES for 1 _< q _< 9 and 0 _< r < 10m-L 1. Rev. S. Baring-Gould, Rev. H. Fleetwood Sheppard, and F.W. Bus- sell, Songs of the West (London: Methuen, 1905}, 23, 160-161. Therefore the songs Sk defined by 2. Oscar Brand, Singing Holidays (New York: Alfred Knopf, 1957), 68- 69. So=e,Sk= VkSk-1 for k>_ 1 (15) 3. G.J. Chaitin, "On the length of programs for computing finite binary sequences: Statistical considerations," J. ACM 16 (1969), 145-159. have length n X k log k, but the schema which defines 4. G. Chrystal, Algebra, an Elementary Textbook (Edinburgh: Adam and them has length O(log k); the result follows. [3 Charles Black, 1886), Chapter 1. 5. A. D6rrer, Tiroler Fasnacht (Wien, 1949), 480 pp. Theorem 1 was the best result known until recently 3, 6. Encyclopedia Judaica (New York: Macmillan, 1971), v. 6 p. 503; The perhaps because it satisfied all practical requirements Jewish Encyclopedia (New York: Funk and Wagnalls, 1903); articles for song generation with limited memory space. In fact, on Ehad Mi Yode'a. 7. U. Jack, "Logarithmic growth of verses," Acta Perdix 15 (1826), 99 bottles of beer usually seemed to be more than suffi- 1-65535. cient in most cases. 8. Peter Kennedy, Folksongs of Britain and Ireland (New York: Schirmer, 1975), 824 pp. However, the advent of modern drugs has led to 9. Norman Lloyd. The New Golden Song Book (New York: Golden Press, demands for still less memory, and the ultimate im- 1955), 20-21. provement of Theorem 1 has consequently just been 10. N. Picker, "Once sefiores brincando al mismo tiempo," Acta Perdix 12 (1825), 1009. announced: 11. ben shahn, a partridge in a pear tree (New York: the museum of modern art, 1949), 28 pp. (unnumbered). THEOREM 2. 12. Cecil J. Sharp, ed., One Hundred English Folksongs (Boston: Oliver There exist arbitrarily long songs of complexity O(1). Ditson, 1916), xlii. 13. Christopher J. Shaw, "that old favorite, A p i a p t / a Christmastime al- PROOF: (due to Casey and the Sunshine Band). Consider gorithm," with illustrations by Gene Oltan, Datamation 10, 12 (De- cember 1964), 48-49. Reprinted in Jack Moshman, ed., Faith, Hope the songs Sk defined by (15), but with and Parity (Washington, D.C.: Thompson, 1966), 48-51. 14. Gustav Thurau, Beitr~ge zur Geschichte und Charakteristik des Refrains Vk = 'That's the way,' U 'I like it, ' U (16) in derfranzosischen Chanson (Weimar: Felber, 1899), 47 pp. 15. Marcel Vigneras, ed., Chansons de France (Boston: D.C. Heath. 1941), U = 'uh huh,' 'uh huh' 52 pp. for all k. [3 Permission to copy without fee all or part of this material is granted It remains an open problem to study the complexity provided that the copies are not made or distributed for direct commer- of nondeterministic songs. cial advantage, the ACM copyright notice and the title of the publication and its date appear, and notice is given that copying is by permission of 3 The chief rival for this honor was "This old man, he played m, he played the Association for Computing Machinery. To copy otherwise, or to knick-knack...'. republish, requires a fee a n d / o r specific permission. 346 Communications of the ACM April 1984 Volume 27 Number 4