Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
June 20, 2022 07:20 pm GMT

Introduction to Data Structures and Algorithms

  • Data Structures
    Denotes a certain way of organizing, storing and managing data flow to increase efficiency (with respect to time and memory) of a program in a computer.

  • Algorithms
    A set of instructions to be executed in a certain way
    to get the desired output.

Classification of Data Structures

  1. Primitive Data Structures: these are numbers and characters built in a program meaning they can be manipulated by machine level instructions. Ex. integers, characters, Booleans..

  2. Non-Primitive Data Structures: they are derived from primitive data structures thus can not be manipulated by machine level instructions. They form a set of data elements either in homogenous(same data types) or heterogenous(different data types).

Next,
Non-Primitive Data Structures are further divided into:

  • Linear data structures

Elements in a linear data structure maintain a linear relationship among them and although data is arranged in a linear form, arrangement in memory may not be a sequential.

Ex. Arrays,

  • Non-Linear data structures

This kind of data structure data elements form a hierarchical relationship among them.

Ex. Trees and graphs

        Classification of Data Structure

Classification of Data Structures

Data Structures can be of two types:

  • Static Data Structures:

The size of this type of structure is fixed meaning data elements can be modified without changing the memory space allocated to it.

e.g. Arrays

  • Dynamic Data Structures:

This data structure allows changing the size of the memory allocated and contents of the structure can be modified during the operations performed to it or at runtime. e.g. Linked Lists

Comparison between Static vs Dynamic Data Structures

Static Data StructuresDynamic Data Structures
Fixed memory sizesize can be randomly updated during run time
Memory allocation done prior to program executionMemory allocation done during program execution
Overflow is not possible to occur since memory allocation is fixedHas possibilities Overflow or underflow since memory allocation is dynamic

Original Link: https://dev.to/joanwanjiru/data-structures-101-introduction-to-data-structures-and-algorithms-2lhd

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To