#Day18 #100DaysOfCode
the most important resources a computer has is time and memory.
the most important resources a computer has is time and memory.
time = no of instructions * time to exe each instructions
there are different type of data structure that suits the needs of different purposes.
linear: array, stack, queue, linked list
non-linear: map, graph, tree
array is standard programming language can only have data of the same type.
data in stack follows the LIFO principle. data in queue follows the FIFO principle.
data in linked list are connected by pointers containing the address of the next node.
a tree is different with a graph in that there can only be one edge between 2 vertices. in other words, cannot reach a vertex except for that edge. it is the only way.
binary tree: a vertex can have only two edges (two branches).
in linear data structures, data are arranged in sequential order, one after another. in non-linear data structures, data are arranged in hierachical order.
time complexity increases in linear data structures as data size increases. whereas, it stays const in non-linear.