Algorithms. What is an algorithm?  An algorithm is a clear, concise, and correct step- by-step sequence of actions.

Slides:



Advertisements
Similar presentations
Bellwork You roll a fair die one time, find each probability below.
Advertisements

Probability and Conditional Probability. Probability Four balls What is the probability of choosing the ball in the red box? Since there are four balls.
Combinations Examples
500 for 2 Enjoy your favourite card game with only 2 players 500 for 2
Bridge with Harold Schogger © SUIT PREFERENCE SIGNALS.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 7.9Arrays of Pointers Arrays can contain pointers For.
Mock Objects. Unit-testing and TDD are challenging They require some effort to: – Write a test for a small functionality – Refactor production code and.
College of Information Technology & Design
Index Student Activity 1: Questions to familiarise students with the
Session Objectives# 24 COULD code the solution for an algorithm
Describing Probability
Playing Cards Deck of 52 uniquely designed playing cards.
14 – 7c Probability The probability of a chance event is a number between 0 and 1 that expresses the likelihood of the event occurring. Usually expressed.
1 Probability Parts of life are uncertain. Using notions of probability provide a way to deal with the uncertainty.
Intro to Probability & Games
UNR, MATH/STAT 352, Spring Radar target detection How reliable is the signal on the screen? (Is it a target of a false alarm?)
A R R A Y ! for Multiplication!!
Laws of Probability What is the probability of throwing a pair of dice and obtaining a 5 or a 7? These are mutually exclusive events. You can’t throw.
VOCABULARY  Deck or pack  Suit  Hearts  Clubs  Diamonds  Spades  Dealer  Shuffle  Pick up  Rank  Draw  Set  Joker  Jack 
Refreshing Your Skills for Chapter 10.  If you flip a coin, the probability that it lands with heads up is 1/2.  If you roll a standard die, the probability.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
Experimental Probability of Simple Events
Compound Probability Pre-AP Geometry. Compound Events are made up of two or more simple events. I. Compound Events may be: A) Independent events - when.
Design the program Create a detailed description of program –Use charts or ordinary language (pseudocode) Identify algorithms needed –Algorithm: a step-by-step.
Probability Review. I can… Solve Permutation and Combination problems 15 C 314 P 8 #8 455 #
Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 12.2 Theoretical Probability
Notes on PROBABILITY What is Probability? Probability is a number from 0 to 1 that tells you how likely something is to happen. Probability can be either.
Page 973, 10.3, % 9.43% % 11. Permutation 12. Permutation 13. Combination 14. Combination, 18%
Two Way Tables Venn Diagrams Probability. Learning Targets 1. I can use a Venn diagram to model a chance process involving two events. 2. I can use the.
Poker. Basic card terminology Suits: Hearts, diamonds, clubs, spades Deuce, face cards.
15.3 Counting Methods: Combinations ©2002 by R. Villar All Rights Reserved.
What is the Purpose of This Class
Section 11.4 Tree Diagrams, Tables, and Sample Spaces Math in Our World.
3.3 Problem Solving With Combinations. Desert Apples, Grapes, Peaches, Plums and Strawberries are available for dessert. How many Different Combinations.
Algebra II 10.4: Find Probabilities of Disjoint and Overlapping Events HW: HW: p.710 (8 – 38 even) Chapter 10 Test: Thursday.
Probability Week 5 Probability Definitions Probability – the measure of the likely hood of an event. Event – a desired outcome of an experiment. Outcome.
ALGORITHMS.
Draw 3 cards without replacement from a standard 52 card deck. What is the probability that: 1.They are all red ? 2.At least one is black ? 3.They are.
Do Now. Introduction to Probability Objective: find the probability of an event Homework: Probability Worksheet.
Week 8 : User-Defined Objects (Simple Blackjack Game)
Chapter 10 – Data Analysis and Probability 10.8 – Probability of Independent and Dependent Events.
1 Lecture 2 Control Structures: Part 1 Selection: else / if and switch.
StructureStructure. Outline Introduction Structure Definitions Initializing Structures Accessing Members of Structures Using Structures with Functions.
Lesson Objective: Understand how to make and use Algorithms Learning Outcome: Design your own algorithms and flowcharts. Algorithms and Flowcharts.
PROBABILITY What is the probability of flipping a head? There is a 1 in 2 chance – ½ = 0.5.
C OUNTING P RINCIPLE Warm UP: List down what make up of a deck of cards. Name what you know about a deck of cards.
Progression in KS3/4 Algorithms MONDAY 30 TH NOVEMBER SUE SENTANCE.
Chance We will base on the frequency theory to study chances (or probability).
Reaction Time and Neural Circuitry
11/7/16 Entry 173 – Objective I will review and continue developing my understanding of uniform probability models, including the complement of an event.
The Addition Rule.
@NAMEOFEVENTORBRIDGECLUB
Classroom Expectations
Multiplication Rule and Conditional Probability
Chapter 10: Counting Methods
Preparing the Chapter Resume
What is a computer program?
Pedro Freitas MathsJam 2017
Strong’s GMAS Review, Week 5, Problems 4 - 5
Combination and Permutations Quiz!
Click on one of the boxes and begin Mutually Exclusive Events
Data and Flowcharts Session
Section 12.2 Theoretical Probability
Data and Flowcharts Session
Section 12.2 Theoretical Probability
Homework Due Friday.
Adapted from Walch Education
Section 12.2 Theoretical Probability
P(softball) = P(not a baseball) = P(golf ball) = A box contains 3 tennis balls, 7 softballs, and 11 baseballs. One ball is chosen at random. Find.
Presentation transcript:

Algorithms

What is an algorithm?  An algorithm is a clear, concise, and correct step- by-step sequence of actions used to solve a problem or set of problems

Example 1 Problem  Write an algorithm that describes how someone is to sort a standard deck of cards from top to bottom as follows  2 of clubs through the ace of clubs  2 of diamonds through the ace of diamonds  2 of hearts through the ace of hearts  2 of spades through the ace of spades

Example 1 Solution 1.choosing the top card of the stack in turn, make 4 new stacks of 13 cards, one stack for each suit 2.with each of these four stacks, order the cards 2 through 10, jack, queen, king, ace 3.combine the three stacks in this order: club, diamond, heart, and spade

Example 2 Problem  Sorting a stack of papers, each with a number on it

Example 2 Solution 1.Compare the top two papers of the stack; place the smaller valued paper on the bottom of the stack and keep the larger valued paper 2.Grab the next paper off of the top of the stack and compare it to the paper you kept; place the smaller of these two on the bottom of the stack and keep the larger 3.Repeat step 2 until you have reached the (original)bottom of the stack; you should now be holding the largest valued paper in the stack; set this paper aside into a new “sorted stack” 4.Repeat steps 1, 2 & 3, placing the paper from step 3 onto the “sorted stack”, until no more papers remain

Algorithm Exercises  Write an algorithm for…  Tying your shoes  Telling time from an analogue clock  Helping 5 of your friends to find a lost key on a soccer field

Applying algorithms to your coding problems 1.Control Flow Charts - Some programmers prefer to develop drawings showing how information passes from state to state in a solution. 2.Pseudocode – You may develop your own pseudocode language containing all the usual coding constructs of high-level languages and use it to write algorithms to solve your problem.

End of Session