Programming Foundations Algorithms With Python

Overview

Programming-Foundations-Algorithms

Algorithms purpose

to solve a specific proplem with a sequential sets of steps for instance : if you need to add different shaped in groups you can use loop by iterate on each shape if its belong to this group or not

Algorithms charachteristics

  • algorithms complixity
    • space complixity
    • time complixity
  • input and output
  • classification
    • serial/parallel
    • exact/approximate

common algorithms

  • searching algo find a specific data from a structure
  • sorting algo take a set of data and apply a sort order to it
  • computational algo given a ser of data calculate another (calculator)
  • collection algo work with collection of data : manipulating and navigating amoung sets of data that are sorted (count a specific items) exerciese for an algorithm
def greatest common denomonator (a,b)
    while (b != 0)
        t=a
        a=b
        b=t%b
    return a 

print(20,8)

Algorithm performance

  • how an algorithm will be have based on the size of input set data
  • big-O to describe algorithm performance as the size of input grows over time it usually describe the worst case senario

Time complixity rank

  • O(1) operation in question doesnt depend on the number of elements in the given data set (calculating the number is even or odd)
  • O(log n) finding a specific value in a sorted array using a bionary search so if the number of elements grow it takes logarithmic time relation to find any given item
  • O(n) searching for an item in an unsorted array as number of items increase it take the corrosponding linear time to complete the search
  • O(nlogn) sorting algorithm like stack and merge sort
  • O(n2) as the number of data increase the time it take is squared

Overview on Data structure

1: Array

it has either one dimention or multiple , you can calculate

  • item index O(1)
  • insert or delete at beginning or middle O(n)
  • insert or delete at end : O(1)

2: Linked lists(nodes)

  • linear collection of data elements each node has a field that refer to the next element in the list
  • the benifit of it over arrays is that its fast and easy to add and remove items from the list
  • its not necessary to recognize the essintial memory that hold the data because the individual nodes doesnt have to be stored adjecently like arrays
  • the linked lists cant do canstant time random access to any item in the list like the array

**you can inserting a new item in the list**

#### 3: stack **is collection that support two priciples .** * push * pop the last item pushed is the first one poped

is used in * expression processing * back tracking #### 4: Queue **its collection that supports adding and removing and work like stack but** the first item added is the first one removed

is used in * order processing * massaginh #### 5: hash tables **an ability to unique map a given key to a specific value (word during dictionary list)**

it * is very fast * for small data sets array is more efficient * hash table dont order entries in a predictable way ___ ### Recursion * your recursive function return at some point (breaking condition) * otherwise it leeds to infinite loop * each time the function called the value of arguments of the previous call are stored aside not written over by the new call (call stack) ### sorting data ####1: bubble sort

its

  • very simple to understand and implement
  • performance O(n2)
    • for loops inside of for loops are usually n2
  • other sorting algorithms are generally much better

2: merge sort

by

  • divide and conquer algorithm
  • breaks a dataset into individual pieces and merges them
  • uses recursion to operate on datasets its
  • performs well on large sets of data
  • generally has O(nlogn) performance

3: Quicksort

  • divide and conquer algorithm
  • uses recursion to operate on datasets
  • generally has O(nlogn) performance
  • operate in place on the data
  • worst case is O(n2) when data is mostly sorted already

searching data

  • unordered list search
  • ordered list search
  • determine if alist is sorted

other algorithms

  • filtering hash table
  • counting value with hash table
  • find max value recusively
Owner
omar nafea
omar nafea
An implementation of ordered dithering algorithm in python as multimedia course project

One way of minimizing the size of an image is to simply reduce the number of bits you use to represent each pixel.

7 Dec 02, 2022
Python-Strongest-Encrypter - Transform your text into encrypted symbols using their dictionary

How does the encrypter works? Transform your text into encrypted symbols using t

1 Jul 10, 2022
Repository for data structure and algorithms in Python for coding interviews

Python Data Structures and Algorithms This repository contains questions requiring implementation of data structures and algorithms concepts. It is us

