2021 p1 Flashcards

1
Q

358164
bubble sort this into first second and 3rd pass

A

first: 351648
second: 315468
third: 134568

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

define binary tree

A

a rooted tree where each node has at most two child nodes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

state the output for in-order transversal for E, H, I, Y, Q, B, C.

A

EIHCYBQ

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

recursive subroutine

A

s subroutine that calls itself

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

two components of a stack frame

A

local variables and parameters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

procedural decomposition

A

breaking a problem into smaller sub-problems

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

steps in adding a record to a hash table

A
  1. apply hash function to calculate the hash value for the key .
  2. use the hash value to find the index in the hash table so that the new record could be stored.
  3. check if there is a record at the index. if yes, use a collision resolution technique.
  4. insert the new record at the index in the hash table and update the number of records in the hash table.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

two advantages of RPN

A

easier for a computer to analyse

don’t need brackets so you don’t have to keep track of parentheses

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

how can a single stack be used to evaluate an RPN expression

A
  1. initialize an empty stack
  2. push values onto a stack from left hand side.
    3.for each number in the expression; push it onto a stack. for each operator; pop the top two numbers off the stack.
  3. after both have been processed, the stack should contain only one value, which is the result of the expression.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

base case for a recursive sub routine

A

a scenario where a recursive subroutine does’nt call itself

How well did you know this?
1
Not at all
2
3
4
5
Perfectly