Giter Club home page Giter Club logo

datastructures's Introduction

DataStructres

How data is organized, stored, and manipulated within a program.

Infrastructure(consecutive and non-consecutive Memory stores)>>>operations

  • operations
    • static >> no change in infrastructure(get or set value)
    • Dynamic >> change infrastructure(array resizing)

Table of contents:

  • 1-Linear Data Structure
    • Static Data Structure
    • Dynamic Data Structure
  • 2-Non-Linear Data Structure

DataTypes

The kind of value that tells what operations can be performed on a particular data

Basic Data Types

  • Numeric Types:

*    int: Integer values (e.g., 10, -3).
*    float: Floating-point numbers (e.g., 3.14, -0.001).
*  complex: Complex numbers (e.g., 1+2j, -3j).
  • Boolean Type:

    • bool: Represents True or False.
  • String Type:

    • str: Sequence of Unicode characters (e.g., "hello", 'python').

Compound Data Types

  • List: Ordered, mutable collection of items (e.g., [1, 2, 3], ['a', 'b', 'c']).
  • Tuple: Ordered, immutable collection of items (e.g., (1, 2, 3), ('a', 'b', 'c')).
  • Set: Unordered collection of unique items (e.g., {1, 2, 3}, {'a', 'b', 'c'}).
  • Dict: Unordered collection of key-value pairs (e.g., {'a': 1, 'b': 2}, {1: 'one', 2: 'two'}).

Special Data Types

  • None: Represents the absence of a value or a null value.

Everything in python is an object
Every python object carry(type - refcount - value)
  • Objects

    • Simple (Numbers - Strings)

      • Store thier own value
      • Stored in memory once
    • Container (Dicts - Lists - User defined Classes)

Memory Mangement

image

Garbage Collection

Automatically release memory when the object takingup that space is no longer in use

Arrays

Array is not builtin python datastructure but we can implement it by array module
In Python, WE don’t typically work with arrays, but with lists. There are libraries to work with arrays, but you only use them for certain specialized purposes. Such as when you need matrix multiplication or some other advanced math, and want to do it quickly.

Access data by index(Memory):

array base address+single value stores count * index
single value stores count = number of array elements

Arrays Types:

  • Simple Array
  • Two dimensional Array
  • Multi dimensional Array
  • Jagged array[list of lists-in python]

To Deal with Arrays in python:

  • Import array module
  • Declare your variable with Typecode //>> variable_name = array(typecode,[elements])

OR Import numpy It is a Python library that provides a multidimensional array object, various derived objects (such as masked arrays and matrices), and an assortment of routines for fast operations on arrays, including mathematical, logical, shape manipulation, sorting, selecting, I/O, discrete Fourier transforms, basic linear algebra, basic statistical operations, random simulation and much more.

datastructures's People

Contributors

salma25128 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.