1/13
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
How does a breadth-first search work?
Start a root, scan every node connected and then continue scanning from left to right (utilising a queue)
how does a depth-first search work?
Start at root, follow a branch as far as it will go, then backtrack. (utilising a stack)
how does pre-order, in-order and post-order traversals work?
Pre-order Traversal:
In a pre-order traversal:
Visit the current node.
Recursively traverse the left subtree.
Recursively traverse the right subtree.
In-order Traversal:
In an in-order traversal:
Recursively traverse the left subtree.
Visit the current node.
Recursively traverse the right subtree.
Post-order Traversal:
In a post-order traversal:
Recursively traverse the left subtree.
Recursively traverse the right subtree.
Visit the current node.
advantages of RPN
No parentheses needed.
Simple evaluation with stacks.
Efficient for implementation.
Natural for stack-based systems.
Reduces need for intermediate results.
how to convert from Infix to RPN
Initialize an Empty Stack: We'll use a stack to keep track of operators and manage their precedence.
Scan the Infix Expression from Left to Right: For each token (operand or operator) in the infix expression:
If it's an operand, add it directly to the output.
If it's an operator:
While there are operators already on the stack with higher precedence (or equal precedence in the case of left-associative operators), pop them from the stack
how does a linear search work?
scan each item in a list 1 by 1
how does a binary search work?
divide the list into 2, check if the item is greater than or less than, repeat
what is Procedural abstraction
abstracting away the actual values used in any particular computation and replacing it with a formula
what is functional abstraction
Functional abstraction is the process of hiding the implementation details of a function and it builds up from a procedure
what is data abstraction?
Data abstraction is the process of hiding the complex implementation details and showing only the essential features.
what is problem abstraction
removing details from a problem until you can represent it in a way that is possible to solve.
what is problem decomposition
taking a big problem and breaking it down into smaller problems
what is composition
developing solutions by using pre-existing components which are proven to work
what is automation
taking physical world scenarios and using a computer to ease operations.