---
# System prepended metadata

title: Lucien

---

# Some good exercises


## Map/Hashtable/Dictionary
The task is to build a map/hashtable datastructure using only `basic` data type. https://en.wikipedia.org/wiki/Hash_table

This would be equivalent to Javascripts `Map` that allows you to perform several map operations. e.g `get`, `set`, etc..
See Javascripts map here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map

Use any collision resolution method you like and feel free to add any cool features you see fit

Sample usage for your map would be something like
```
const m = new MyMap()
m.set("a", 1)
const v = m.get("a")
console.log(1 == v) // true
```

## Cache

The task is to build an in-memory key-value store (cache). You can use any in-built complex data types like `Map`, `Set`, etc.. (or you can use your custom Map from the map exercise above 😉 )
https://en.wikipedia.org/wiki/Cache_(computing)

Your cache should be configurable with the following options:
- size: The max number of items the cache can hold
- strategy: The replacement/eviction strategy to use. LRU or LFU. See https://en.wikipedia.org/wiki/Cache_replacement_policies
- ttl: A duration after which the item should be automatically evicted from the cache. i.e The item is `stale`


Sample usage for your map would be something like
```
const options = {...}
const c = new Cache(options)
c.set("a", 1)
const v = m.get("a")
console.log(1 == v) // true
```