Giter Club home page Giter Club logo

searching-and-sorting-algorithms's Introduction

Implementation of Searching and Sorting Algorithms in Python

Searching Algorithms

Sequential Search
  • Search items in sequence.
  • Complexity of the sequential search, is O(n).
  • Sequential search can be improved by ordering the list in the case when the searched item is absent.
    • seq_search.py
Binary Search
  • Take greater advantage of the ordered list.
  • Complexity of the sequential search, is O(nlogn)
  • A great example of a divide and conquer strategy
    • bin_search.py
Hashing
  • Hash table is a collection of items and aach position of the hash table, often called a slot.
  • The mapping between an item and the slot where that item belongs in the hash table is called the hash function.
  • Hash function formation methods include folding method, mid-square method, linear probing, quadratic probing etc
  • Complexity of the sequential search, is O(1)
    • hashing.py

Sorting Algorithms

Bubble Sort
  • Compares adjacent items and exchanges those that are out of order
  • Complexity is O(n^2)
    • bubble_sort.py
Selection Sort
  • Makes only one exchange for every pass through the list.
  • Complexity is O(n^2)
    • selection_sort.py
Insertion Sort
  • Builds the final sorted list one item at a time
  • Always maintains a sorted sublist in the lower positions of the list
  • Complexity is O(n^2)
    • insertion_sort.py
Merge Sort
  • Divide and conquer strategy
  • Requires extra space to hold the two halves
  • Complexity is O(nlogn)
    • merge_sort.py
Quick Sort
  • Divide and conquer strategy
  • Not using additional storage.
  • Complexity is O(n^2)
    • quick_sort.py

searching-and-sorting-algorithms's People

Contributors

sreejithc321 avatar

Stargazers

Wilfredo D. Catalan avatar Radoslaw Opoczyński avatar Farahiyah Syarafina 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.