{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "d9c6ee4c-0223-40c9-93ac-7002fb720fc5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "4505353088\n",
      "4505410560\n"
     ]
    }
   ],
   "source": [
    "from  dsa.hashtable import HashTable\n",
    "\n",
    "ht = HashTable()\n",
    "\n",
    "print(id(ht.array[0]))\n",
    "print(id(ht.array[1]))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "0f741fdc-173d-49fc-9fc5-5c9b0d4d8be1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "4\n",
      "2\n",
      "3\n",
      "3\n",
      "Bucket 0: []\n",
      "Bucket 1: []\n",
      "Bucket 2: []\n",
      "Bucket 3: []\n",
      "Bucket 4: []\n",
      "Bucket 5: []\n",
      "Bucket 6: [['B', 2]]\n",
      "Bucket 7: [['C', 3]]\n",
      "Bucket 8: []\n",
      "Bucket 9: []\n",
      "Bucket 10: []\n",
      "Bucket 11: []\n",
      "Bucket 12: []\n",
      "Bucket 13: []\n",
      "Bucket 14: []\n",
      "Bucket 15: []\n",
      "Bucket 16: []\n",
      "Bucket 17: []\n",
      "Bucket 18: []\n",
      "Bucket 19: []\n",
      "\n"
     ]
    }
   ],
   "source": [
    "ht = HashTable()\n",
    "ht.set(\"A\", 1)\n",
    "ht.set(\"B\", 2)\n",
    "ht.set(\"C\", 3)\n",
    "ht.set(\"A\", 4)\n",
    "print(ht.get(\"A\"))\n",
    "print(ht.get(\"B\"))\n",
    "print(ht.get(\"C\"))\n",
    "print(ht.count)\n",
    "ht.delete(\"X\")\n",
    "ht.delete(\"A\")\n",
    "print(ht)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "716dda30-37cd-4d79-8022-c4bbcde3d518",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "4\n",
      "2\n",
      "3\n",
      "3\n",
      "Bucket 0: [['B', 2], ['C', 3]]\n",
      "\n"
     ]
    }
   ],
   "source": [
    "ht = HashTable(1)\n",
    "ht.set(\"A\", 1)\n",
    "ht.set(\"B\", 2)\n",
    "ht.set(\"C\", 3)\n",
    "ht.set(\"A\", 4)\n",
    "print(ht.get(\"A\"))\n",
    "print(ht.get(\"B\"))\n",
    "print(ht.get(\"C\"))\n",
    "print(ht.count)\n",
    "ht.delete(\"X\")\n",
    "ht.delete(\"A\")\n",
    "print(ht)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "9b9d3209-8d03-477c-9f9b-0bf02cc8a2bc",
   "metadata": {},
   "outputs": [],
   "source": [
    "ht.delete(\"X\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "849175ed-c5b2-4907-9b97-4ea4d0653a80",
   "metadata": {},
   "outputs": [],
   "source": [
    "ht.delete(\"A\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "ac62bc9c-033f-4a95-93ee-d43e1929e6b1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Bucket 0: []\n",
       "Bucket 1: []\n",
       "Bucket 2: []\n",
       "Bucket 3: []\n",
       "Bucket 4: []\n",
       "Bucket 5: []\n",
       "Bucket 6: [['B', 2]]\n",
       "Bucket 7: [['C', 3]]\n",
       "Bucket 8: []\n",
       "Bucket 9: []\n",
       "Bucket 10: []\n",
       "Bucket 11: []\n",
       "Bucket 12: []\n",
       "Bucket 13: []\n",
       "Bucket 14: []\n",
       "Bucket 15: []\n",
       "Bucket 16: []\n",
       "Bucket 17: []\n",
       "Bucket 18: []\n",
       "Bucket 19: []"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ht"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "abcfb3dc-83b4-43ac-88a1-2807ddc7c3c1",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fb9367d5-53af-4bb7-a77a-0b4eb956f7fd",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
