Logo

dev-resources.site

for different kinds of informations.

Introduction to Data Structures and Algorithms.

Published at
6/20/2022
Categories
beginners
algorithms
datastructures
programming
Author
spkibe
Introduction to Data Structures and Algorithms.

A carpenter has several tools, yet each one has a specific purpose in completing a task. Similar to a programmer, depending on the task at hand, programmers will require the appropriate tool to handle a certain challenge.
Data structures are programmers' tools, and each one serves a specific purpose. Many companies uses data structures challenges in their interviews to see if a programmer is a strong problem solver.
Data structures are classified into two major sections:
1. Linear Data structures β†’ stores data in a sequential manner.
2. Non-linear Data Structure β†’ stores data in a non- sequential manner.

Types of Linear data structures:

1) Arrays β†’ stores values in arranged continuous memory. Elements stored in the arrays are determined by the programming language.
2) Stack β†’  It stores its elements according to the LIFO (last in, first out) principle, which means that the last element added is the first one withdrawn.
3) Queues β†’ It stores its elements using the FIFO (first in, first out) principle, which means that the first element inserted will be the first one withdrawn
4) LinkedList β†’ It organizes its data as a connected network of nodes, with each element containing the address of the next node.

Types of Non-Linear data structures:

1) Graphs β†’ it’s made up of nodes or vertices and edges. Edges connects two nodes.
2) Trees β†’ stores data in a hierarchical manner which is tree-like structures arranged in multiple levels. It has the root node(top most part) which is the central node. 

Algorithms
Is a set of instructions or procedure for solving a specific problem, you can think of it as a recipe to solve a problem or as a blueprint for solving a problem to make it easier to grasp.
Types of Algorithms:
1) Sort algorithms
2) Search algorithms
3) Hashing

Each written algorithm uses some memory to complete. This is where algorithm complexity comes into play; it calculates the amount of time and space required to execute an algorithm.
Space complexity β†’ The overall amount of space taken up by the algorithm in relation to the input size.
Time complexity β†’ is the amount of time algorithms takes to run. It is mostly expressed using the big O notation(asymptotic notation to represent time complexity). For example,a problem of size n:
1. O(1) is a constant-time function
2. O(n) is a linear-time function
3. O(n^2) is a quadratic-time function

Featured ones: