Skip to content
View ruhilmansi's full-sized avatar
:octocat:
:octocat:
  • banasthali vidyapeeth
  • 127.0.0.1

Block or report ruhilmansi

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Maximum 250 characters. Please don't include any personal information such as legal names or email addresses. Markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
ruhilmansi/readme.md

hi hi, i'm mansi
curious how machines think (and how not to)

mail- mail me
portfolio- hello uwuntu
linkedin- linkedin


my cute lil hashmap <3

class HashMap:
    def __init__(self):
        self.bucket = []
        for i in range(7):
            self.bucket.append([])

        print("hashmap initialized (exploring data structures beyond built-ins)")
        # i genuinely love hashmaps <3

    def put(self, key, value):
        index = hash(key) % len(self.bucket)

        for i, (k, v) in enumerate(self.bucket[index]):
            if k == key:
                self.bucket[index][i][1] = value
                print(f"updated '{key}' with new value")
                return

        self.bucket[index].append([key, value])
        print(f"added '{key}' → '{value}'")

    def get(self, key):
        index = hash(key) % len(self.bucket)

        for k, v in self.bucket[index]:
            if k == key:
                print(f"found '{key}'")
                return v

        print(f"'{key}' not found (maybe added it later)")
        return None

    def remove(self, key):
        index = hash(key) % len(self.bucket)

        before = len(self.bucket[index])
        self.bucket[index] = [pair for pair in self.bucket[index] if pair[0] != key]
        after = len(self.bucket[index])

        if before != after:
            print(f"removed '{key}'")
        else:
            print(f"'{key}' wasn’t there anyway")

github stats

now playing

spotify-github-profile

Pinned Loading

  1. cli-blockchain cli-blockchain Public

    create a blockchain, add transactions, mint blocks and modify difficulty and rewards

    Rust

  2. mario-run-js mario-run-js Public

    practicing JS by building a mario run clone

    JavaScript

  3. fail-u-forward fail-u-forward Public

    community driven platform where failure is not something to hide but something to celebrate : all the stuff LinkedIn filters out

    TypeScript 1