跳到正文
cccskills
免费在 GitHub 公开

data-structures-expert

Expert-level data structures covering arrays, linked lists, trees, heaps, hash tables, graphs, and advanced structures like segment trees, tries, and union-find.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(2)

  • SKILL.md2.8 KB
  • .gitkeep0 B

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Data Structures Expert

Before Starting

  1. What operations need to be fast? (insert, delete, search, range query)
  2. Memory constraints?
  3. Ordered or unordered data?

Core Expertise Areas

Linear Structures

Array: O(1) random access, O(n) insert/delete middle, cache-friendly. Linked list: O(1) insert/delete at known position, O(n) search, no random access. Stack: LIFO, O(1) push/pop. Applications: function calls, expression parsing, DFS. Queue: FIFO, O(1) enqueue/dequeue. Applications: BFS, scheduling, buffers. Deque: double-ended queue, O(1) both ends. Sliding window problems.

Trees

BST: O(log n) avg search/insert/delete, O(n) worst case (degenerate). AVL tree: height-balanced BST, O(log n) guaranteed, rotation on insert/delete. Red-black tree: O(log n) guaranteed, fewer rotations than AVL, used in STL map. B-tree: multi-way tree for disk storage, minimizes disk reads, used in databases. Segment tree: range queries and updates, O(log n), build O(n). Trie: prefix tree for strings, O(m) operations where m is string length.

Heaps

Binary heap: complete binary tree, O(log n) insert/delete-max, O(1) peek. Min-heap vs max-heap: heap property direction determines which is O(1) to access. Fibonacci heap: O(1) amortized insert and decrease-key, O(log n) delete-min. Applications: priority queue, Dijkstra, Prim, heap sort, k-th largest.

Hash Tables

Hash function: maps key to index, good function minimizes collisions. Collision resolution: chaining (linked list per bucket), open addressing (probing). Load factor: ratio of elements to buckets, resize when exceeds threshold. O(1) average insert/search/delete, O(n) worst case with many collisions.

Union-Find

Disjoint set union: tracks connected components. Path compression and union by rank: nearly O(1) amortized per operation. Applications: Kruskal MST, cycle detection, dynamic connectivity.

Best Practices

  • Choose structure based on dominant operations in your use case
  • Consider cache performance for large datasets
  • Use lazy deletion where appropriate
  • Understand amortized vs worst-case complexity

Common Pitfalls

PitfallFix
Using linked list for random accessUse array or dynamic array instead
Hash table with bad hash functionTest distribution of hash values
BST degenerating to O(n)Use balanced variant like AVL or RB tree
Segment tree off-by-oneUse 1-indexed and carefully define ranges

Related Skills

  • algorithms-cs-expert
  • python-expert
  • java-expert

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Expert-level abstract algebra knowledge. Use when working with groups, rings, fields, modules, Galois theory, representation theory, or algebraic structures. Also use when the user mentions 'group', 'ring', 'field', 'homomorphism', 'isomorphism', 'normal subgroup', 'quotient group', 'Sylow theorem', 'Galois theory', 'polynomial ring', 'ideal', 'module', 'vector space', or 'representation theory'.

中文简介正在准备中。当前显示原文说明。

luokai0/ai-agent-skills-by-luo-kai132026年5月6日 更新

Expert-level acoustics knowledge. Use when working with sound waves, acoustic propagation, resonance, standing waves, Doppler effect, room acoustics, ultrasound, noise control, musical acoustics, or architectural acoustics. Also use when the user mentions 'sound wave', 'decibel', 'frequency', 'resonance', 'standing wave', 'Doppler effect', 'acoustic impedance', 'reverberation', 'ultrasound', 'noise control', 'harmonics', or 'sound intensity'.

中文简介正在准备中。当前显示原文说明。

luokai0/ai-agent-skills-by-luo-kai132026年5月6日 更新

Expert-level aerodynamics covering subsonic and supersonic flow, lift and drag, airfoil theory, boundary layers, compressible flow, and CFD methods.

中文简介正在准备中。当前显示原文说明。

luokai0/ai-agent-skills-by-luo-kai132026年5月6日 更新

Expert-level air quality engineering covering pollutant sources, atmospheric dispersion, air quality standards, emission controls, and air quality modeling.

中文简介正在准备中。当前显示原文说明。

luokai0/ai-agent-skills-by-luo-kai132026年5月6日 更新

Expert-level aircraft structures covering structural design philosophy, wing and fuselage analysis, fatigue and damage tolerance, composite structures, and certification.

中文简介正在准备中。当前显示原文说明。

luokai0/ai-agent-skills-by-luo-kai132026年5月6日 更新

Expert-level algorithms and complexity theory covering sorting, searching, graph algorithms, dynamic programming, greedy algorithms, NP-completeness, and algorithm design paradigms.

中文简介正在准备中。当前显示原文说明。

luokai0/ai-agent-skills-by-luo-kai132026年5月6日 更新

查看 luokai0 的全部技能

报告此技能的问题