Giter VIP home page Giter VIP logo

sob21_challenge's Introduction

SOB21_Challenge

My solution for the Summer of Bitcoin Challenge 2021!

1st Approach - Brute force using iteration see file --- sob_brute

2nd Approach - Optimized using greedy Method see file --- sob_optmized

3rd Approach - Using Dynamic Programming! (0 1 Knapsack Problem - Max weight and Max Profit)

SUDO CODE for 0 1 knapsack Problem- 3rd Approach(Was not able to implement due to lack of time)

def knapsack(v, w, W):
 
    # `T[i][j]` stores the maximum value of knapsack having weight less
    # than equal to `j` with only first `i` items considered.
    T = [[0 for x in range(W + 1)] for y in range(len(v) + 1)]
 
    # do for i'th item
    for i in range(1, len(v) + 1):
 
        # consider all weights from 0 to maximum capacity `W`
        for j in range(W + 1):
 
            # don't include the i'th element if `j-w[i-1]` is negative
            if w[i - 1] > j:
                T[i][j] = T[i - 1][j]
            else:
                # find the maximum value we get by excluding or including the i'th item
                T[i][j] = max(T[i - 1][j], T[i - 1][j - w[i - 1]] + v[i - 1])
 
    # return maximum value
    return T[len(v)][W]                                                                                                  Source - Techie Delight
    
    ```

sob21_challenge's People

Contributors

uttam-singhh 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.