Difference between Data Structures and Algorithms

Sharon Watkins
2 min readFeb 5, 2021

--

Data Structure- In computer science, a data structure is a data organization, management, and storage format that enables efficient access and modification. More precisely, a data structure is a collection of data values, the relationships among them, and the functions or operations that can be applied to the data.

Algorithm- Is a finite sequence of well-defined, computer-implementable instructions, typically to solve a class of problems or to perform a computation. Algorithms are always unambiguous and are used as specifications for performing calculations, data processing, automated reasoning, and other tasks.

To a beginner or a novice these can be scary and intimidating terms. But diving in and learning these two key components will provide a solid foundation for the rest of your programming journey.

What is the difference between data structures and algorithms? In simplest terms….Data structures is basically just a container of data. Whereas algorithms are a sequence of actions which can be employed to solve a problem or complete a task.

Some examples of common Data Structures would be:

Arrays- is a structure of a fixed size that can hold items or elements of the same data type. You can have an array of different data types but it is not common practice.

Linked Lists- is a sequential structure that consists of items in linear order that are linked together using something called a “pointer”.

Stacks and Queues- Think of it as a pile of items. Stack is a Last in First out operation while a Queue is a First in First out.

Hash Tables- a data structure that stores data in key:value pairs.

Trees- is hierarchical where data is organized and linked together.

Heaps- is a special binary tree where the parent nodes are compared to their children with their values and then arranged accordingly.

Some Example of Algorithms would be:

Binary Search- takes in an a sorted array and returns the index of the value that is being searched for.

Bubble Sort- this works by repeatedly swapping adjacent elements until all elements find the right sought-after order.

Merge Sort- repeatedly breaks down a list into several sublists until each sublist consists of a single element and merging those sublists in a manner that results into a sorted list.

I found repetition and revisiting these concepts helps me understand and use data structures and algorithms more proficiently.

--

--

Sharon Watkins
Sharon Watkins

Written by Sharon Watkins

Just a Mom With ADD who enjoys Code

No responses yet