1.4 Data types, data structures and algorithms Flashcards

1
Q

What is a D-Type Flip Flop and how does it work? (1.4.3)

A
  • Logic circuit, stores 1 bit only
  • 2 inputs, control signal + clock
  • Clock: regular CPU pulse, coordinates, rises / falls
  • 4 NAND gates used
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How does a Half Adder work? (1.4.3)

A
  • Takes 2 inputs
  • Gives 2 outputs: sum & carry
  • Formed of AND & XOR
  • When both A & B False, outputs False
  • When A or B True, sum True
  • When both inputs True, carry True, sum False
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the order for in-order traversal? (1.4.2)

A
  1. Leftwards:
  2. Left subtree
  3. Parent
  4. Right subtree
  5. Root
  6. Rightwards:
  7. Left subtree
  8. Parent
  9. Right subtree
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the 3 types of graph data structures? (1.4.2)

A
  • Directed: only traversed in 1 direction
  • Undirected: traversed both directions
  • Weighted: arcs have cost attached
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the order for pre-order traversal? (1.4.2)

A
  1. Root node
  2. Leftwards:
  3. Left subtree
  4. Right subtree
  5. Rightwards:
  6. Left subtree
  7. Right subtree
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How does a Full Adder work? (1.4.3)

A
  • Like Half Adder, additional input
  • Allows carry representation
  • Formed from 2 XOR gates, 2 AND gates, 1 OR gate
  • Chained together
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are hash tables as data structures? (1.4.2)

A
  • Array coupled with hash function
  • Hash function takes data, produces unique output
  • Maps data to unique index
  • If same output, collision, placed in next available
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do linked lists work? (1.4.2)

A
  • Dynamic, holds ordered sequence
  • Each item called node, contains data, & pointer (next item in list)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are stacks and queues used for? (1.4.2)

A

Stacks:

  • Performing depth-first searches on graphs
  • Tracking user inputs (e.g. undo)
  • Backtracking (e.g. pathfinding)

Queues:

  • Performing breadth-first searches on graphs
  • Transferring data between processors
  • Process scheduling
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a root, child, and leaf, in tree data structures? (1.4.2)

A

Root: node with no incoming nodes

Child: node with incoming edges

Parent: node with outgoing edges

Leaf: node with no children

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

What is the order for post-order traversal? (1.4.2)

A
  1. Leftwards:
  2. Left subtree, leaf first
  3. Right subtree, leaf first
  4. Parent
  5. Rightwards:
  6. Left subtree, leaf first
  7. Right subtree, leaf first
  8. Parent
  9. Root
How well did you know this?
1
Not at all
2
3
4
5
Perfectly