Instagram
youtube
Facebook
Twitter

Introduction

Data Structures and Algorithms (DSA) are fundamental concepts in computer science that help to solve complex problems efficiently. A good understanding of DSA is crucial for any programmer or software engineer. In this tutorial, we will introduce you to the basics of DSA in Python.

Data Structures

  • Data structures are the means by which we can store and retrieve information. You're already familiar with Python lists and dictionaries, so you understand that lists and arrays are sequential with data accessed by index, whereas dictionaries and objects store and retrieve information using a named key.

  • Data Structures in programming languages resemble pretty much our real world if we think outside of the digital space.

  • Think of a shopping complex where we see the all different types of clothes arranged in groups order if they weren't arranged in order then we'd find trouble finding the best kind of cloth we desire.

  • Data structures handle four main functions for us:

    • Inputting information

    • Processing information

    • Maintaining information

    • Retrieving information

  • Inputting Information concerned with how the data is received and what kind of information the data has and is it going to add at the beginning, end, or somewhere middle of the existing data.

  • Processing deals with how the data is manipulated like, adding, removing, or updating data.

  • Maintaining is concerned with how data is organized. 

  • Retrieving means finding the data and returning stored data in the structure.

Algorithms

  • Algorithms are simply set of instructions that the computer follows to perform desired tasks.

  • There are many types of algorithms but important ones are:

    • Sorting Algorithms

    • Search Algorithms

    • Divide and Conquer Algorithms

    • Brute Force Algorithms

    • Greedy Algorithms

  • For example: if we have an array of numbers (integers) we could perform something with this array we need an algorithm like if we wanted to sort this array in increasing order we are going to need a sorting algorithm, the same follows for searching and other operations.