Algorithms

Courses + Certifications
In partnership With
  • FAQ
  • Courses
  • Certifications
  • Careers
  • Jobs
  • Companies
  • Skills
  • Articles

How is an algorithm defined?

An algorithm is a set of instructions implemented by software engineers and data scientists to transform input data into output data through a computational series of arithmetic, decision-making and repetition.  Algorithms provide computers with a series of instructions that transform data into usable knowledge. Every algorithm is essentially trying to make a decision, often as part of a series of decisions, to ensure that a computational input is processed and transmitted as usable data based on the task it is trying to accomplish.

What are the three steps of an algorithm?
Answer Part 1

An algorithm consists of a series of three steps: the input, the computation and the output.

Answer Part 2
  • An input is the data that is fed into an algorithm to begin the computation process.
  • The computation process then applies arithmetic, decision-making and repetition to create “if x, then y” equations to ensure only the proper data is fed through to the output. Many algorithms utilize machine learning to use past knowledge in computational decision making.
  • The output process is the algorithm’s expression of the conclusion it has come to. This can be in the form of information displayed to a user, or much more commonly, as more data that becomes the input for another algorithm in a string of processes that enables a computer to make complex decisions in real time.
What is the best way to analyze an algorithm?
Answer Part 1

In order to ensure an algorithm is as efficient as possible, there are several methods of analysis that check execution speed and memory usage across several use cases.

Answer Part 2

Algorithm analysis begins with counting the number of operations needed to determine an answer across different input variables. For example, a linear search algorithm, which searches for values in a list, will check every value on a given list to see if it matches the target value. Once the value is found, it immediately returns to the index. If no value is found, the equation returns -1.  The number of checks necessary to find the target value will determine the execution speed of the algorithm. This execution speed will vary depending on the target value and the values present in the list, so several values should be checked to determine a relative average speed.

Other variables are necessary to determine the actual running speed of an algorithm, such as the speed of the computer, the programming language and the translation of that language into machine code. To get an accurate measurement of how an algorithm will run on a particular device, it must be made to run. This is possible by implementing the algorithm in an actual programming language, and in JavaScript, using the searchList function. This function will tell the amount of time it takes an algorithm to search a specific length of numbers in a list in milliseconds. By measuring the efficiency of different types of algorithms for a given set of values, programmers and data scientists can determine the best algorithm to use for specific use cases.

What are some examples of an algorithm?
Answer Part 1

Three key algorithms commonly used include binary search, merge sort and adding/removing from a linked list.

Answer Part 2

Binary Search

Binary search algorithms take sorted arrays of data and return the index of the value being searched for. Essentially, this type of algorithm determines where a value exists within a specific set of data or if it exists within the data set at all. There are five steps this algorithm will perform in its search:

  1. It finds the midpoint of the sorted array.
  2. It compares the midpoint of the data to the value being searched.
  3. The algorithm then searches the right half of the array if the midpoint is larger than the value.
  4. If the midpoint is smaller than the value, it will search the left half of the array.
  5. Finally, the steps are repeated until the midpoint value is found or determined not to exist in the data set.

Merge Sort

Merge sort algorithms operate in a divide-and-conquer manner, similar to binary search. Where the two differ, however, is that merge sorting separates all elements into individual elements, continuing until every individual element exists in an index of its own, and then merges the elements and sorts them in an understandable order based on the input.

Merge sort algorithms manage both the dividing and merging processes simultaneously to provide faster results to the user.

Adding/Removing From a Linked List

Linked lists utilize nodes and pointers as opposed to arrays, which allows some processes to perform much more efficiently.

Nodes house a piece of data and a pointer that directs it to the next node, allowing data to consistently feed in a specific direction.

Linked lists can be restructured so that nodes can be inserted or deleted from a specific location. Engineers and computer scientists can locate exactly where the node that needs to be inserted or removed is located as well as the pointers where the desired change should be rearranged, allowing items to be removed from the middle of a collection without having to shift the remainder of the data structure in memory. This makes for more efficient insertions and deletions.

Courses

Algorithm Courses to Boost Your Skills

In partnership with

Boost your skill set and develop by learning more about algorithms with Udemy.

Topic:

Ace your next Javascript coding interview by mastering data structures and algorithms.

 

What you'll learn:

  • Master commonly asked interview questions

4.8
(12947)

Topic:

The Missing Computer Science and Coding Interview Bootcamp

 

What you'll learn:

  • Learn everything you need to ace difficult coding interviews

4.8
(17735)

Topic:

Ultimate coding interview bootcamp. Get more job offers, negotiate a raise: Everything you need to get the job you want!

 

What you'll learn:

  • Ace coding interviews…

4.7
(21026)

Topic: 

Learn, Analyse and Implement Data Structure using C and C++. Learn Recursion and Sorting.

 

What you'll learn

  • Learn various Popular Data Structures and their…

4.6
(24258)
Certifications

Algorithm Certifications to Expand Your Career

In partnership with

These top software engineering certifications from Udacity could be the key to taking your next step.

In this course you will learn data structures and algorithms by solving 80+ practice problems. You will begin each course by learning to solve defined problems related to a particular data structure and algorithm. By the end of each course, you would be able to evaluate and assess different data structures and algorithms for any open-ended problem and implement a solution based on your design choices.

Intermediate
4 months
10 hours
Newsletter

Looking to level up your Algorithms career? Subscribe to Built In.

Careers

Careers Related to Software Engineering

Jobs

Latest Software Engineering Jobs

Companies

Companies Hiring Software Engineers

All Course + Certification Topics