@@ -5,6 +5,7 @@ import { RadixSortLSD } from '../Strategy/Algorithms/RadixSortLSD';
55import { QuickSort } from '../Strategy/Algorithms/QuickSort.js'
66import SelectionSort from '../Strategy/Algorithms/SelectionSort' ;
77import { HeapSort } from '../Strategy/Algorithms/Heapsort' ;
8+ import { ShellSort } from '../Strategy/Algorithms/ShellSort' ;
89function AlgorithmSelection ( { strategy, options} ) {
910
1011 const [ currentAlgo , setCurrentAlgo ] = useState ( options . state . algorithm ) ;
@@ -14,7 +15,7 @@ function AlgorithmSelection({strategy, options}) {
1415 const Selection = new SelectionSort ( ) ;
1516 const Quick = new QuickSort ( ) ;
1617 const Heap = new HeapSort ( ) ;
17-
18+ const Shell = new ShellSort ( ) ;
1819
1920 useEffect ( ( ) => {
2021 var dropdown = document . getElementById ( 'algo-selection-dropdown' ) ;
@@ -32,6 +33,7 @@ function AlgorithmSelection({strategy, options}) {
3233 else if ( currentAlgo === "Selection" ) strategy . setStrategy = Selection ;
3334 else if ( currentAlgo === "Quick" ) strategy . setStrategy = Quick ;
3435 else if ( currentAlgo === "Heap" ) strategy . setStrategy = Heap ;
36+ else if ( currentAlgo === "Shell" ) strategy . setStrategy = Shell ;
3537 } , [ ] )
3638
3739
@@ -94,6 +96,18 @@ function AlgorithmSelection({strategy, options}) {
9496 >
9597 < p className = { `${ currentAlgo === 'Quick' && 'text-black group-hover:text-white' } ` } > Quick Sort</ p >
9698 </ div >
99+
100+ < div className = { `${ currentAlgo === 'Shell' && 'bg-gray-200' } group cursor-pointer w-full hover:bg-gray-700 font-semibold text-white h-[2.8em] flex items-center justify-start pl-4` }
101+ onClick = { ( ) => {
102+ setCurrentAlgo ( 'Shell' ) ;
103+ options . setState ( { algorithm : "Shell" } ) ;
104+ strategy . setStrategy = Shell ;
105+ localStorage . setItem ( "algorithm" , "Shell" ) ;
106+ setShowDropdown ( ! showDropdown )
107+ } }
108+ >
109+ < p className = { `${ currentAlgo === 'Shell' && 'text-black group-hover:text-white' } ` } > Shell Sort</ p >
110+ </ div >
97111
98112
99113 < div className = { `${ currentAlgo === 'Selection' && 'bg-gray-200' } group cursor-pointer w-full rounded-b-md hover:bg-gray-700 font-semibold text-white h-[2.8em] flex items-center justify-start pl-4` }
0 commit comments