Basic counting and listing-lecture notes

Basic counting and listing-lecture notes - Unit CL Basic...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Unit CL Basic Counting and Listing Section 1: Lists with Repetitions We begin with some matters of terminology and notation. Two words that we shall often use are set and list . (Lists are also called strings .) Both words refer to collections of objects. There is no standard notation for lists. Some of those in use are apple banana pear peach apple , banana , pear , peach and (apple , banana , pear , peach) . The notation for sets is standard: the items are separated by commas and surrounded by curly brackets as in { apple , banana , pear , peach } . The curly bracket notation for sets is so well established that you can normally assume it means a set — but beware, some mathematical software systems use {} (curly brackets) for lists. What is the difference between a set and a list? “Set” means a collection of distinct objects in which the order doesn’t matter. Thus { apple , peach , pear } and { peach , apple , pear } are the same sets, and the set { apple , peach , apple } is the same as the set { apple , peach } . In other words, repeated elements are treated as if they occurred only once. Thus two sets are the same if and only if each element that is in one set is in both. In a list, order is important and repeated objects are usually allowed. Thus (apple , peach) (peach , apple) and (apple , peach , apple) are three different lists. Two lists are the same if and only if they have exactly the same items in exactly the same positions. Thus, “sets” and “lists” represent different concepts: A list is always ordered and a set has no repeated elements . Example 1 (Using the terminology) People, in their everyday lives, deal with the issues of “order is important” and “order is not important.” Imagine that Tim, Jane, and Linda are going to go shopping for groceries. Tim makes a note to remind himself to get apples and bananas. Tim’s note might be written out in an orderly manner, or might just be words randomly placed on a sheet of paper. In any case, the purpose of the note is to remind him to buy some apples and bananas and, we assume, the order in which these items are noted is not important. The number of apples and bananas is not specified in the note. That will be determined at the store after inspecting the quality of the apples and bananas. The best model for this note is a set. Tim might have written c circlecopyrt Edward A. Bender & S. Gill Williamson 2005. All rights reserved.
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Basic Counting and Listing { apples, bananas } . We have added the braces to emphasize that we are talking about sets. Suppose Jane wrote { bananas, apples } and Linda wrote { apples, bananas, apples } . Linda was a bit forgetful and wrote apples twice. It doesn’t matter. All three sets are the same and all call for the purchase of some apples and some bananas. If Linda’s friend Mary had made the note { peaches, bananas, oranges } and Linda and Mary had decided to combine their notes and go shopping together, they would have gone to the store to get { apples, peaches, bananas, oranges } .
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern