Time complexities of Algorithms

Step 1: Select Algorithms

  1. The simulation is divided into 5 steps, each focusing on a specific category of algorithms.
  2. Use the "Next Step" and "Previous Step" buttons to navigate between categories:
    • Step 1: Linear vs Logarithmic (Binary Search, Linear Search)
    • Step 2: Sorting Algorithms (Quick Sort, Bubble Sort)
    • Step 3: Matrix Operations (Matrix Addition, Matrix Multiplication)
    • Step 4: Exponential/Factorial (Subset Generation, Permutations)
    • Step 5: Custom – Compare any algorithms of your choice
  3. Click the "+ Algorithm Name" buttons to add algorithms for comparison.

Step 2: Choose Maximum Input Size (N)

  1. Select a value of N from the available radio buttons.
  2. The available N values depend on the selected step to ensure reasonable execution times.

Step 3: Set Simulation Time (Optional)

  1. Use the "Max Simulation Time" dropdown to limit how long each algorithm runs.
  2. The default is 5 seconds. Increase this limit for larger inputs if needed.

Step 4: Lock and Run

  1. Check the "Lock Values" checkbox to finalize your selections.
  2. Click "Generate Inputs and Run Algorithm" to start the simulation.
  3. Wait for all algorithms to complete execution.

Step 5: Analyze Results

  1. View the execution time table showing time (in ms) for each algorithm at different input sizes.
  2. Observe the graph to visually compare how execution times grow with input size.
  3. Read the info text below the graph for insights about the comparison.

Understanding the Table:

  • Each cell shows the execution time in milliseconds for a specific algorithm and input size.
  • "Time/Memory Limit" appears when:
    • The algorithm exceeds the maximum allowed input size (e.g., Bubble Sort is limited to N ≤ 5000 to prevent browser freeze).
    • The execution time exceeds the maximum simulation time you selected.
    • The algorithm requires too much memory for the given input size.
  • This helps protect your browser from freezing on computationally expensive operations.

Step 6: Reset and Explore

  1. Click "Reset" to clear selections and try a different comparison.
  2. Navigate to other steps to explore more algorithm categories.

Tip: Hover over any algorithm button to see its time complexity before selecting!