Home > Articles > Software Development & Management

An Interview with Robert Sedgewick on the Analysis of Algorithms

  • Print
  • + Share This
Andrew Binstock interviews Robert Sedgewick, co-author of An Introduction to the Analysis of Algorithms, about the new edition of his book, the role of analysis of algorithms in computing, and his favorite books on algorithms.
Like this article? We recommend

Robert Sedgewick is probably best known among programmers for his books on algorithms. Within computer science though, his reputation rests on his work in the mathematical analysis of algorithms. He is currently a professor of computer science at Princeton University. Andrew Binstock interviews him on the occasion of the publication of the second edition of his seminal work with his late co-author Philippe Flajolet, An Introduction to the Analysis of Algorithms.

Andrew Binstock: What is new and different in this edition? Why should someone with the first edition buy this volume?

Robert Sedgewick: The main difference is a new chapter in the middle that provides an introduction to analytic combinatorics. The first half of the book is an introduction to the math that serves as the basis for analytic combinatorics; the second half of the book covers applications that show off the power of the approach.

Andrew:  Has the role of analysis of algorithms in computing changed significantly in the time span between the two editions? If so, how?

Robert: Mathematical models that can serve as the basis for the scientific study of the performance of computer programs have played a critical role in the development of our computational infrastructure. They are no less important now, as that infrastructure continues to evolve. One surprise (to me) in the two decades Philippe and I worked on analytic combinatorics is that the models and methods we address are no less important in many other scientific disciplines. That is, the potential impact of our work is much broader than I imagined when we embarked on this work more than 25 years ago.  

The methods of teaching the analysis of algorithms have changed significantly as well. For example, I'll shortly be teaching an online course from this book. I’m also doing a course on analytic combinatorics in November.

Andrew: You wrote in Sec 1.1 of the new book, "…analysis of algorithms has been used to describe…general approaches to putting the study of the performance of computer programs on a scientific basis." And the book takes this approach, strictly. So, am I right that analysis of algorithms does not involve proving the success of the algorithm? For example, if I write an algorithm to generate random numbers, analysis of the quality of my results is not, strictly speaking, part of analysis of algorithms. Just the performance. Is that right?

Robert: No, "performance," as I use the term, is intended to mean "any property of interest." Most often, it's some cost measure like time or space, but others are certainly within scope.

Andrew:  In the context of pure performance, the only reference to parallel processing or concurrency in the book is this statement near the end (p. 465) which comes in a discussion of strings. You observe "This [work in parallel] can lead to substantial speedups for some applications." In fact, parallelizing algorithms, such as sorts and searches can profoundly change the performance profile. Why would parallel processing and concurrency not be major topics in a treatment of analysis of algorithms?

Robert: We just cover the basic foundations, which are broadly applicable. Any demonstration of the effectiveness of parallelism and concurrency will have to use the scientific method: build appropriate mathematical models, develop hypotheses about performance, and validate the hypotheses through experimentation. This situation is quite familiar in other fields of science. For example, the same basic foundations can predict where a stone thrown by a child will land and where a mortar shell will land, but no calculus text describes the properties of all sorts of projectiles in detail. 

Andrew: In section 9.3, you briefly discuss the effects of caches. But nowhere do you mention cache-aware and cache-oblivious algorithms. Is this material for a 3rd edition or are they irrelevant to analysis of algorithms? If the latter, why would something as closely tied to algorithm performance as caches not be relevant?

Robert: Yes, I'd like to write about cache-oblivious algorithms. That's a good example where people have demonstrated that these methods are effective via the scientific method. 

Andrew: Your book involves considerable mathematics. However, if I turn to an article in Dr. Dobb’s written by you and Jon Bentley on radix sorts, you state with regard to quicksort: "On most systems, [Quicksort] is indeed an efficient and powerful general-purpose tool. But the power of the general compare function comes at a price in performance. Experiments we've conducted show that our specialized string sort can be faster than qsort by a factor of four." (emphasis mine) What then is the balance between empirical determination of performance optimization capabilities and the mathematical approach embraced by analysis of algorithms? Extending the question: How should programmers use analysis of algorithms--should it be an adjunct to hands-on testing? How would this work out in a real-world situation where a new algorithm is being implemented?

Robert: That's a fine example of the scientific method in action. We run experiments, develop mathematical models that help us develop hypotheses about performance and choose values of parameters, then run more experiments and to validate and refine the models. Several research papers followed that Dr. Dobb’s article, developing detailed mathematical models that have helped us better understand string sorting. No one should "implement a new algorithm" without having some way to predict performance and validate the implementation.

Andrew: A common complaint about Knuth's The Art of Computer Programming is that the material relies very heavily on mathematics, and so it deters working programmers (as opposed to computer scientists). Your work embraces math. Is there no way for working programmers to approach analysis of algorithms save though the portal of calculus?

Robert: In many situations, it is not difficult at all. We give a simple model in Algorithms, 4th edition that is often effective: Ask yourself the following question: what happens to the running time if the input size is doubled? If it doubles, you have a linear time algorithm; if it goes up by a factor of 4, you have a quadratic algorithm, which does not scale to huge input sizes. All too often products with this simple but glaring defect are shipped to customers.

Sure, the mathematics can get complicated, and no one is advocating that every programmer fully analyze every algorithm, but every programmer should know to avoid poor performance for applications that can have huge inputs. 

Not everything that one studies need have direct application to the job at hand. Lots of programmers are intrigued by the sorts of problems addressed by Knuth. One goal of our book is to give people the basic tools they need to learn more.

I'm finding that many programmers nowadays have much more math and science background than in the not-so-distant past, precisely because mathematics and the scientific approach are essential in a broad swath of modern development 

Andrew: Can data structures be analyzed as rigorously as algorithms? For example, the performance of one kind of tree vs. another or open vs. closed hash tables—and so on.

Robert: Yes. Algorithms and data structures go hand-in-hand, so that analyzing properties of a data structure can tell us what we need to know to analyze an algorithm.

Andrew: Algorithms today are primarily implemented as libraries. Like data structures, developers rarely write them from scratch anymore. While this might signal the triumph of reusable code, it seems to me that developers are losing the ability to write or even to understand algorithms. Do you see an erosion of skills with regard to algorithm design and implementation? If so, what needs to change?

Robert: One thing that we have learned is that people need to focus on narrow interfaces because wide interfaces contain performance traps. Programmers tend to assume that library implementations will be efficient, but it is often the case that various combinations of methods in a wide interface will lead to poor performance, unbeknownst to the programmer. Again, every programmer needs to validate any assumptions about performance through analysis and experimentation.

Andrew:  In a 1999 interview, you were asked to list the top 10 books every developer should have. Here is the list you gave then. What would that list be today?

Robert: Let me respond with a list of good books on algorithms. Including my own, I’d point to these volumes:

Andrew: Terrific. Thank you!

Andrew Binstock is the editor in chief of Dr. Dobb’s. He previously interviewed Donald Knuth for InformIT.

  • + Share This
  • 🔖 Save To Your Account

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020