HACKERS

What Are Algorithms & Why Are They Important

What Are Algorithms & Why Are They Important


What Is An Algorithm?

An algorithm is a set of step-by-step procedures, or a set of rules to follow, for completing a specific

task or solving a particular problem. Algorithms are all around us. The recipe for baking a cake,

the method we use to solve a long division problem, and the process of doing laundry are all examples

of an algorithm. Here’s what baking a cake might look like, written out as a list of instructions, just like

an algorithm:

  1. Preheat the oven

  2. Gather the ingredients

  3. Measure out the ingredients

  4. Mix together the ingredients to make the batter

  5. Grease a pan

  6. Pour the batter into the pan

  7. Put the pan in the oven

  8. Set a timer

  9. When the timer goes off, take the pan out of the oven

  10. Enjoy!

Algorithmic programming is all about writing a set of rules that instruct the computer how to perform

a task. A computer program is essentially an algorithm that tells the computer what specific steps

to execute, in what specific order, in order to carry out a specific task. Algorithms are written using particular syntax, depending on the programming language being used.

Types of Algorithms

Algorithms are classified based on the concepts that they use to accomplish a task. While there

are many types of algorithms, the most fundamental types of computer science algorithms are:

  1. Divide and conquer algorithms – divide the problem into smaller subproblems of the same
    type; solve those smaller problems, and combine those solutions to solve the original problem.

  2. Brute force algorithms – try all possible solutions until a satisfactory solution is found.

  3. Randomized algorithms – use a random number at least once during the computation
    to find a solution to the problem.

  4. Greedy algorithms – find an optimal solution at the local level with the intent of finding
    an optimal solution for the whole problem.

  5. Recursive algorithms – solve the lowest and simplest version of a problem to then
    solve increasingly larger versions of the problem until the solution to the original
    problem is found.

  6. Backtracking algorithms – divide the problem into subproblems, each which can be
    attempted to be solved; however, if the desired solution is not reached, move backwards
    in the problem until a path is found that moves it forward.

  7. Dynamic programming algorithms – break a complex problem into a collection of simpler
    subproblems, then solve each of those subproblems only once, storing their solution for
    future use instead of re-computing their solutions.

Example of an Algorithm

Solving a Rubik’s Cube

There are a number of different algorithms, from simple to very complicated, that exist for
solving a Rubik’s cube. Below is just one simple algorithm. First, let’s specify a notation to
use (similar to picking a programming language).

Each of the six faces of a Rubik’s cube can be represented by the first letter of their name:

  • U - up

  • D - down

  • L - left

  • R - right

  • F - front

  • B - back

Each face can be turned in three different ways/directions. Using U as an example, these are
represented as:

  • U - clockwise quarter-turn of the upper face

  • U' - counter-clockwise quarter-turn of the upper face

  • U2 - half turn in either direction of the upper face

Now, let’s go through the steps in the algorithm to solve a Rubik’s Cube. Feel free to grab one
of your own and follow along!

Step 1: The Cross

  1. First, flip some edges so that there is a white cross on the upper face.

  2. Apply the following turns: F, R’, D’, R, F2, R’, U, R, U’, R’, R2, L2, U2, R2, L2.

  3. The cross is now solved.

Step 2: The White Corners

  1. The edges on the white face are now complete, but the corners remain.

  2. Depending on where the white-orange-green corner is in the puzzle, apply one of the
    following series of turns:

    1. Bottom: R’, D’, R, D (repeat until the corner moves to its correct place)

    2. Top: R’, D’, R, D (this moves the corner to the bottom; then, follow the above instructions)

Step 3: Middle Layer Edges

  1. Flip the cube so that the white is on the bottom.

  2. Look for an edge that is on the top face and doesn’t have yellow on it.

  3. Perform a U-turn so that the color on the front face of the edge matches with the center.

  4. Depending on the direction that the edge could go, apply one of the following series of turns:

    1. Left: U’, L’, U, L, U, F, U’, F’

    2. Right: U, R, U’, R’, U’, F’, U, F)

Step 4: Yellow Cross

  1. Apply the following turns, until a yellow cross on the face appears with the yellow
    center: F, R, U, R’, U’, F’.

  2. If there is an “L” shape, where the two yellow pieces showing are adjacent to each
    other, apply the following turns: F, U, R, U’, R’, F’.

  3. If there is a “Line” shape, which is horizontal, apply the following turns: F, R, U, R’, U’, F’.

Step 5: Sune and Antisune

  1. Look at the face with the yellow center.

  2. Depending on the below contingencies, apply one of the following series of turns:

    1. If there is only one oriented corner: R, U, R’, U, R, U2, R’ (repeat until the desired
      position is attained)

    2. There is one oriented corner and one right-facing corner: U2, R, U2, R’, U’, R, U’, R’

Step 6: Finishing the puzzle

  1. Look for sets of “headlights” (two stickers of the same color in the same row,
    separated by a sticker of a different color).

  2. Depending on how many there are, apply one of the following series of turns:

    1. If there are a set of headlights on each side: R, U’, R, U, R, U, R, U’, R’, U’, R2

    2. Otherwise: R’, F, R’, B2, R, F’, R’, B2, R2

Sorting Algorithms

A sorting algorithm is an algorithm that puts elements of a list in a certain order, usually in
numerical or lexicographical order. Sorting is often an important first step in algorithms
that solves more complex problems. There are a large number of sorting algorithms,
each with their own benefits and costs. Below, we will focus on some of the more famous
sorting algorithms.

  1. Linear sort: Find the smallest element in the list to be sorted, add it to a new list,
    and remove it from the original list. Repeat this until the original list is empty.

  2. Bubble sort: Compare the first two elements in the list, and if the first is greater
    than the second, swap them. Repeat this with every pair of adjacent elements
    in the list. Then, repeat this process until the list is fully sorted.

  3. Insertion sort: Compare each element in the list to all the prior elements until
    a smaller element is found. Swap these two elements. Repeat this process
    until the list is fully sorted.

Where Algorithms are Used in Computer Science?

Algorithms are used in every part of computer science. They form the field's backbone.
In computer science, an algorithm gives the computer a specific set of instructions, which
allows the computer to do everything, be it running a calculator or running a rocket. Computer
programs are, at their core, algorithms written in programming languages that the computer
can understand. Computer algorithms play a big role in how social media works: which posts
show up, which ads are seen, and so on. These decisions are all made by algorithms.
Google’s programmers use algorithms to optimize searches, predict what users are going
to type, and more. In problem-solving, a big part of computer programming is knowing
how to formulate an algorithm.

Why are Algorithms Important to Understand?

Algorithmic thinking, or the ability to define clear steps to solve a problem, is crucial in
many different fields. Even if we’re not conscious of it, we use algorithms and algorithmic
thinking all the time. Algorithmic thinking allows students to break down problems and
conceptualize solutions in terms of discrete steps. Being able to understand and
implement an algorithm requires students to practice structured thinking and reasoning abilities.

This article originally appeared on junilearning.com

How to Encourage STEM in Early Education




What is STEM?

Science, technology, engineering, and mathematics (STEM) are largely used to influence innovative
solutions to our world’s problems. Day-to-day decisions are increasingly being driven by data, with 
90% of the world’s data generated just in the last two years. The proliferation of global access to mobile
technology, the internet, and other innovations indicates that future generations should be STEM-literate.
Demand for STEM jobs has increased so much that 2.4 million STEM-related jobs in the United States
were expected to go unfilled in 2018.
Encouraging early STEM education for young children today will not only help develop interdisciplinary critical
thinking now, it will also help set your child up with the critical, relevant skills that research says will be integral 
for your child’s future success.

Why STEM Education is Vital for Kids

STEM education is not just for college-level or even high school students. The U.S. Department of Education 
links a strong formative math education with future success in areas outside of just math, predominantly reading.
Early development is critical for future growth. Researchers report that the brain forms the most active 
connections during childhood. Nourishing a child’s inquisitive mind with new information supports active 
neural pathways at the most critical time of development. Constructing this foundation sets children up for 
future cognitive and socio-economic gains.
STEM programs and lesson plans exceed a science education. Not only does STEM education teach hard 
skills, it also fosters life skills, such as creative problem solving, logic, and resilience. STEM literacy empowers
 individuals with skills that serve them in STEM and non-STEM fields, alike. The ability to evolve as technology
 evolves and grows prepares people for success in all endeavors.

Future STEM Career Pathways

STEM occupations grow faster than most other professions, command higher wages, and are required in
 non-STEM fields. Some examples of STEM careers include software developers, statisticians, and 
