Skip to content

Instantly share code, notes, and snippets.

View dVakulen's full-sized avatar

Dmytro Vakulenko dVakulen

View GitHub Profile
@dVakulen
dVakulen / LRU
Last active January 6, 2018 16:23
Cache
Single process version:
LRUCache (Dictionary wrapper):
- Action filters:
- On Get:
- Mark entry access
- On Put (AddOrUpdate):
- Remove the least recently used
- Least recently used:
@dVakulen
dVakulen / Backtracking
Created January 6, 2018 14:13
Word Break Problem
Distinct requirements:
- Find all possible combinations of characters
- Match each combination entry with desired set
@dVakulen
dVakulen / Algorithm
Last active January 6, 2018 14:00
Backtracking
1) Start in the leftmost column
2) If all queens are placed
return true
3) Try all rows in the current column. Do following
for every tried row.
a) If the queen can be placed safely in this row
then mark this as part of the
solution and recursively check if placing
queen here leads to a solution.
b) If placing queen in leads to a
@dVakulen
dVakulen / Solving
Last active January 6, 2018 13:56
General pattern
- Describe the purpose
- Reduce the delta between reality and vision
- Recalculate
@dVakulen
dVakulen / SolutionSearch
Last active December 30, 2017 17:30
Assessment patterns
- Define:
- Purpose.
- Requirements.
- Set of abilities.
- Prioritized ways. (Preferably consider at least two alternatives to increase chances of making the optimal choice)
- Estimated time to change.
- Case of existing way:
- Recheck consequences calculation.
- Act.
- Case of error:
@dVakulen
dVakulen / Areas
Last active December 27, 2017 14:21
Reality
- Who is responsible
@dVakulen
dVakulen / Levels
Created December 27, 2017 14:09
Reality assessment
.
?
@dVakulen
dVakulen / Implementation detail
Last active December 27, 2017 13:44
The pattern
Stop.
Analyze:
- What happened.
- Why.
- What will happen.
- Why.
- What action should be taken.
- Why.
- What consequences will it bring
@dVakulen
dVakulen / Reasons to live:
Last active December 27, 2017 13:32
I don't have time.
- Will to calculate.
@dVakulen
dVakulen / gist:a4c4b7aaabb10ac9f4e97dadf491250d
Created December 27, 2017 13:12
I'm the nearest friend of you
friend of you