Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sorteringsworkshop

Skjermdump

Installasjon og oppsett

Installer det du trenger ved å kjøre

yarn install
# eller
npm install

Kjør igang prosjektet ved å kjøre

yarn dev
# eller
npm run dev

Prosjektet skal da kjøre i gang en port på localhost, og du kan se resultatet i nettleseren. Standard port er http://localhost:5173.

Skriv en algoritme

  1. Opprett in fil i mappa src/sortFunctions
// i fila src/sortFunctions/mySortFunction.ts
import { VisualArray } from "../visualArray";

export async function mySortFunction(array: VisualArray) {
  // gjør noe med array
  // husk å awaite kall til array.get / set / swap / compare!
}

I src/sortFunctions/_registerSortFunctions.ts (klikkbar lenke), legg til sorteringsfunksjonen din med et passende navn:

  import { bubbleSort } from "./bubbleSort";
+ import { mySortFunction } from "./mySortFunction";


  export const sortFunctions = {
    "Bubble sort": bubbleSort,
+   "Min sorteringsfunksjon": mySortFunction,
 } as const;

Da skal den være valgbar i nettleseren!

About

Visualisering av sorteringsalgoritmer i typescript

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages