COP 3530: Data Structures, Algorithms, & Applications Instructor: Kristian Linn Damkjer.

22
COP 3530: Data COP 3530: Data Structures, Algorithms, Structures, Algorithms, & Applications & Applications Instructor: Kristian Linn Instructor: Kristian Linn Damkjer Damkjer

Transcript of COP 3530: Data Structures, Algorithms, & Applications Instructor: Kristian Linn Damkjer.

Page 1: COP 3530: Data Structures, Algorithms, & Applications Instructor: Kristian Linn Damkjer.

COP 3530: Data COP 3530: Data Structures, Algorithms, & Structures, Algorithms, &

ApplicationsApplications

Instructor: Kristian Linn Instructor: Kristian Linn DamkjerDamkjer

Page 2: COP 3530: Data Structures, Algorithms, & Applications Instructor: Kristian Linn Damkjer.

Course OverviewCourse Overview

Syllabus ReviewSyllabus Review

Page 3: COP 3530: Data Structures, Algorithms, & Applications Instructor: Kristian Linn Damkjer.

What The Course Is AboutWhat The Course Is AboutApplications are developed to solve Applications are developed to solve

real-world problems.real-world problems.All programs manipulate data.All programs manipulate data.Programs must represent data in some Programs must represent data in some

way.way.Data structures focuses on data Data structures focuses on data

representation and manipulation.representation and manipulation.Data manipulation requires algorithms.Data manipulation requires algorithms.Algorithms are the fundamental Algorithms are the fundamental

elements in application development.elements in application development.

Page 4: COP 3530: Data Structures, Algorithms, & Applications Instructor: Kristian Linn Damkjer.

PrerequisitesPrerequisitesJava™Java™

CIS 3020 or CIS 3022 & CIS 3023CIS 3020 or CIS 3022 & CIS 3023You should be proficient and self-You should be proficient and self-

sufficientsufficientYou must be capable of writing You must be capable of writing

programs without the aid of a programs without the aid of a compiler.compiler.

Page 5: COP 3530: Data Structures, Algorithms, & Applications Instructor: Kristian Linn Damkjer.

PrerequisitesPrerequisitesAsymptotic ComplexityAsymptotic Complexity

COT 3100COT 3100We will use primarily We will use primarily OO notation. notation.

ff((nn) = ) = OO((gg((nn)))): Big Oh notation: Big Oh notationff((nn)) is bounded above by is bounded above by gg((nn))

You should also be comfortable with You should also be comfortable with ΘΘ and and ΩΩ..ff((nn) = ) = ΘΘ((gg((nn)))): Big Theta notation: Big Theta notation

ff((nn)) is asymptotically equivalent to is asymptotically equivalent to gg((nn))ff((nn) = ) = ΩΩ((gg((nn)))): Big Omega notation: Big Omega notation

ff((nn)) is bounded below by is bounded below by gg((nn))

Page 6: COP 3530: Data Structures, Algorithms, & Applications Instructor: Kristian Linn Damkjer.

PrerequisitesPrerequisitesStrong Mathematical ReasoningStrong Mathematical Reasoning

Any of the various flavors of Calculus 2.Any of the various flavors of Calculus 2.At the very least you need to At the very least you need to

understand:understand:SequencesSequencesSeriesSeriesSummationsSummationsIntegrationIntegrationDifferentiationDifferentiationMatricesMatricesVectorsVectors

Page 7: COP 3530: Data Structures, Algorithms, & Applications Instructor: Kristian Linn Damkjer.

Web SitesWeb Sites http://www.cise.ufl.edu/~kdamkjer/courses/su05/http://www.cise.ufl.edu/~kdamkjer/courses/su05/

cop3530/cop3530/ AnnouncementsAnnouncements SyllabusSyllabus HandoutsHandouts Exercise SolutionsExercise Solutions AssignmentsAssignments TAs and DiscussionsTAs and Discussions

http://www.cise.ufl.edu/~sahni/cop3530/http://www.cise.ufl.edu/~sahni/cop3530/ TextText Source CodesSource Codes Past ExamsPast Exams Past Exam SolutionsPast Exam Solutions

Page 8: COP 3530: Data Structures, Algorithms, & Applications Instructor: Kristian Linn Damkjer.

AssignmentsAssignmentsAssignment guidelinesAssignment guidelinesSubmission proceduresSubmission proceduresDo Assignment Do Assignment 00 by Friday! by Friday!

Page 9: COP 3530: Data Structures, Algorithms, & Applications Instructor: Kristian Linn Damkjer.

Source CodesSource CodesRead download and use instructions.Read download and use instructions.Read download and use instructions.Read download and use instructions.Must have Java 1.2 or higherMust have Java 1.2 or higher

Hopefully you have 1.4.2 or 1.5.0 (5.0)Hopefully you have 1.4.2 or 1.5.0 (5.0)Review the source code Review the source code

documentationdocumentationProgramIndex.htmlProgramIndex.htmlAllNames.htmlAllNames.htmlOther HTML files produced by JavadocOther HTML files produced by Javadoc

Page 10: COP 3530: Data Structures, Algorithms, & Applications Instructor: Kristian Linn Damkjer.

Discussion SectionsDiscussion SectionsGo to either oneGo to either oneTAs will answer your questions on TAs will answer your questions on

lectures and assignments.lectures and assignments.TAs will cover exercises from the TAs will cover exercises from the

text.text.Web site lists topics and exercises Web site lists topics and exercises

for each discussion section.for each discussion section.

Page 11: COP 3530: Data Structures, Algorithms, & Applications Instructor: Kristian Linn Damkjer.

TextbookTextbook It’s not rocket science (really)It’s not rocket science (really)

It’s computer scienceIt’s computer science

There are three sections to the There are three sections to the textbook:textbook:Background (Chapters 1-4)Background (Chapters 1-4)Data Structures (Chapters 5-17)Data Structures (Chapters 5-17)Algorithms (Chapters 18-22)Algorithms (Chapters 18-22)

What about Applications?What about Applications?We’ll cover applications throughout the We’ll cover applications throughout the

entire semester along with general theory entire semester along with general theory and other concepts.and other concepts.

Page 12: COP 3530: Data Structures, Algorithms, & Applications Instructor: Kristian Linn Damkjer.

GradesGradesAssignments: 25%Assignments: 25%

Five Graded ProjectsFive Graded ProjectsNo drops permittedNo drops permittedEach worth 5%Each worth 5%

Exams: 75%Exams: 75%Three ExamsThree ExamsNo drops permittedNo drops permittedEach worth 25%Each worth 25%

Page 13: COP 3530: Data Structures, Algorithms, & Applications Instructor: Kristian Linn Damkjer.

GradesGradesHistoric CutoffsHistoric Cutoffs

AA ≥ 83%≥ 83%B+B+ ≥ 75%≥ 75%BB ≥ 70%≥ 70%C+C+ ≥ 65%≥ 65%CC ≥ 60%≥ 60%D+D+ ≥ 55%≥ 55%DD ≥ 50%≥ 50%

Page 14: COP 3530: Data Structures, Algorithms, & Applications Instructor: Kristian Linn Damkjer.

Classic ProblemClassic Problem

SortingSorting

Page 15: COP 3530: Data Structures, Algorithms, & Applications Instructor: Kristian Linn Damkjer.

Classic Problem: SortingClassic Problem: SortingGiven a list of comparable elements:Given a list of comparable elements:

aa00, , aa11, … ,, … ,aann−1−1

Rearrange the list into a specific orderRearrange the list into a specific orderTypically increasing or decreasing order.Typically increasing or decreasing order.

Page 16: COP 3530: Data Structures, Algorithms, & Applications Instructor: Kristian Linn Damkjer.

Classic Problem: SortingClassic Problem: SortingGiven a list of comparable elements:Given a list of comparable elements:

aa00, , aa11, … ,, … ,aann−1−1

Rearrange the list into a specific orderRearrange the list into a specific orderTypically Typically increasingincreasing or decreasing order. or decreasing order.

Objective:Objective:aa00 ≤ ≤ aa11 ≤ … ≤ ≤ … ≤ aann−1−1

Examples:Examples:8, 6, 9, 4, 3 8, 6, 9, 4, 3 3, 4, 6, 8, 9 3, 4, 6, 8, 98, 3, 6, 2, 8, 10, 2 8, 3, 6, 2, 8, 10, 2 2, 2, 3, 6, 8, 8, 10 2, 2, 3, 6, 8, 8, 10

Page 17: COP 3530: Data Structures, Algorithms, & Applications Instructor: Kristian Linn Damkjer.

Sorting MethodsSorting Methods InsertionInsertionBubbleBubbleSelectionSelectionCountCountShakerShakerShellShellHeapHeapMergeMergeQuickQuick

Page 18: COP 3530: Data Structures, Algorithms, & Applications Instructor: Kristian Linn Damkjer.

Sorting MethodsSorting Methods InsertionInsertionBubbleBubbleSelectionSelectionCountCountShakerShakerShellShellHeapHeapMergeMergeQuickQuick

Page 19: COP 3530: Data Structures, Algorithms, & Applications Instructor: Kristian Linn Damkjer.

Inserting an ElementInserting an ElementGiven a sorted list (sequence), Given a sorted list (sequence),

insert a new elementinsert a new elementGiven Given 3, 6, 9, 143, 6, 9, 14Insert Insert 55Result Result 3, 5, 6, 9, 143, 5, 6, 9, 14

Page 20: COP 3530: Data Structures, Algorithms, & Applications Instructor: Kristian Linn Damkjer.

Inserting an ElementInserting an ElementInsert Insert 55 into the list: into the list: 3, 6, 9, 143, 6, 9, 14Compare new element (Compare new element (55) and last ) and last

element in list (element in list (1414))Shift Shift 1414 right to get right to get 3, 6, 9, 3, 6, 9, , 14, 14Shift Shift 99 right to get right to get 3, 6, 3, 6, , 9, 14, 9, 14Shift Shift 66 right to get right to get 3, 3, , 6, 9, 14, 6, 9, 14Insert Insert 55 to get to get 3, 5, 6, 9, 143, 5, 6, 9, 14

Page 21: COP 3530: Data Structures, Algorithms, & Applications Instructor: Kristian Linn Damkjer.

Inserting an ElementInserting an Element// insert t into a[0:i-1]// insert t into a[0:i-1]

intint j; j;

forfor (j = i – 1; j >= 0 && t < a[j]; j--) (j = i – 1; j >= 0 && t < a[j]; j--)

a[j + 1] = a[j];a[j + 1] = a[j];

a[j + 1] = t;a[j + 1] = t;

Page 22: COP 3530: Data Structures, Algorithms, & Applications Instructor: Kristian Linn Damkjer.

Next Time in COP 3530…Next Time in COP 3530…Read Chapters 1–4 for review of topics Read Chapters 1–4 for review of topics

covered todaycovered todayPerformance Analysis and MeasurementPerformance Analysis and MeasurementWe will start the Data Structures portion We will start the Data Structures portion

of this courseof this courseStart thinking about different ways to Start thinking about different ways to

represent datarepresent dataRead Chapter 5.1–5.2Read Chapter 5.1–5.2Data Structure: Linear ListsData Structure: Linear Lists