1.4 Flashcards

(44 cards)

1
Q

Define annulment

A

When an input is nullified

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

Define identity

A

When a single input determines the output

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

Define idempotent

A

When the same input is used more than once for one expression

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

Define complement

A

When a value and the opposite of that value are both inputted

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

Define double negation

A

When an input goes through a NOT gate twice

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

Define commutative

A

When 2 values can be inputted multiple ways to give the same result

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

Define associative

A

When 3 values can be inputted multiple ways using the same symbols to give the same result

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

Define distributive

A

When 3 values have to be inputted using different symbols to return the same value

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

What does n left shifts do to a binary value

A

Multiplied the value by 2^n

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

What does n right shifts do to a binary value

A

Divides the value by 2^n

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

What does an AND MASK do

A

Only bits corresponding with 1 in the mask are retained

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

What does an OR mask do

A

Turns specific bits on and leaves the rest unchanged

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

What does an XOR mask do

A

If the mask value equals the corresponding bit value, the bit value is switched to 0

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

What is a linked list

A

Dynamic data structure used to hold an ordered sequence (do not have to be in contiguous data locations). Each item is a node containing a data field and an address called a link or pointer

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

What is an advantage of a linked list

A

Values can easily be added or removed by editing pointers.

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

What are disadvantages of linked lists

A

Nodes are not removed they are just ignored (wastes memory)
Storing pointers requires memory
Items can not be directly accessed, it has to go through the order

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

What is a linked list

A

Data structure that provides a foundation upon which other structures can be built, such as stacks, queues, graphs and trees

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

Name some characteristics of a linked list

A

Can go backwards and forwards
Each node contains data and a pointer to the next node
Data in lists can be stored anywhere in memory

19
Q

Features of a linked list

A

Dynamic
Ordered
Pointers
More memory
Items can not be directly accessed

20
Q

Applications of a linked list

A

Store music
Web browsers
Viewing images

21
Q

What does the term hashing mean

A

Applying a hashing algorithm to the value in the key field of each record to transform it into an address

22
Q

What characteristics should a hashing algorithm have

A

Needs to calculate quickly
Few collisions
Take up least amount of memory

23
Q

How is the index decided for each value

A

For numbers, divide the value to be stored by the side of the array and take the remainder
For strings convert the values of the whole string into ASCII

24
Q

What is a hash table

A

Creates indexes for databases

25
What is the term collision meant (hashing)
When two record keys hash to the same index
26
Describe some of the different methods that a hash table data structure might deal with collisions
Store the item in the next available slot (linear probing : checking the values after the one at the index)
27
Define clustering
Several positions being filled around common collision values
28
Explain the process to delete from a hash table
Same process as searching for a value
29
What does rehashing refer to
Creating a new hashing algorithm (e.g increasing the size of the table), if there are too many collisions
30
Define chaining
Using a 2D hash table so it is possible for more than one value to be stored at the same position (takes extra resource time and extra memory)
31
Define a graph
Set of vertices/nodes connected by edges/arcs
32
What is a directed graph
Graph with edges that can only be traversed in one direction
33
What is an undirected graph
Graph with edges that can be traversed in both directions
34
What is a weighted graph
A graph that has a cost attached to each edge
35
What is an adjacency list
Used to show the weight of each edge connecting a node to every other node in a graph. A -> {B:4, C:18, D:12}
36
What is an adjacency matrix
Used to store the weight of an edge between two nodes in a graph. Uses a table with all the nodes listed in the x and y axis
37
Advantages of an adjacency matrix (graphs)
Quicker access times Easy to add nodes
38
Advantage of an adjacency list (graphs)
Space efficient for larger , sparse networks
39
Define a tree
Connected form of a graph Contain a root node (top node in a tree) Nodes are connected using branches Lower level nodes are the children of higher level nodes A leaf is a node with no children
40
Define a binary tree
Tree in which each node has a maximum of two children Used to represent information for binary searches as information is easy to search for
41
What is the most common way to represent a binary tree
Each node has a left pointer (child node on the left) and a right pointer (child node on the right) Information is implemented using a 2D array
42
What is preorder traversal (trees)
Root node -> left subtree ->right subtree
43
What is in order traversal (tree)
Left subtree -> root node -> right subtree Values should be returned in the correct order
44
What is post order traversal (trees)
Left subtree -> right subtree -> root node Nodes are traversed in the order that u pass them on the right