feat(viz): dp coin change

This commit is contained in:
2025-09-01 21:29:23 +01:00
parent eb21fc7435
commit 03db344fb2
7 changed files with 1436 additions and 1 deletions

View File

@@ -86,6 +86,9 @@ export interface DataState {
trees?: BinaryTreeState[];
// Queue support
queues?: QueueState[];
// Grid support (for DP visualizations)
grids?: GridState[];
gridPointers?: GridPointerState[];
}
/** Single step in the visualization */
@@ -246,3 +249,34 @@ export interface QueueState {
elements: QueueElementState[];
label?: string;
}
// ============================================
// Grid Types (for DP visualizations)
// ============================================
/** State of a grid cell */
export interface GridCellState {
id: string;
value: number | string;
row: number;
col: number;
state: 'normal' | 'highlighted' | 'comparing' | 'computing' | 'success' | 'dimmed';
}
/** Complete grid state */
export interface GridState {
id: string;
cells: GridCellState[][]; // 2D array: cells[row][col]
colLabels?: (string | number)[];
rowLabels?: (string | number)[];
label?: string;
}
/** Pointer for grid visualization */
export interface GridPointerState {
id: string;
name: string;
row: number;
col: number;
color: 'current' | 'dependency' | 'result' | 'default';
}