Download presentation
Presentation is loading. Please wait.
1
Data Structures, Algorithms, & Applications
Instructor: Babak Alipour Slides and book: Sartaj Sahni
2
Course website http://cise.ufl.edu/class/cop3530sp17/
Presentations Contact information Canvas ( Coming soon Announcements, Assignments, quizzes and Discussion board
3
Got Questions? Use the Canvas discussion board for most questions
Ask the graders (TBA) Ask the Teaching TA Ask the Instructor IF YOUR REQUEST CONTAINS SENSITIVE ACADEMIC INFORMATION, Fardad or myself ONLY!
4
Email format Subject MUST include “cop3530sp17” (No spaces, no caps)
Include your name and UFID
5
Got Feedback? For general course-related issues:
me You don’t have to include name and UFID For specific issues with assignments: Fardad
6
When in doubt… ASK Canvas discussion board Graders, TA, Instructor
Announcements, requirements, syllabus, anything you find ambiguous, ASK RIGHT AWAY!
7
Books Data Structures, Algorithms, and Applications in C++ by Sartaj Sahni Introduction to Algorithms by Charles E. Leiserson, Clifford Stein, Ronald Rivest, and Thomas H. Cormen (Widely known as CLRS book) Algorithms by Robert Sedgewick
8
Quizzes Once every week (or so) Online (through Canvas)
5 to 10 minutes (starting at the beginning of the class) Also acts as attendance roll call (access code announced in class) Graded automatically
9
Assignments Up to 6 assignments
Graded automatically by a judge (based on correctness of output and timeliness of algorithm, using several input test cases) Address will be: ONLY last submission counts WARNING: If output is incorrect or output format is not adhered to or timer runs out, you get NO CREDIT for the test case. (e.g. if you pass 3 out of 5 test cases, you get a 60)
10
Online judges Familiarize yourself with online judges such as HackerRank, LeetCode, SPOJ, etc. Some assignments will involve solving problems in these platforms.
11
Projects Two projects TBA Involves thinking A LOT (and coding a bit)
Grading based on judge test cases AND demo in front of a TA/grader in person
12
Exams 2 exams Midterm: TBA Final: Group 27B
Non-cumulative BUT the final exam material will depend upon midterm material.
13
Grading (Tentative) Quizzes 10% Assignments 10% Exams 40% Projects 40%
Subject to change depending on the progression of the course and feedback from class
14
Grading – The perks I will announce some perks to help you with graders Everyone is A(wesome)++, for now. Focus on learning, a good grade follows naturally.
15
Tips on studying Slides only provide bullet points
Read the corresponding section in at least one of the books Use Wikipedia (and other internet sources) Some algorithms are explained very well
16
Tips on studying There will be additional/extra readings at the end of some slides, study them PRACTICE, PRACTICE, PRACTICE Use the online judges mentioned Implement data structures and algorithms discussed in class Challenge yourself!
17
Clip Art Sources www.barrysclipart.com www.livinggraphics.com
18
What The Course Is About
Data structures is concerned with the representation and manipulation of data. All programs manipulate data. So, all programs represent data in some way. Data manipulation requires an algorithm. Data: Streets in a city. Mapquest. Manipulation: Do something with the data. Add a new street. Close a street. Make a street one way. Find route from your home to nearest gas station. Input/output data. Data representation: simple variables…int, float array variables… int [], float [] Others to be studied in this course. Algorithm…sequence of steps that results in the performance of a specific task (find nearest gas station to home).
19
What The Course Is About
Algorithm design methods needed to develop programs that do the data manipulation. The study of data structures and algorithms is fundamental to Computer Science. What we do in this course will be used in most of the follow-up courses you will take. Essential to become expert in what we do this semester. Else, you will be handicapped in later courses. Foundation material.
20
What The Course Is About
Perhaps the most important course in Computer Science We will discuss multiple real world applications as we go along
21
Prerequisites C++ Asymptotic Complexity
Big Oh, Theta, and Omega notations Java review … Chapter 1 Performance Analysis … Chapter 2 Asymptotic complexity … Chapter 3
22
Web Site For Book
23
Source Codes Download source codes from Web site and make sure you can compile and execute at least one code. Use the readme file to map text programs to file names. X.cpp is C++ program; X.output is output generated by X.cpp; and X.input is the input data (if any is required). Must be able to compile code on CISE Ubuntu machines (Ubuntu as of August 2016)
24
Organization of Text Three parts Part I … Chapters 1-4, Background
Part 2 … Chapters 5-16, Data Structures Part 3 … Chapters 17-21, Algorithms Each chapter … concepts + applications
25
Sorting Rearrange a[0], a[1], …, a[n-1] into ascending order. When done, a[0] <= a[1] <= … <= a[n-1] 8, 6, 9, 4, 3 => 3, 4, 6, 8, 9 Strictly speaking, nondecreasing order: 2, 2, 3, 6, 8, 8, 10.
26
Sort Methods Insertion Sort Bubble Sort Selection Sort Count Sort
Shaker Sort Shell Sort Heap Sort Merge Sort Quick Sort First 5 are simple (conceptually and to program). First 4 done in chapters 2 and 3. Shaker sort and shell sort are in the enrichment section of the text’s Web site. The remaining three are done in the algorithm design chapters of the text.
27
Insert An Element Given a sorted list/sequence, insert a new element
Result 3, 5, 6, 9, 14
28
Insert an Element 3, 6, 9, 14 insert 5
Compare new element (5) and last one (14) Shift 14 right to get 3, 6, 9, , 14 Shift 9 right to get 3, 6, , 9, 14 Shift 6 right to get 3, , 6, 9, 14 Insert 5 to get 3, 5, 6, 9, 14
29
Insert An Element // insert t into a[0:i-1] int j;
for (j = i - 1; j >= 0 && t < a[j]; j--) a[j + 1] = a[j]; a[j + 1] = t;
30
Insertion Sort Start with a sequence of size 1
Repeatedly insert remaining elements
31
Insertion Sort Sort 7, 3, 5, 6, 1 Start with 7 and insert 3 => 3, 7
32
Insertion Sort for (int i = 1; i < n; i++)
{// insert a[i] into a[0:i-1] // code to insert comes here }
33
Insertion Sort for (int i = 1; i < n; i++)
{// insert a[i] into a[0:i-1] int t = a[i]; int j; for (j = i - 1; j >= 0 && t < a[j]; j--) a[j + 1] = a[j]; a[j + 1] = t; }
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.