Skip to content

Instantly share code, notes, and snippets.

View serdarmumcu's full-sized avatar

serdarmumcu serdarmumcu

View GitHub Profile
@serdarmumcu
serdarmumcu / RandomCache.java
Created July 31, 2020 09:49
Random Cache Implementation Java
View RandomCache.java
package com.yazilimmimari.hackerrank;
import java.util.*;
public class RandomCache<S,T> {
HashMap<S,T> cache;
int capacity;
RandomCache(int capacity) {
cache = new HashMap<>(capacity);
this.capacity = capacity;
@serdarmumcu
serdarmumcu / FIFOCache.java
Created July 31, 2020 09:48
FIFO Cache Java Implementation
View FIFOCache.java
package com.yazilimmimari.hackerrank;
import java.util.LinkedHashMap;
import java.util.Map;
public class FIFOCache<S,T> {
LinkedHashMap<S,T> cache;
int capacity;
FIFOCache(int capacity) {
cache = new LinkedHashMap<>(capacity);
@serdarmumcu
serdarmumcu / LFUCache.java
Created July 30, 2020 18:48
LFU Cache Implementation Java
View LFUCache.java
package com.yazilimmimari.hackerrank;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
public class LFUCache<S,T> {
public class Node<S,T>
@serdarmumcu
serdarmumcu / LRUCache.java
Created July 30, 2020 18:44
LRU Cache Java Implementation
View LRUCache.java
package com.yazilimmimari.hackerrank;
import java.util.LinkedHashMap;
import java.util.Map;
public class LRUCache<S,T> {
LinkedHashMap<S,T> cache;
int capacity;
LRUCache(int capacity) {
cache = new LinkedHashMap<>(capacity);