Fundamentals of algorithims
No description yet. This curated deck is ready for daily study.
Card preview (18)
What is depth first
. In a depth-first search, a branch is fully explored before backtracking .Depth-first traversal uses a stack. Depth-first traversal is used for navigating a maze
What is breadth first
a node is fully explored before venturing on to the next node. Breadth-first traversal uses a queue. Useful for determining the shortest path
What is the benefit of a binary tree
You can perform a binary search or an unordered list
What is post fix
This is reverse polish notation
What is the advanatage of rpn
It is unambigous Can be calculated on stacks
WHat is oprand
This is the instruction given
What is opcode
is the mathematical signs + -
what is algorithm
An algorithm is a set of instructions which completes a task in a finite time and always terminates.
WHat is a linear search
A linear search can be conducted on any unordered list. It is the most simple to program, but it has a comparatively high time complexity O(n)
What is a binary search
A binary search can be used on any ordered list. If the list is unordered, the data must be sorted by a sorting algorithm. A binary search works by looking at the midpoint of a list and determining if the target is higher or lower than the midpoint. O(log(n))
WHat is the diffrerence between a binary search and a binary tree
Its only difference is binary search being conducted on a binary tree
What is are features of a tree
a connected, undirected graph with no cycles.
What is a binary tree
a rooted ordered tree O(log(n))
What is a bubble sort
The bubble sort algorithm uses the idea of swapping the position of adjacent items to order them. It has a time complexity of O(n²) so it is very inefficient.
What is a merge sort
A merge sort orders arrays by splitting them into smaller lists, and then reforming them - the ‘divide and conquer’ method. It is quicker than a bubble sort; it has a time complexity of O(nlogn).
WHat is the Dijkstra’s algorithm
finds the shortest path between two nodes in a graph, this is simila to breadth first
State two advantages of using Reverse Polish Notation (RPN) instead of infix notation to represent an expression.
Simpler for a machine/computer to evaluate Simpler to code algorithm;
Describe how a single stack could be used to evaluate an RPN expression
(Starting at LHS of expression) push values/operands on to stack; Each time operator reached pop top two values off stack (and apply operator to them) Push result (of applying operator) to stack; When end of expression is reached the top item of the stack is the result