Back to Course


0% Complete
0/82 Steps
  1. Getting Started with Algorithm
    What is an Algorithm?
  2. Characteristics of Algorithm
    1 Topic
  3. Analysis Framework
  4. Performance Analysis
    3 Topics
  5. Mathematical Analysis
    2 Topics
  6. Sorting Algorithm
    Sorting Algorithm
    10 Topics
  7. Searching Algorithm
    6 Topics
  8. Fundamental of Data Structures
  9. Queues
  10. Graphs
  11. Trees
  12. Sets
  13. Dictionaries
  14. Divide and Conquer
    General Method
  15. Binary Search
  16. Recurrence Equation for Divide and Conquer
  17. Finding the Maximum and Minimum
  18. Merge Sort
  19. Quick Sort
  20. Stassen’s Matrix Multiplication
  21. Advantages and Disadvantages of Divide and Conquer
  22. Decrease and Conquer
    Insertion Sort
  23. Topological Sort
  24. Greedy Method
    General Method
  25. Coin Change Problem
  26. Knapsack Problem
  27. Job Sequencing with Deadlines
  28. Minimum Cost Spanning Trees
    2 Topics
  29. Single Source Shortest Paths
    1 Topic
  30. Optimal Tree Problem
    1 Topic
  31. Transform and Conquer Approach
    1 Topic
  32. Dynamic Programming
    General Method with Examples
  33. Multistage Graphs
  34. Transitive Closure
    1 Topic
  35. All Pairs Shortest Paths
    6 Topics
  36. Backtracking
    General Method
  37. N-Queens Problem
  38. Sum of Subsets problem
  39. Graph Coloring
  40. Hamiltonian Cycles
  41. Branch and Bound
    2 Topics
  42. 0/1 Knapsack problem
    2 Topics
  43. NP-Complete and NP-Hard Problems
    1 Topic
Lesson 4, Topic 1
In Progress

Space Complexity

Lesson Progress
0% Complete

The space complexity of an algorithm is the amount of memory it needs to run to completion.

KodNest Capture9
Algorithm 1: Computes a + b + b*c+(a+ b – c)/(a+ b) + 4.0

The space needed by each of these algorithms is seen to be the sum of the following components:

KodNest Capture10
Algorithm 2: Iterative function for sum
KodNest Capture11
Algorithm 3: Recursive function for sum

1.A fixed part that is independent of the characteristics(e.g.,number, size)of the inputs and outputs. This part typically includes the instruction space(i.e., space for the code), space for simple variables and fixed-size component variables(also called aggregate), space for constants,and soon.

2.A variable part that consists of the space needed by component variables whose size is dependent on the particular problem instance being solved, the space needed by referenced variables(to the extent that this depends on instance characteristics), and the recursion stack space (in-so far as this space depends on the instance characteristics).

The space requirement S(P) of any algorithm P may therefore be written as S(P)= c+Sp(instance characteristics), where c is a constant.

New Report