Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/components/DSA/arrays/BubbleSortVisualization/index.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import React, { useState, useEffect } from 'react';
import './BubbleSortVisualization.css';
import './BubbleSortVisualization.css';

/**
* BubbleSortVisualization Component
* This component visualizes the Bubble Sort algorithm.
*
*
* @returns {JSX.Element} The rendered component
*/
const BubbleSortVisualization: React.FC = () => {
// State to store the array of numbers to be sorted
const [array, setArray] = useState<number[]>([]);
// State to control the delay for visualization speed
const [delay, setDelay] = useState<number>(200);
const [delay, setDelay] = useState<number>(200);
// State to indicate if sorting is in progress
const [isSorting, setIsSorting] = useState<boolean>(false);
const [isSorting, setIsSorting] = useState<boolean>(false);
// State to store the indices of elements being compared
const [comparingIndices, setComparingIndices] = useState<number[]>([]);

// Effect to generate a new array when the component mounts
useEffect(() => {
generateArray();
generateArray();
}, []);

// Effect to update the CSS transition duration when the delay changes
Expand Down
Loading