1 / 20

CSC 2300 Data Structures & Algorithms

CSC 2300 Data Structures & Algorithms. January 16, 2007 Chapter 1. Introduction. Class Room. New Classroom: Ricketts 211 Course web page: http://www.cs.rpi.edu/academics/courses/spring07/dsa/. Initial Plan for Grades. Ten labs: 15% Ten homework: 20% Exam 1 20% Exam 2 20%

Download Presentation

CSC 2300 Data Structures & Algorithms

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSC 2300Data Structures & Algorithms January 16, 2007 Chapter 1. Introduction

  2. Class Room • New Classroom: Ricketts 211 • Course web page: http://www.cs.rpi.edu/academics/courses/spring07/dsa/

  3. Initial Plan for Grades • Ten labs: 15% • Ten homework: 20% • Exam 1 20% • Exam 2 20% • Final 25%

  4. Today’s Class • We begin our study of the mathematical background for the design and analysis of algorithms. • We need a mathematical basis and a set of analytical tools for • Predicting efficiency of algorithms • Choosing between different algorithms to solve the same problem • Just implementing and testing algorithms is not sufficient.

  5. Sets • A set is an unordered collection of distinct objects (called elements). • These elements may be anything, including other sets. • There are many special sets with special designations: • Z is the set of integers • N is the set of natural numbers (integers beginning with 0) • R is the set of real numbers • The set with no elements, often called the “null set” or the “empty set,” is denoted { } or ø

  6. Elements of Set • The elements of a set may be specified in a number of ways. The simplest one is to list the elements, e.g., V = {a, u, e, i, o}. • We use the notation “a ε V” to say “a is an element of V. ” • Another way to specify the elements of a set is to describe them logically using what is referred to as “set-builder notation.” For example, S = {x | x ε R and 0 ≤ x ≤ 1} is the set of all real numbers in the interval from 0 to 1, inclusive of end points.

  7. Subset • A set S is a subset of another set T if and only if each element of S is also an element of T. This is denoted by S T. • The power set of a set S, denoted by P(S), is the collection of all subsets of S. • The cardinality of a set S, denoted by |S|, is the number of distinct elements of S.

  8. Cartesian Product • The Cartesian product of two sets, A and B, denoted by A×B, is the set of all ordered pairs (a, b), where a ε A and b ε B, i.e., A × B = {(a, b) | a ε A, b ε B} • New sets may be formed from existing sets, S and T, by a variety of operations, such as union (S U T), intersection (S ∩ T), set difference (S − T) and set complement . Set complement requires the notion of a “universal set” U, from which set elements can be drawn.

  9. Set Difference • Most of these set operations should be familiar. The only one that might be new is set difference: S − T = {x | x ε S and x T}. • Two sets, A and B, are said to be disjoint if A ∩ B = { }.

  10. Exercise • Given S = {a, b} and T = {0, a, {1, 2}}. • List the elements of T. • List all subsets of S. • What is |S|? What is |T|? • What are S ∩ T and S − T?

  11. Functions • A function, f, is a mapping from one set A, called the domain, to another set B, called the co-domain, that associates each element of A with a single element of B. • We write this as f : A → B. • If a ε A and f maps a to b, we write f(a) = b. • The range of f is the set containing all b ε B such that f(a) = b for some a ε A.

  12. Special Functions • Special functions of interest • Floor: f(x) = . This is the largest integer less than or equal to x. • Ceiling: f(x) = . This is the smallest integer greater than or equal to x. • Factorial: f(n) = n!. Note that the domain of this function is the natural numbers.

  13. Exponentiation (base b)

  14. Logarithm

  15. Exercises

  16. Summations

  17. Special Summation Formulas

  18. Rules for Manipulation

  19. Exercise 1

  20. Exercises 2 and 3

More Related