Data Structures and Algorithms Flashcards
An ordered list in which the last element is added is the first element retrieved or removed. (LILO)
Stack
Adds an item to the top of the stack.
Push
Removes an item from the top of the stack.
Pop
Looks at the item at the top of the stack without removing it from the stack.
Peek (Java)
stack_name[-1] (Python)
Test whether the stack is empty.
isEmpty() (Java)
if not (Python)
A string that reads the same in either direction.
Palindrome
An ordered list in which the first element added is the first element to be retrieved or removed. (FIFO)
Queue
Adds an item into the queue.
Enqueue
Removes the head of the queue.
Dequeue
Retrieves the head of the queue. (Python)
Peek
Tests whether the queue is empty. (Python)
if not
Represents a hierarchical nature of a structure in a graphical form.
Tree
Top of a tree.
Root
Successor of a node.
Child nodes
The predecessor of a node.
Parent
A tree is considered a ___ if all its nodes have two (2) child nodes at most.
Binary tree
Nodes that have the same parent.
Siblings
A node that has no child nodes.
Leaf node or external node
A tree within a tree.
Subtree
A measure of a node’s distance from the root.
Level
The highest level of a tree.
Depth
The number of child nodes in a subtree.
Degree
The process of visiting all the nodes in a specific order.
Traversal
Nodes are visited by level.
Breadth-First or Level Order