Skip to content

Commit 5b89833

Browse files
committed
Fixed issue
1 parent 6cbb6b1 commit 5b89833

File tree

5 files changed

+18
-14
lines changed

5 files changed

+18
-14
lines changed

docs/dsa/algorithms/searching_algorithm.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ Searching is a fundamental operation in computer science and is widely used in v
2020

2121
Linear search is a simple algorithm that sequentially checks each element in a collection until the target element is found or the end of the collection is reached. It is commonly used for small collections or unsorted data.
2222

23+
<LinearSearchVisualizer />
24+
25+
<br />
26+
2327
```python
2428
def linear_search(arr, target):
2529
for i in range(len(arr)):

src/components/Lesson/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ interface LessonProps {
1010

1111
/**
1212
* Lesson component displays a single lesson with its title, description, and tags.
13-
* @param id - Unique identifier for the lesson.
1413
* @param title - Title of the lesson.
1514
* @param tags - Array of tags associated with the lesson.
1615
* @param description - Description or content of the lesson.
1716
* @returns JSX element representing the lesson.
1817
*/
19-
const Lesson: React.FC<LessonProps> = ({ id, title, tags, description }) => {
18+
const Lesson: React.FC<LessonProps> = ({ title, tags, description }) => {
2019
return (
2120
<div className="lesson"> {/* Container for the lesson */}
2221
<h2 className="lesson-title">{title}</h2> {/* Title of the lesson */}
@@ -31,4 +30,4 @@ const Lesson: React.FC<LessonProps> = ({ id, title, tags, description }) => {
3130
);
3231
};
3332

34-
export default Lesson;
33+
export default Lesson;

src/dsa/searching-algorithms/LinearSearchVisualizer/index.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,15 @@ const LinearSearchVisualizer: React.FC = () => {
4242
setSearching(false);
4343
};
4444

45+
const shuffleArray = () => {
46+
const shuffledArray = [...array].sort(() => Math.random() - 0.5);
47+
setArray(shuffledArray);
48+
resetVisualization();
49+
};
50+
4551
return (
4652
<div className="linear-search-container">
47-
<Heading as="h2">Linear Search Visualization</Heading>
53+
<Heading as="h2">Linear Search Visualization</Heading>
4854
<div className="array-container">
4955
{array.map((num, index) => (
5056
<div
@@ -71,6 +77,9 @@ const LinearSearchVisualizer: React.FC = () => {
7177
<button onClick={resetVisualization} disabled={!searching && !target}>
7278
Reset
7379
</button>
80+
<button onClick={shuffleArray} disabled={searching}>
81+
Shuffle Array
82+
</button>
7483
</div>
7584
</div>
7685
);

src/pages/about/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
44
import React from "react";
55
import Head from "@docusaurus/Head";
66

7-
export default function About() {
7+
export default function About(): React.JSX.Element {
88
const { siteConfig } = useDocusaurusContext();
99
return (
1010
<Layout

src/pages/blogs/index.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,7 @@ import Link from "@docusaurus/Link";
66
import blogs from "../../database/blogs";
77
import Head from "@docusaurus/Head";
88

9-
// interface Blog {
10-
// id: number;
11-
// title: string;
12-
// image: string;
13-
// description: string;
14-
// slug: string;
15-
// }
16-
17-
export default function Blogs() {
9+
export default function Blogs(): React.JSX.Element {
1810
const { siteConfig } = useDocusaurusContext();
1911

2012
return (

0 commit comments

Comments
 (0)