## DEV Community π©βπ»π¨βπ» is a community of 963,274 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

VICTOR MAINA

Posted on

# Introduction to Data Structures and Algorithms

Data structures and algorithms are βcomponentsβ of software development that enable one to write efficient( minimum memory and storage needs) software.

Data Structures β These can be looked as like the ingredients you need to build efficient algorithms. These are the ways to arrange data so that they (data items) can be used efficiently in the main memory. Examples: Array, Stack, Linked List.

Algorithms β These are a sequence of steps performed on data using efficient data structures to solve a given problem, be it a basic or real-life-based one. Examples include: sorting an array or adding two numbers and displaying the result. Simply put as the path between a problem and a solution.

characteristics that make up a good algorithm.

These include:

1.Input specified
2.Output specified
3.Definiteness
4.Effectiveness

1. Finiteness 6.Independent In recent years in software development, skills tests on data structures and algorithms have become more and more crucial; This does indicate and stress on the importance of learning and developing this skill and on the attainment of this skill in your arsenal puts you ahead of the crowd.

Algorithm example for adding two numbers:

1.start

2.prompt for first number as input(num1)

2.prompt for second number as input(num2)

3.Assign user input to num1 and num2 (num1 β first number, num2 β second number).

4.Add num1 and num2 (num1 + num2).

1. Assign the result to sum. (sum β num1 + num2)

6.Print sum

7.Stop

Types of Data Structures:

1. Primitive data structures
2. Non-primitive data structures
3. Primitive Data structures

The primitive data structures are essentially the bare data types. These are int, char, float, double, and pointer which can only hold a single value.

Non-Primitive Data structures

The non-primitive data structure is divided into two types:

1. Linear data structure
2. Non-linear data structure

Linear Data Structures
The arrangement of data is in a sequential manner hence the name βlinear data structureβ , examples include Arrays, Linked list, Stacks, and Queues. In these data structures, one element is connected to only one another element in a linear form.

Non- linear Data structures are ideally the opposite of the linear Data structures, the elements are not limited to connections of only one other element in a linear form such as map, graph and tree.

Static and Dynamic Data Structures

Static data structures are fixed in size, while dynamic ones can increase or decrease in size. The size is usually in terms of space the data structure occupies. Therefore the size of a static data structure cannot be changed only its content.

Dynamic data structures are flexible, allowing you to change the size of the element and the contents in runtime. Each of the two has a different use case depending on what you want to do in your program.

This is a little bit of an introduction to Data Structures and Algorithms, I hope you had an amazing read.

## π Friends don't let friends browse without dark mode.

Sorry, it's true.