feat(viz): tree/BFS/DFS patterns
This commit is contained in:
@@ -82,6 +82,10 @@ export interface DataState {
|
||||
linkedListPointers?: LinkedListPointerState[];
|
||||
// Stack support
|
||||
stacks?: StackState[];
|
||||
// Tree support
|
||||
trees?: BinaryTreeState[];
|
||||
// Queue support
|
||||
queues?: QueueState[];
|
||||
}
|
||||
|
||||
/** Single step in the visualization */
|
||||
@@ -203,3 +207,42 @@ export interface StackState {
|
||||
elements: StackElementState[];
|
||||
label?: string;
|
||||
}
|
||||
|
||||
// ============================================
|
||||
// Binary Tree Types
|
||||
// ============================================
|
||||
|
||||
/** State of a binary tree node */
|
||||
export interface BinaryTreeNodeState {
|
||||
id: string;
|
||||
value: number;
|
||||
state: 'normal' | 'current' | 'visiting' | 'visited' | 'highlighted';
|
||||
left: string | null;
|
||||
right: string | null;
|
||||
}
|
||||
|
||||
/** Complete binary tree state */
|
||||
export interface BinaryTreeState {
|
||||
id: string;
|
||||
nodes: BinaryTreeNodeState[];
|
||||
rootId: string;
|
||||
label?: string;
|
||||
}
|
||||
|
||||
// ============================================
|
||||
// Queue Types
|
||||
// ============================================
|
||||
|
||||
/** State of a queue element */
|
||||
export interface QueueElementState {
|
||||
id: string;
|
||||
value: number | string;
|
||||
state: 'normal' | 'highlighted' | 'enqueued' | 'dequeued';
|
||||
}
|
||||
|
||||
/** Complete queue state */
|
||||
export interface QueueState {
|
||||
id: string;
|
||||
elements: QueueElementState[];
|
||||
label?: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user