Algorithm Choice logo

Algorithm Choice

Community
0xBakeer
algorithm-choice

Choosing a data structure or algorithm for a task - sizing the input, complexity targets, hash maps versus sorted structures, sets, heaps, graphs (BFS, DFS, Dijkstra), dynamic programming, and checking with a brute-force oracle.

Overview

Publisher0xBakeer
RepositoryTandemLLM
Skill namealgorithm-choice
Stars
75
Forks
14
Bundled files
Instructions only
LicenseAGPL-3.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by 0xBakeer on GitHub. Read the source before you install it.

Installation

Install the Algorithm Choice AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/0xBakeer/TandemLLM/tree/main/packages/library/algorithm-choice
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/0xBakeer/TandemLLM.git /tmp/TandemLLM
mkdir -p .claude/skills
cp -r /tmp/TandemLLM/packages/library/algorithm-choice .claude/skills/algorithm-choice
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Algorithm Choice in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Algorithm Choice on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Algorithm Choice is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Algorithm and data structure choice

Rules:

  • Size the input first: items (n), queries (q), how often it runs. n up to 10^4: anything works; 10^6: O(n log n) or better; 10^8: linear or a different approach.
  • Pick by the operation: membership and lookup by key = hash map or set (O(1)); ordered iteration, range queries, nearest = sorted array with bisect or a tree; repeated min or max = heap; FIFO = deque; LIFO = list.
  • Graphs: unweighted shortest path = BFS; reachability or components = DFS or union-find; weighted non-negative = Dijkstra with a heap; dependencies = topological sort.
  • Overlapping subproblems with optimal substructure = dynamic programming; write the recurrence and the base case before code, memoize first, tabulate if memory allows.

What goes wrong:

  • x in list inside a loop: O(n^2) hiding in one line. Use a set.
  • Sorting on every query instead of once.
  • Recursion depth on n = 10^5 (Python limit 1000); use an explicit stack or iteration.

Check: measured time at the real n, a 100-case comparison with the brute force (all equal), and the edges (empty, one, all equal, max size).

Done when:

  • The chosen structure and its complexity named with the real n and q.
  • Random comparison with a brute force: 100 cases, 0 mismatches (output shown).
  • Timing at the real size in the result.

Reference

Oracle test:

python
import random
def brute(xs, k): return sum(1 for i in range(len(xs)) for j in range(i+1, len(xs)) if xs[i] + xs[j] == k)
def fast(xs, k):
    from collections import Counter
    c = Counter(); n = 0
    for x in xs: n += c[k - x]; c[x] += 1
    return n
for _ in range(100):
    xs = [random.randint(-5, 5) for _ in range(random.randint(0, 12))]; k = random.randint(-10, 10)
    assert brute(xs, k) == fast(xs, k), (xs, k)
print("oracle ok")

Pieces:

python
import bisect, heapq
from collections import deque, Counter, defaultdict
i = bisect.bisect_left(sorted_xs, target)              # first index >= target
heapq.heappush(h, (dist, node)); d, u = heapq.heappop(h)
def bfs(adj, s):
    dist = {s: 0}; q = deque([s])
    while q:
        u = q.popleft()
        for v in adj[u]:
            if v not in dist: dist[v] = dist[u] + 1; q.append(v)
    return dist
def dijkstra(adj, s):           # adj[u] = [(v, w)]
    dist = {s: 0}; h = [(0, s)]
    while h:
        d, u = heapq.heappop(h)
        if d > dist[u]: continue
        for v, w in adj[u]:
            if d + w < dist.get(v, float("inf")): dist[v] = d + w; heapq.heappush(h, (d + w, v))
    return dist

DP shape: @functools.lru_cache(None) def f(i, rem): if i == n: return 0 if rem == 0 else -inf; return max(f(i+1, rem), val[i] + f(i+1, rem-w[i]) if rem >= w[i] else -inf); raise the limit with sys.setrecursionlimit(10**6) or tabulate. Sizes: Python does about 10^7 simple operations a second; a dict of 10^6 ints uses about 100 MB.

More rules:

  • Use the standard library (sorted, bisect, heapq, collections.Counter, functools.lru_cache) before writing a structure.
  • Verify against a brute force on random small inputs (100 cases) before trusting the fast version.

More pitfalls:

  • Floating-point keys in a dict or set; round or use integers.
  • An approach correct on the example but exponential on the real size; count the operations with the real n.

Frequently asked questions

What does the Algorithm Choice AI skill do?

Choosing a data structure or algorithm for a task - sizing the input, complexity targets, hash maps versus sorted structures, sets, heaps, graphs (BFS, DFS, Dijkstra), dynamic programming, and checking with a brute-force oracle.

Why use Algorithm Choice on TypingMind?

Because you install it once and use it with any model. Algorithm Choice is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Algorithm Choice in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/0xBakeer/TandemLLM/tree/main/packages/library/algorithm-choice. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Algorithm Choice?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Algorithm Choice?

As many as you like. As long as a model supports skills, you can use Algorithm Choice with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Algorithm Choice AI skill free?

Yes. It is published on GitHub by 0xBakeer under the AGPL-3.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