Skip to content

Instantly share code, notes, and snippets.

View bhrigu123's full-sized avatar

Bhrigu Srivastava bhrigu123

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<title>Fetching photos</title>
<link href="E:\W\js\timer.css" type="text/css" rel="stylesheet">
</head>
<body>
<script>
var req;
function fetchData(){
@bhrigu123
bhrigu123 / HuffmanCoding.py
Last active December 31, 2019 11:08
Code for Huffman Coding, compression and decompression. Explanation at http://bhrigu.me/blog/2017/01/17/huffman-coding-python-implementation/
import heapq
import os
class HeapNode:
def __init__(self, char, freq):
self.char = char
self.freq = freq
self.left = None
self.right = None
#include <iostream>
#include <string>
#include <map>
using namespace std;
void makeMapping(map<int, string>& mapping) {
mapping[0] = "";
mapping[1] = "One";
mapping[2] = "Two";
mapping[3] = "Three";
import java.util.HashMap;
import java.util.Map;
public class LRUCache<T> {
private final int capacity;
private int size;
private final Map<String, Node> hashmap;
private final DoublyLinkedList internalQueue;
#include <iostream>
#include <map>
using namespace std;
class Node {
public:
int key, value;
Node *prev, *next;
Node(int k, int v): key(k), value(v), prev(NULL), next(NULL) {}
};