CreativityinAlgorithms--16-17

Creativity in Algorithms
Lesson Objectives
• Develop an algorithm to solve a new problem with
playing cards
• Express an algorithm in the Human Machine
Language
• Identify Sequencing, Selection and Iteration in a
program written the Human Machine Language
• Describe the properties of the Human Machine
Language that make it a "low level" language.
Creativity in Algorithms
Finish Find Min Code from Yeste
• Using the Human Machine Language syntax, write the
“code” for finding the minimum value
Creativity in Algorithms
Finish Find Min Code from Yeste
• Using the Human Machine Language syntax, write the
“code” for finding the minimum value
Creativity in Algorithms
Share Find Min Code from Yester
• “Human Machine Language” is considered a low-level
language: basic, primitive commands to control a
computer
• Similar to Assembly Language
• 2.2.3C Code in a programming language
is often translated into code in
another (lower level) language to be
executed on a computer.
Creativity in Algorithms
Creativity in Algorithms
• If you know a few algorithms, you can combine them
or modify them to solve new problems
Creativity in Algorithms
Adding SWAP to Human Machine Langua
• Groups of 2
• New command SWAP
• Swaps the positions of the cards currently being
touched by the left and right hands
• After a swap, the cards have changed positions but
hands return to the original position
• Try example
Creativity in Algorithms
Challenge: Min-to-Front
• Using only the HML, design an algorithm to find the
smallest card and move it to the front of the list,
Position 0.
• END STATE: when the program stops, the smallest card
should be in position 0 and all other cards must be in
their original relative ordering. The ending positions of
the hands do not matter
If you’re done early, get
Optional Challenges from Mrs. Q
Do not write on these…write in your ACE.
Creativity in Algorithms
Share Min-to-Front Solutions
• Debug another pair’s code
• Discuss any similarities and differences within your
group of 4
Creativity in Algorithms
How does this fit in with the stand
4.1.1A Sequencing, selection, and
iteration and building blocks of
algorithms.
4.1.2G Every algorithm can be
constructed using only sequencing,
selection, and iteration
Where did we see these in our HML programs?
Sequencing is the application of each step of an
algorithm in the order in which the statements are
Creativity in Algorithms
How does this fit in with the stand
4.1.1A Sequencing, selection, and
iteration and building blocks of
algorithms.
4.1.2G Every algorithm can be
constructed using only sequencing,
selection, and iteration
Where did we see these in our HML programs?
Selection uses a [true-false] condition to determine
which of two parts of an algorithm is used. (4.1.1C)
Creativity in Algorithms
How does this fit in with the stand
4.1.1A Sequencing, selection, and
iteration and building blocks of
algorithms.
4.1.2G Every algorithm can be
constructed using only sequencing,
selection, and iteration
Where did we see these in our HML programs?
Iteration is the repetition of part of an algorithm until
a condition is met or for a specified number of times.
Creativity in Algorithms
Assignments for this Lesson
• 3-3: No bubbles
• Summarize the lesson
• Vocab: Sequencing, selection, iteration