Introduction to Data Structures & Algorithms

Introduction to Data Structures & Algorithms

Building blocks of an Elite Software Engineer

Overview

What is a Data Structure?

Its a way, or method, of storing data in your computer: organized in some fashion so that it can be accessed, queried and updated quickly and easily.

What is an Algorithm?

This is a well-defined, finite compilation of instructions or steps that seek to solve a predefined problem. In this case, it an be defined as the set of instructions for executing operations done on different data structures.

Purpose of Data Structures

  • They provide essential building blocks for creating fast and powerful algorithms.
  • They aid in managing and organizing data.
  • They make code easier and cleaner to interpret and understand.

Classification of Data Structures

390af4b9-c3fe-4581-8304-1d1f64cdda93.jfif

  1. Linear data structure: Here, data elements are arranged sequentially or linearly in one dimension (the linear dimension). Each element is attached to its previous and next adjacent elements. Examples include arrays, stacks, queues, linked list, etc.

    • Static data structure: It has a fixed memory size and elements are easily accessed in this structure. An example of this data structure is an array.
    • Dynamic data structure: Here, the size is not fixed. It can be randomly updated during the runtime which may be considered efficient concerning the memory (space) complexity of the code. Examples of this data structure are queue, stack, etc.
  2. Non-linear data structure: In this structure, elements are arranged in one-many, many-one, many-many dimensions. We can’t traverse all the elements in a single run only. Examples of non-linear data structures are trees and graphs. Arrays: