소스 정보
- 저장소
- ffsshhttiikk/opencode-agents-skills
- 최근 소스 활동
- 2026년 2월 28일 22:48
- 감지된 SKILL.md 언어
- 영어
- 스타
- 2
- 포크
- 2
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/ffsshhttiikk/opencode-agents-skills --skill computational-complexity명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SOC 직업 분류 기준
SKILL.md 표시 중
| name | computational-complexity |
| description | Algorithm analysis and complexity |
| license | MIT |
| compatibility | opencode |
| metadata | {"audience":"developers","category":"computer-science"} |
When analyzing algorithm performance or choosing between approaches.
# Common time complexities
COMPLEXITIES = {
"O(1)": "Constant - hash table lookup",
"O(log n)": "Logarithmic - binary search",
"O(n)": "Linear - simple loop",
"O(n log n)": "Linearithmic - merge sort",
"O(n^2)": "Quadratic - nested loops",
"O(2^n)": "Exponential - recursive subsets",
"O(n!)": "Factorial - permutations"
}
class ComplexityAnalyzer:
"""Analyze algorithm complexity"""
def analyze(self, code: str) -> Dict:
"""Estimate complexity from code structure"""
return {
"loops": self._count_loops(code),
"recursion": self._detect_recursion(code),
"estimated_complexity": "O(n^2)" # Simplified
}
def empirical_analysis(self, func: Callable,
input_sizes: List[int]) -> Dict:
"""Measure actual runtime"""
times = []
for n in input_sizes:
start = time.time()
func(self._generate_input(n))
elapsed = time.time() - start
times.append(elapsed)
return {
"input_sizes": input_sizes,
"times": times,
"estimated_complexity": self._fit_complexity(input_sizes, times)
}
def _fit_complexity(self, sizes: List[int],
times: List[float]) -> str:
"""Fit complexity to measurements"""
# Simplified: check ratios
if all(times[i+1] / times[i] < 2 for i in range(len(times)-1)):
return "O(n)"
return "O(n^2)"
class SortingAnalyzer:
"""Analyze sorting algorithms"""
@staticmethod
def bubble_sort(arr: List) -> tuple:
"""O(n^2) time, O(1) space"""
n = len(arr)
comparisons = 0
swaps = 0
for i in range(n):
for j in range(0, n-i-1):
comparisons += 1
if arr[j] > arr[j+1]:
arr[j], arr[j+1] = arr[j+1], arr[j]
swaps += 1
return arr, comparisons, swaps
@staticmethod
def merge_sort(arr: List) -> tuple:
"""O(n log n) time, O(n) space"""
if len(arr) <= 1:
return arr, 0
mid = len(arr) // 2
left, lc = SortingAnalyzer.merge_sort(arr[:mid])
right, rc = SortingAnalyzer.merge_sort(arr[mid:])
result, rc2 = SortingAnalyzer._merge(left, right)
return result, lc + rc + rc2
@staticmethod
def _merge() -> :
result = []
i = j =
comparisons =
i < (left) j < (right):
comparisons +=
left[i] <= right[j]:
result.append(left[i])
i +=
:
result.append(right[j])
j +=
result.extend(left[i:])
result.extend(right[j:])
result, comparisons
:
() -> :
depth <= :
() -> :
{
: ,
: ,
: ,
:
}
class NPComplete:
"""Common NP-complete problems"""
@staticmethod
def traveling_salesman(costs: Dict[str, Dict[str, float]]) -> float:
"""TSP - find shortest path visiting all nodes"""
# Exponential - try all permutations
nodes = list(costs.keys())
min_cost = float('inf')
for perm in itertools.permutations(nodes):
cost = sum(costs[perm[i]][perm[i+1]]
for i in range(len(perm)-1))
min_cost = min(min_cost, cost)
return min_cost
@staticmethod
def subset_sum(nums: List[int], target: int) -> bool:
"""Subset sum - find subset that sums to target"""
# NP-complete - exponential
n = len(nums)
for i in range(1 << n):
total = 0
for j in range(n):
i & ( << j):
total += nums[j]
total == target:
() -> :
n = (values)
dp = [[] * (capacity + ) _ (n + )]
i (, n + ):
w (capacity + ):
weights[i-] <= w:
dp[i][w] = (
dp[i-][w],
dp[i-][w - weights[i-]] + values[i-]
)
:
dp[i][w] = dp[i-][w]
dp[n][capacity]
() -> :
np_complete = [
, , , ,
, ,
, ,
]
problem np_complete
class AlgorithmOptimizer:
"""Optimize algorithm performance"""
@staticmethod
def memoize(func: Callable) -> Callable:
"""Add memoization to function"""
cache = {}
def wrapper(*args):
if args not in cache:
cache[args] = func(*args)
return cache[args]
return wrapper
@staticmethod
def divide_and_conquer(arr: List, func: Callable) -> Any:
"""Divide and conquer pattern"""
if len(arr) <= 1:
return func(arr)
mid = len(arr) // 2
left = AlgorithmOptimizer.divide_and_conquer(arr[:mid], func)
right = AlgorithmOptimizer.divide_and_conquer(arr[mid:], func)
return func(left, right)
@staticmethod
def dynamic_programming(table: Dict,
recurrence: Callable) -> Any:
"""Dynamic programming pattern"""
# Bottom-up DP
for state in sorted(table.keys()):
table[state] = recurrence(state, table)
table