Add sorting explanations, wiki links, and i18n

Introduce Bubble, Quick and Heap Sort documentation: add wiki URL constants, update sorting component to show Bubble/Quick/Heap Sort explanations with Wikipedia links, and include additional disclaimer text and list in the UI. Add corresponding i18n entries in English and German containing algorithm descriptions, note/title and several disclaimer lines.
This commit is contained in:
2026-02-04 14:19:27 +01:00
parent a10f62f2dd
commit beb5bb7db1
4 changed files with 47 additions and 7 deletions

View File

@@ -328,7 +328,19 @@
"RESET": "Reset",
"GENERATE_NEW_ARRAY": "Generate New Array",
"EXECUTION_TIME": "Execution Time",
"ARRAY_SIZE": "Number of Bars"
"ARRAY_SIZE": "Number of Bars",
"EXPLANATION": {
"TITLE": "Algorithms",
"BUBBLE_SORT_EXPLANATION": "repeatedly compares adjacent elements and swaps them if they are in the wrong order. The largest element \"bubbles\" to the end of the list like an air bubble. Advantage: Extremely simple to understand and implement; detects already sorted lists very quickly. Disadvantage: Very inefficient for large lists (runtime O(n²)). Rarely used in practice.",
"QUICK_SORT_EXPLANATION": "follows the \"divide and conquer\" principle. A \"pivot\" element is selected, and the array is divided into two halves: elements smaller than the pivot and elements larger than the pivot. Advantage: On average one of the fastest sorting algorithms (O(n log n)); requires no additional memory (in-place). Disadvantage: Slow in the worst case (O(n²)) if the pivot is chosen poorly. Is not stable (changes order of equal elements).",
"HEAP_SORT_EXPLANATION": "organizes the data initially into a special tree structure (Binary Heap). The largest element (the root) is extracted and sorted to the end, then the tree is repaired. Advantage: Guarantees a fast runtime of O(n log n), even in the worst case. Requires almost no additional memory. Disadvantage: Often slightly slower than Quick Sort in practice because the jumps in memory (heap structure) utilize the CPU cache less effectively.",
"NOTE": "NOTE",
"DISCLAIMER": "The choice of the \"best\" sorting algorithm depends heavily on the data and the constraints. In computer science, three scenarios are often considered:",
"DISCLAIMER_1": "Best Case: The data is already nearly sorted (Bubble Sort shines here, for example).",
"DISCLAIMER_2": "Average Case: The statistical norm.",
"DISCLAIMER_3": "Worst Case: The data is arranged in the most unfavorable way possible (Quick Sort performs poorly here without optimization, while Heap Sort remains stable).",
"DISCLAIMER_4": "Additionally, there is almost always a Time-Space Trade-off: Algorithms that are extremely fast (like Merge Sort) often require a lot of additional working memory. Algorithms that work directly in existing memory (like Heap Sort) save space but are sometimes more complex or slightly slower. Thus, there is no \"one-size-fits-all\" solution."
}
},
"ALGORITHM": {
"TITLE": "Algorithms",
@@ -338,7 +350,7 @@
},
"SORTING": {
"TITLE": "Sorting",
"DESCRIPTION": "Visualizing various sorting algorithms.",
"DESCRIPTION": "Visualizing various sorting algorithms."
}
}
}