Lecture 5: Data Structure Flashcards
What is the unique thing about the data structure: Linked List?
The most powerful thing about a linked list is that it can sort a list of values in different parts of memory. contrary arrays which sort data back-to-back in memory
What will happend when we insert a new value in a linked list?
It will allocate memory for both:
- the value we want to store
- the address of the next future value. in other words, these addresses are actually pointers
What is βnodeβ?
It is the basic unit of a data structure. which has both:
- value
- pointer to another node
What is the unique thing about the data structure: Tree?
Using this data structure, each node can only point to 2 children which we call them left child and right child
What is the unique thing about the data structure: Hash table?
it can associate keys with values.
What is the unique thing about the data structure: Trie?
it is actually a tree with arrays as nodes so each array points to another array whenever it found the desired value
What is the order of the data structure: Queue?
First In First Out (FIFO) it is like a line of people waiting π«
To add a value we enqueue it, and to remove a value we dequeue it. We could use a growing array or a linked list.
What is the order of the data structure: Stack?
Last In First Out (LIFO) it is like stacked plates over one another in the canteen. The last plate which is at the top is the first one to be removed
The graph is a different data structure that basically
connects a mutable set of nodes (also called vertices) together using edges (also called links or lines)
The Graph is composed of a set of vertices( V ) and a set of edges (E)
G(E, V)