CMPT 120 Lecture 26 – Unit 5 – Internet and Big Data

Slides:



Advertisements
Similar presentations
Complexity Theory  Complexity theory is a problem can be solved? Given: ◦ Limited resources: processor time and memory space.
Advertisements

Sorting and Searching. Searching List of numbers (5, 9, 2, 6, 3, 4, 8) Find 3 and tell me where it was.
Wednesday, 11/25/02, Slide #1 CS 106 Intro to CS 1 Wednesday, 11/25/02  QUESTIONS??  Today:  More on sorting. Advanced sorting algorithms.  Complexity:
New Mexico Computer Science For All Algorithm Analysis Maureen Psaila-Dombrowski.
3.3 Complexity of Algorithms
Course Code #IDCGRF001-A 5.1: Searching and sorting concepts Programming Techniques.
Searching Topics Sequential Search Binary Search.
Lecture # 1 Introduction Analysis of Algorithm by Qamar Abbas Analysis of Algorithms.
CMPT 120 Topic: Sorting Algorithms – Part 1. Last Lectures Searching algorithms and their time efficiency Linear search is of order n -> O(n) i.e., has.
CMPT 120 Topic: Searching – Part 2 and Intro to Time Complexity (Algorithm Analysis)
Chapter 3 Chapter Summary  Algorithms o Example Algorithms searching for an element in a list sorting a list so its elements are in some prescribed.
CMSC 104, Version 8/061L24Searching&Sorting.ppt Searching and Sorting Topics Sequential Search on an Unordered File Sequential Search on an Ordered File.
Copyright Prentice Hall Modified by Sana odeh, NYU
Searching and Sorting Algorithms
Topic: Python Lists – Part 1
Topic: Introduction to Computing Science and Programming + Algorithm
Topic: Recursion – Part 2
Outline lecture Revise arrays Entering into an array
Topic: Programming Languages and their Evolution + Intro to Scratch
CMPT 120 Topic: Searching – Part 2
Topic: Introduction to Computing Science and Programming + Algorithm
CMPT 120 Topic: Searching – Part 2
May 17th – Comparison Sorts
Algorithmic complexity: Speed of algorithms
Last Class We Covered Sorting algorithms “Run” time Selection Sort
It’s called “wifi”! Source: Somewhere on the Internet!
CMPT 120 Topic: Searching – Part 1
CMPT 120 Topic: Python strings.
Lesson 5-15 AP Computer Science Principles
CMPT 238 Data Structures Midterm Exam Review.
Sorting Data are arranged according to their values.
Google Analytics.
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Last Class We Covered Data representation Binary numbers ASCII values
Algorithms Chapter 3 With Question/Answer Animations
2008/12/03: Lecture 20 CMSC 104, Section 0101 John Y. Park
Searching and Sorting Topics Sequential Search on an Unordered File
Review for Midterm Exam
Binary Search and Intro to Sorting
Searching and Sorting Topics Sequential Search on an Unordered File
Sorting Data are arranged according to their values.
Last Class We Covered Dictionaries Hashing Dictionaries vs Lists
UMBC CMSC 104 – Section 01, Fall 2016
Searching and Sorting Topics Sequential Search on an Unordered File
VCE IT Theory Slideshows
Algorithms Key Revision Points.
Review for Midterm Exam
Algorithmic complexity: Speed of algorithms
Review for Midterm Exam
Review for Midterm Exam
Review for Midterm Exam
Intro to Computer Science CS1510 Dr. Sarah Diesburg
CMSC201 Computer Science I for Majors Final Exam Information
Algorithmic complexity: Speed of algorithms
Algorithms Assessment (Computer Science) Date :
Sum this up for me Let’s write a method to calculate the sum from 1 to some n public static int sum1(int n) { int sum = 0; for (int i = 1; i
CMPT 120 Lecture 2 - Introduction to Computing Science – Problem Solving, Algorithm and Programming.
CMPT 120 Lecture 12 – Unit 2 – Cryptography and Encryption –
CMPT 120 Lecture 29 – Unit 5 – Internet and Big Data
CMPT 120 Lecture 30 – Unit 5 – Internet and Big Data
Lecture 31 – Practice Exercises 7
CMPT 120 Lecture 19 – Unit 3 – Graphics and Animation
CMPT 120 Lecture 32 – Unit 5 – Internet and Big Data
CMPT 120 Lecture 33 – Unit 5 – Internet and Big Data
CMPT 120 Lecture 24 – Unit 4 – Computer Vision
Lecture 37 – Practice Exercises 9
Lecture 37 – Practice Exercises 9
CMPT 225 Lecture 10 – Merge Sort.
CMPT 225 Lecture 16 – Heap Sort.
Presentation transcript:

CMPT 120 Lecture 26 – Unit 5 – Internet and Big Data Python – More on Lists of Lists Algorithm - Searching

A few things on our menu today Thank you for answering the Survey during our class of Friday, June 28! Talk about our Midterm 2 this week Go over “test cases” by looking at Question 11 of last Friday’s Lecture 25 – Practice Exam Finish looking at lists of lists … … and answering the question: Why are we looking at lists of lists? Start our Unit 5 – Internet and Big Data

Survey Result

Lecture 25 – Practice Exam – Part 1 – Question 11 – Test Cases

Let’s have another look at lists - cont’d

Another 2D Data Structure: Lists of Lists Question: What if a problem statement ask us to manipulate a matrix? Answer: In our solution (program), we could use a list of lists to represent a matrix the Python code representing the above data would look like: myMatrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]

Lists of Lists How can we create myMatrix? How can we access each of its elements? myMatrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] How can we slice it? How can we modify its elements?

What else can we represent using a list of lists? Let’s have a little demo!

Unit 5 - Internet and Big Data A LOT of data The internet has given us data For example, Google is able to search through billions of web pages, and Amazon has millions of products In this unit, we will learn about searching, sorting and how to do it fast even when there’s lots data

Where is search used? We need search to be especially efficient for large amounts of data Google Domain name system (DNS) servers Music databases Amazon customer databases … everywhere!

Unit 5 - Internet and Big Data APPLICATIONS In this unit, we’ll learn about algorithms that allow machines to solve a very common problem: searching and sorting ALGORITHMS We’ll look at searching algorithms: linear search and binary search and code We’ll look at sorting algorithms: bubble, selection and insertion sort and code We’ll analyze their “complexity” and see what we can do knowing their “complexity” PYTHON: Revisiting file I/O A common problem: find an element in a sequence.

First, the basic algorithm: Linear Search Searching First, the basic algorithm: Linear Search

Let’s try! Is in this sequence? Called “target” 42 8 12 34 2 67 33 26 89 54

What did we do to find the target?

Lecture Review Write a Python statement (only one) that will create the variable border = ['-','-','-','-','-','-'] What is the name of the searching algorithm we learned today and why is it called this way? Do we need to use comparison operators when searching? Write a Python statement that will produce the result [4,5,2] using myLists = [[9,0],[4,5,2],[3,1,1,9]] Write a Python statement that will produce the result [4,5] using myLists = [[9,0],[4,5,2],[3,1,1,9]]

Next Lecture Our Midterm 2 - Theory and Understanding In SWH 10081 At 9:30am Good luck in your studying!