Post

Linear and Non-Linear Data Type

βœ… Linear Data Type

  • output if proportional to input
  • system follows principle of superpostiion
  • (adding input = adding outputs)
  • predictable
  • linear equations


  • Additivity:
    • two jobs then add two results 🟰 add two jobs and get one result
  • Homogeneity:
    • all elements are the same type
    • make instuction bigger/smaller ➑️ result is also bigger/smaller


  • array: has additivity
  • list: has additivity
  • queue: order is important in insertion, deletion ➑️ has homogeneity
  • stack: order is important in insertion, deletion ➑️ has homogeneity

βœ… Non-Linear Data Type

  • output is not directly proportional to input
  • do not follow principle of superposition
  • unpredictable


  • Binary Search Tree
    • non linear bc path taken to find/insert/delete depends on node value
    • path depends on comparision
  • Graph
    • no strict order of travel
    • flow depends on edges and nodes
This post is licensed under CC BY 4.0 by the author.