Git Product home page Git Product logo

data-structures-algorithms-in-python's Introduction

Data-Structures-Algorithms-in-Python

This folder, contains some of my investigation on Data Structures and Algorithms.

Project Instructions

Instructions

  1. Clone the repository and navigate to the downloaded folder.

    	git clone https://github.com/Kabongosalomon/Data-Structures-Algorithms-in-Python.git
    	cd Data-Structures-Algorithms-in-Python
    

Linked List

There isn't a built-in data structure in Python that looks like a linked list. Thankfully, it's easy to make a classe that can represent a Linked List in Python!

Stack

Here we make our own Stack class to see how a stack really works under the hood.

Queue

We will make a Queue class using a list.

Binary Tree

We will make our own class that implement binary tree and some of it's basic operations

Binary Search Tree

A more specific type of binary tree, where every element in the left is smaller than element in the right. We wrote a class than will simulate this notion and run basic operations on this type of tree.

Graph Representations

Sorting-Algorithm

This folder will contains my implementations of some sorting algorithm from scratch.

QuickSort

Quicksort is a divide and conquer algorithm which relies on a partition operation: to partition an array, an element called a pivot is selected. All elements smaller than the pivot are moved before it and all greater elements are moved after it.

Efficiency

This can be done efficiently in linear time and in-place. The lesser and greater sublists are then recursively sorted. This yields average time complexity of O(n log n), with low overhead, and thus this is a popular algorithm. Efficient implementations of quicksort (with in-place partitioning) are typically unstable sorts and somewhat complex, but are among the fastest sorting algorithms in practice. Together with its modest O(log n) space usage, quicksort is one of the most popular sorting algorithms and is available in many standard programming libraries.

Algorithm

Quicksort is a divide and conquer algorithm which relies on a partition operation: to partition an array, an element called a pivot is selected. All elements smaller than the pivot are moved before it and all greater elements are moved after it.

Read more here : https://en.wikipedia.org/wiki/Sorting_algorithm#Quicksort

Binary Search

Algorithm

Binary search works on sorted arrays. Binary search begins by comparing an element in the middle of the array with the target value. If the target value matches the element, its position in the array is returned. If the target value is less than the element, the search continues in the lower half of the array. If the target value is greater than the element, the search continues in the upper half of the array. By doing this, the algorithm eliminates the half in which the target value cannot lie in each iteration.

Read more here : https://en.wikipedia.org/wiki/Binary_search_algorithm

The important caveat about quicksort is that its worst-case performance is $O(n^2)$. The most complex issue in quicksort is thus choosing a good pivot element, as consistently poor choices of pivots can result in drastically slower performance, but good choice of pivots yields $O(n*log(n))$ performance, which is asymptotically optimal.

Contribution

Feel free to add any other algorithm and suggest a better implementation of the above coded algorithm.

data-structures-algorithms-in-python's People

Contributors

kabongosalomon avatar

Watchers

James Cloos avatar  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.