Prabhu Pant 1.9k Jan 01, 2023
Cormen-Lib - An academic tool for data structures and algorithms courses

The Cormen-lib module is an insular data structures and algorithms library based on the Thomas H. Cormen's Introduction to Algorithms Third Edition. This library was made specifically for administeri

Cormen Lib 12 Aug 18, 2022
causal-learn: Causal Discovery for Python

causal-learn: Causal Discovery for Python Causal-learn is a python package for causal discovery that implements both classical and state-of-the-art ca

589 Dec 29, 2022
This repository is not maintained

This repository is no longer maintained, but is being kept around for educational purposes. If you want a more complete algorithms repo check out: htt

Nic Young 2.8k Dec 30, 2022
A Python project for optimizing the 8 Queens Puzzle using the Genetic Algorithm implemented in PyGAD.

8QueensGenetic A Python project for optimizing the 8 Queens Puzzle using the Genetic Algorithm implemented in PyGAD. The project uses the Kivy cross-p

Ahmed Gad 16 Nov 13, 2022
An open source algorithm and dataset for finding poop in pictures.

The shitspotter module is where I will be work on the "shitspotter" poop-detection algorithm and dataset. The primary goal of this work is to allow for the creation of a phone app that finds where yo

Jon Crall 29 Nov 29, 2022
Solving a card game with three search algorithms: BFS, IDS, and A*

Search Algorithms Overview In this project, we want to solve a card game with three search algorithms. In this card game, we have to sort our cards by

Korosh 5 Aug 04, 2022
Algorithms and data structures for educational, demonstrational and experimental purposes.

Algorithms and Data Structures (ands) Introduction This project was created for personal use mostly while studying for an exam (starting in the month

50 Dec 06, 2022
This is the code repository for 40 Algorithms Every Programmer Should Know , published by Packt.

40 Algorithms Every Programmer Should Know, published by Packt

Packt 721 Jan 02, 2023
The DarkRift2 networking framework written in Python 3

DarkRiftPy is Darkrift2 written in Python 3. The implementation is fully compatible with the original version. So you can write a client side on Python that connects to a Darkrift2 server written in

Anton Dobryakov 6 May 23, 2022
Fedlearn algorithm toolkit for researchers

Fedlearn algorithm toolkit for researchers

89 Nov 14, 2022
A litle algorithm that i made for transform a picture in a spreadsheet.

PicsToSheets How it works? It is an algorithm designed to transform an image into a spreadsheet file. this converts image pixels to color cells of she

Guilherme de Oliveira 1 Nov 12, 2021
FingerPy is a algorithm to measure, analyse and monitor heart-beat using only a video of the user's finger on a mobile cellphone camera.

FingerPy is a algorithm using python, scipy and fft to measure, analyse and monitor heart-beat using only a video of the user's finger on a m

Thiago S. Brasil 37 Oct 21, 2022
So far implements A* will add more later

Pathfinding_Visualization Finds the shortest path between two nodes. The light blue path is the shortest path. The black nodes are barriers. Created i

Lukas DeLoach 1 Jan 18, 2022
Algorithmic trading backtest and optimization examples using order book imbalances. (bitcoin, cryptocurrency, bitmex)

Algorithmic trading backtest and optimization examples using order book imbalances. (bitcoin, cryptocurrency, bitmex)

172 Dec 21, 2022
There are some basic arithmatic in Pattern Recognization and Machine Learning writed in Python in this repository

There are some basic arithmatic in Pattern Recognization and Machine Learning writed in Python in this repository

1 Nov 19, 2021
PICO is an algorithm for exploiting Reinforcement Learning (RL) on Multi-agent Path Finding tasks.

PICO is an algorithm for exploiting Reinforcement Learning (RL) on Multi-agent Path Finding tasks. It is developed by the Multi-Agent Artificial Intel

21 Dec 20, 2022
A fast python implementation of the SimHash algorithm.

This Python package provides hashing algorithms for computing cohort ids of users based on their browsing history. As such, it may be used to compute cohort ids of users following Google's Federated

Hybrid Theory 19 Dec 15, 2022