Algorithms and Data Structures - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

Algorithms and Data Structures

Description:

Practical classes, 32 hours, 16 weeks. Grading consists of home works and examination ... J ri Kiho, Algoritmid ja Andmesruktuurid,Tartu 1994(1st edition), Tartu 1997 ... – PowerPoint PPT presentation

Number of Views:48
Avg rating:3.0/5.0
Slides: 25
Provided by: dim92
Category:

less

Transcript and Presenter's Notes

Title: Algorithms and Data Structures


1
Algorithms and Data Structures
  • Lecture 1

2
Agenda
  • Course Overview
  • Goals of the Course
  • Syllabus
  • Notation
  • Basics of Algorithms
  • Algorithms Evaluation

3
Course Overview
  • Lectures, 32 hours, 16 weeks
  • Practical classes, 32 hours, 16 weeks
  • Grading consists of home works and examination
  • Examination (up to 80)
  • Homework assignments (up to 20)
  • 3 Homework assignments
  • Each homework consists of several small tasks

4
Milestones
  • Home Work I Completes by March 1, 2002
  • Home Work II Completes by April 1, 2002
  • Home Work III Completes by May 1, 2002
  • Examination Date is NA

5
Contacts
  • Dmitri Brodski, Lecturer dimetr_at_previo.ee
  • Mike Pikkov, Mentor for practical classes
    pikkov_at_previo.ee
  • Course main WWW, lectures, homework assignments,
    announces www.itcollege.ee/dmitri
  • Practice materials, homework results
    www.itcollege.ee/mike

6
Organization
  • Classes are not obligatory, you are free whether
    to visit or not
  • Home assignments could be obtained from WWW
  • Accomplished assignments should be sent by e-mail
    to a practice mentor pikkov_at_previo.ee
  • Name, Group, IT College ID, Assignment ID

7
Environment
  • Every standard C compiler is acceptable for
    training
  • MS VC 6.0 will be used during practical classes

8
Goals of the Course
  • Give an overview of various classical algorithms
  • Give an overview of algorithm construction and
    evaluation
  • Give an overview of various data structures and
    their implementations in C language
  • Develop rational and creative approach to given
    tasks

9
Literature
  • Thomas H. Cormen, Charles E. Leiserson, Ronald L.
    Rivest Introduction to Algorithms
  • Jüri Kiho, Algoritmid ja Andmesruktuurid,Tartu
    1994(1st edition), Tartu 1997 (2nd edition),
    Tartu Ülikool

10
Syllabus
  • Basics of Algorithms
  • Algorithms Evaluation
  • Algorithms Construction
  • Data Structures
  • Sorting Algorithms
  • Graph Processing
  • Text Processing
  • Algorithms on Plane Geometry
  • Some Simple Mathematical Algorithms

11
Basics of Algorithms
  • Definition Algorithm is a formally described
    computational procedure consisting of zero or
    more elementary steps.
  • Elementary step evaluation, assignment, loop
    iteration and others.
  • Every algorithm works on some source data (INPUT)
    and produces some resulting data (OUTPUT) it is
    a function OUTPUT F(INPUT).
  • Every algorithm solves some computational problem
    what should be formally specified in terms of its
    INPUT and OUTPUT e.g. sorting task INPUT set of
    N numbers lta1, a2, , an gt OUTPUT rearranged
    set lta1, a2, , an gt where a1lt a2lt lt
    an.

12
Basics of Algorithms
  • Definition Algorithms is correct if for any
    acceptable (for the problem) INPUT it always
    completes its execution and produces an OUTPUT
    that complies with the specification of the
    problem.
  • If algorithm is correct (regarding the given
    problem specification), we say that it solves the
    problem.
  • Sometimes incorrect algorithms may be useful if
    we need to solve a problem for some particular
    INPUT usage of incorrect algorithms is a quite
    rare practice.

13
Algorithms Evaluation
  • Why do we analyze and evaluate various
    algorithms?
  • Definition running time of an algorithm is a
    number of elementary operations performed by the
    algorithm for the given INPUT.
  • Each line of code has a value in terms of
    elementary operations, lets denote it cj ,where
    j index of line.
  • Most common evaluation purpose is to determine a
    function describing how running time depends on
    the INPUT size such a function is usually
    denoted as T(n) (time on n), n characterizes
    size of INPUT

14
Algorithms Evaluation
15
Algorithms Evaluation
16
Algorithms Evaluation
  • T(n) c1(n1)c2nc3kc5(n-k)
  • c3 c5, lets use c3 instead of c5
  • T(n) c1(n1)c2nc3kc3(n-k)
  • T(n) c1nc2nc3kc3n-c3kc1
  • T(n) c1nc2nc3nc1
  • T(n) n(c1c2c3)c1
  • Lets denote a c1c2c3, b c1
  • T(n) anb, linear function

17
Algorithms Evaluation
  • Sometimes running time depends on kind of INPUT
    data e.g. running time of sorting algorithm may
    depend on INPUT data, not only size of the INPUT
    e.g. INPUT data may be already sorted or not
    sorted at all.
  • There are three measurable quantities available
    best-case running time, worst-case running time
    and average-case running time.
  • Best-case running time lowest value of running
    time that algorithm can spend handling INPUT of
    the size N.
  • Worst-case running time highest value of
    running time that algorithm can spend handling
    INPUT of size N.

18
Algorithms Evaluation
  • Average-case running time is mostly expected
    (or predicted) average time needed to handle an
    INPUT of size N usually depends on probability
    distribution for particular type of INPUT data.
  • Best- and Worst- case running times may differ
    greatly.
  • Worst-case running time is most interesting
    measurable quantity, because ....

19
Algorithms Evaluation
  • If we know WCRT we may guaranty that the
    algorithm completes its execution in a certain
    time limit, for INPUT of given size.
  • In practice, worst-cases are highly probable,
    e.g. database query for non-existent element.
  • In practice, ACRT is very close to WCRT.

20
Algorithms Evaluation
21
Algorithms Evaluation
22
Algorithms Evaluation
  • BCRT(n) c1c2c4c5
  • Lets denote c c1c2c4c5
  • BCRT(n) c
  • c - some constant value for INPUT of any size
  • BCRT(n) in this case does not depend on n
  • BCRT C constant function

23
Algorithms Evaluation
24
Algorithms Evaluation
  • WCRT(n) c1(n1)c2n
  • WCRT(n) c1nc2nc1
  • WCRT(n) n(c1c2)c1
  • Lets denote a c1c2, b c1
  • WCRT(n) anb, linear function
Write a Comment
User Comments (0)
About PowerShow.com