biomedical engineers. For further detailed information on STEM occupations, the Bureau of Labor Statistics 
provides a “periodic table” with details on entry to each field, career pathways, wages, and more.

Non-STEM Careers in a Tech-Oriented World

STEM increasingly integrates with non-STEM subjects, such as economics, finance, and linguistics. 
Higher education programs support STEM education for the professional development of people seeking 
non-STEM degrees.
Yale’s Department of Economics cites the “quantitative and analytic nature” of their program as the
reason for changing economics’ designation from a social science major to a STEM major. Yale isn’t the
only university readjusting their outlook; Princeton, MIT, Columbia, and other universities have also
reclassified economics as STEM.

Diversity: STEM is for Everybody

Society traditionally regards STEM fields as masculine. The National Science Foundation reports that
only 30% of women are employed as scientists and engineers in the United States' STEM workforce.
However, though a great understatment, it was largely girls and women who have influenced the world
for what it is today.
Ada Lovelace is considered the first computer programmer, dating back to 1815. Katherine Johnson,
featured in Hidden Figures, was so exceedingly good at math that her job at NASA was quite literally to
check the work of computers. Of course, there are many others who have gone unrecognized.
A welcoming learning environment and strong STEM curriculum empowers girls to pursue STEM fields,
including computer science.

How Can Parents and Teachers Encourage STEM?

Engaging in a diverse set of projects and activities best encourages passion and curiosity for STEM.
Hands-on experiences, strong role models, and exciting problems motivate children to want to learn and
grow. Through a blend of different projects and activities, STEM teachers and parents not only nurture a
love for STEM, but also develop children's desires to tackle complex problems that require a wide range of skills.
As the U.S. Department of Education outlines, parents do not need STEM degrees to help children learn science.
Armed with just a magnifying glass and going outside, parents can teach kids about the world by asking children
to observe, ask questions, and think about what they see about everything, from bugs to mud puddles.

STEM is for Young Kids Too

STEM is for all ages! Many local science centers host events that are designed particularly for young age groups.
Young children discovering the world around them for the first time have much to learn and absorb from these programs.
In fact, just playing with children and offering creative, hands-on experiences inspires inquisitive minds.
 Toys and games that stimulate curiosity are excellent teaching tools. LEGOs, building blocks, as well as tinkering
stations with items like string, straws, pipe cleaners, colorful tape, and popsicle sticks aid fine motor skills and spatial
skills. Not only that, but they also teach how to plan, inquire, and think like scientists.

STEM Projects for Kids

Project-based learning provides a strong sense of accomplishment, teaches resilience in the face of difficult problems, and
shows how people adapt and learn from failure. Mentoring and guiding a child through projects builds confidence and gives
them the tools they need to make their own ideas come to life. Many of Juni's students utilize what they learn in our courses
to program their own games, websites, and more. With someone there to help debug particularly tricky problems and offer
guidance, students can pursue wilder, more creative ideas. We have also written more extensively on great coding toys and
games for kids.
Beyond coding, there are many fun projects parents can do with their children, across all ages. Here are some selected
project ideas and science experiments to get started!
  • Rock candy
  • Slime
  • Growing crystals
  • Coloring flowers by putting them in solution
  • Using imagination to build LEGOs
  • Inspiring aspiring architects with KAPLA blocks
  • Math Jenga
  • ...and of course, the traditional volcano!

STEM Activities for Kids

According to the National Science & Technology Council, the best STEM education should be interdisciplinary
and blend different forms of learning. Some of the best STEM lessons can be found through correlated skills
of inquiry, creativity, and genuine excitement. Engaging in a full breadth of activities best supports a well-rounded
 education that forms a fertile foundation for innovation.
Outside a formalized STEM education, parents can support their child's passions in a wide variety of ways.
By exposing children to nature emporiums, museums, science centers, zoos, aquariums, and libraries,
parents can inspire and nurture their child’s inquisitive mind and creativity. These locations often offer a
variety of hands-on workshops, events, summer camps and programs, and more. Not only are these
activities fun for children, but they’re great for the whole family!

STEM Helps Develop Lifelong Skills

The drive for discovery and exploration that early STEM education develops will serve a child throughout their
life and help them adapt to a changing, tech-driven world. By encouraging a child’s interests and passions,
parents help develop their child's abilities to be resilient to challenges, inquire about the world around them,
and creatively solve problems.
This article originally appeared on junilearning.com

Back to Top