Skip to content

Instantly share code, notes, and snippets.

View ntsvetanov's full-sized avatar

Nikolay Tsvetanov ntsvetanov

  • Sofia
  • 22:16 (UTC +02:00)
View GitHub Profile
@ntsvetanov
ntsvetanov / bobp-python.md
Created April 20, 2024 13:02 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens

Git Cheat Sheet

Commands

Getting Started

git init

or

This is a python implementation of a subset sum algorithm by Konstantinos Koiliaris and me.

Given a set of n positive integers, the algorithm finds all the values t<=u such that there exists a subset that sums to t.

The running time is O(sqrt(n)u) with some extra polylog factors.

There is also a C++ implementation of the standard dynamic programming algorithm for subset sum. The DP table gets packed into 64 bit unsigned integers. It's probably the fastest possibe implementation of the O(nu) time algorithm without getting into ASM and parallelism.