Common Array Algorithms

Slides:



Advertisements
Similar presentations
Sorting algorithms Sieve of Eratosthenes
Advertisements

Control Structures Selections Repetitions/iterations
Musical Chairs No more than 2 people at one table who have been at the same table before. I suggest that one person remain at the table you have been at.
Prime Numbers and Prime Factorization
Prime Numbers and Prime Factorization
Prime Numbers and Prime Factorization. Factors Factors are the numbers you multiply together to get a product. For example, the product 24 has several.
Prime Number – a number that has only two factors, itself and 1.
Finding factors of a number Use the beans to find factors of 24  Count out 24 beans  We know that products can be illustrated using a rectangular model.
FACTORS.
Make a list with your group How can I remember???
Lists Samuel Marateck © The Sieve of Eratosthenes.
Introduction to working with Loops  2000 Prentice Hall, Inc. All rights reserved. Modified for use with this course. Introduction to Computers and Programming.
March 24, 2009 The road to success is dotted with many tempting parking places. ~Author Unknown.
Musical Chairs No more than 2 people at one table who have been at the same table before. I suggest that one person remain at the table you have been at.
Unit 171 Algorithms and Problem Solving - II Algorithm Efficiency Primality Testing Improved Primality Testing Sieve of Eratosthenes Primality Testing.
Chapter 4 Number Theory. Terms Factors Divides, divisible, divisibility Multiple.
Venn Diagrams to find the HCF and LCM
Math By : Liam and Shannon. Prime factorization how to do it You have a number and then you find the multiples that goes into it that many times then.
Prime Numbers and Prime Factorization. Factors Factors are the numbers you multiply together to get a product. For example, the product 24 has several.
Prime numbers Jordi Cortadella Department of Computer Science.
5.1 Divisibility. Natural Numbers The set of natural numbers or counting numbers is {1,2,3,4,5,6,…}
An ancient method for finding the prime numbers.  Eratosthenes was a Greek mathematician from Cyrene (modern day Libya!). He was born in 276 BC, and.
Chapter 1 Fractions Our Goals:
Sieve of Eratosthenes. The Sieve of Eratosthenes is a method that.
Prime Numbers and Prime Factorization. Factors Factors are the numbers you multiply together to get a product. For example, the product 24 has several.
Math Module 3 Multi-Digit Multiplication and Division
Vocabulary Multiples Common multiples A number times 1, 2, 3, 4 etc.
Prime Numbers & Prime Factorization. Factors Factors are the numbers you multiply together to get a product. For example, the product 24 has several factors.
Loops & List Intro2CS – week 3 1. Loops -- Motivation Sometimes we want to repeat a certain set of instructions more than once. The number of repetitions.
Solving Linear Equations with Justification of Properties
1 Searching and Sorting Searching algorithms with simple arrays Sorting algorithms with simple arrays –Selection Sort –Insertion Sort –Bubble Sort –Quick.
GREATEST COMMON FACTORS
MTH 231 Section 4.1 Divisibility of Natural Numbers.
Prime and Composite Numbers Factors What is a prime number? Is this number prime?
General Condition Loop A general condition loop just loops while some condition remains true. Note that the body of the loop should (eventually) change.
Comparative Relational Thinking
EVEN NUMBERS EVEN NUMBERS 1 = prime 2 = prime1 3 = prime 4 = 2 x 22 5 = prime 6 = 2 x 33 7 = prime 8 = 2 x 2 x 24 9 = 3 x 3 10 = 2 x 55.
March 26, 2009 Who dares to teach must never cease to learn. ~John Cotton Dana.
A prime number is a whole number which only has two factors: one and itself. A prime number is a whole number which only has two factors: one and itself.
Searching and Sorting Searching algorithms with simple arrays
Prime Numbers and Prime Factorization
Prime Numbers and Prime Factorization
Comparative Relational Thinking
Prime Numbers and Prime Factorization
Sieve of Eratosthenes.
Grow these factor bugs, their legs
HW: Index Numbers 3. Fill the blanks: 1. Fill the blanks:
Using The Sieve of Eratosthenes
9 x 14 9 x 12 Calculate the value of the following: 1 4 × 5 =
Prime Numbers and Prime Factorization
Cse 373 May 15th – Iterators.
Sieve of Eratosthenes.
Solving 2-Step Variable Equations
Associative Structures
Draw pictures to indicate the subproblems middleMax solves at each level and the resulting maxPtr and PrevPtr for each on this linked list:
Prime Numbers and Prime Factorization
More About Recursion Java.
AP Java Warm-up Boolean Array.
Prime Numbers and Prime Factorization
PRIME FACTORIZATION USING FACTOR TREES!.
Area Models A strategy for Multiplication
Sieve of Eratosthenes The Sieve of Eratosthenes uses a bag to find all primes less than or equal to an integer value n. Begin by creating a bag an inserting.
Prime Numbers and Prime Factorization
Prime Numbers.
Numbers within 20.
Introduction to Algorithms
Prime Numbers and Prime Factorization
Topic 25 - more array algorithms
Prime Numbers and Prime Factorization
Applications of Arrays
Presentation transcript:

Common Array Algorithms AP Java Common Array Algorithms

Learning Targets Be able to use common array algorithms to solve challenges. Improve in focused note taking strategies

Array Algorithms Common Array Algorithms Link Complete the fill in blanks on the web pages Take focused notes as needed.(Cornell, Outline, mapping, … Select a strategy to implement) Next weeks Exam will be open notes. (Anything you write down you can use. Not print out!)

Boolean Array Program (12/14/2018) Use an array to calculate and show all prime numbers <=1000 Use the sieve of Eratosthenes Write a program to use this process in finding all primes less than or equal to 1000. How many primes will Java let you find using this method? Cross out 1, because it is not prime. Circle 2, because it is the smallest positive even prime. Now cross out every multiple of 2; in other words, cross out every second number. Circle 3, the next prime. Then cross out all of the multiples of 3; in other words, every third number. Some, like 6, may have already been crossed out because they are multiples of 2. Circle the next open number, 5. Now cross out all of the multiples of 5, or every 5th number. Continue doing this until all the numbers through 100 have either been circled or crossed out. You have just circled all the prime numbers from 1 to 100!

Getting Started Creating an array of Booleans boolean[] seive = new boolean[1000]; Initializing them to true (potentially prime). for( int i = 0; i < seive.length; i++ ) seive[i] = true ;