1.4 Data types, data structures and algorithms

0.0(0)
studied byStudied by 1 person
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/31

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

32 Terms

1
New cards

Sign and Magnitude

End bit represents whether it is positive or negative, 0 is positive, 1 is negative.

2
New cards

Twos Complement

End bit is a negative value for example 4 bit would be:
-8 4 2 1

3
New cards

Subtracting twos complement

num1 - num2 = num1 + -(num2)

4
New cards

Normalisation

1.0 if negative and 0.1 if positive change exponent so that the decimal is in the correct place.

5
New cards

Character sets

ASCII and Unicode

6
New cards

Stack

FILO - First in last out an example is a back button

7
New cards

Queues

FIFO - First in first out

8
New cards

Circular queue

Have pointers to to know where to store the next item and which item to remove first. It will loop back to the front when it reaches the end.

<p>Have pointers to to know where to store the next item and which item to remove first. It will loop back to the front when it reaches the end.</p>
9
New cards

Linear queue

Items are added to next available space.

<p>Items are added to next available space.</p>
10
New cards

Priority queue

Different items within the queue will have different priority levels meaning some will be dequeued before others.

11
New cards

Stack methods

isEmpty() Checks if the stack is empty
push(value) Adds a new value to the top of the stack
peek() Returns the top value of the stack without removing it
pop() Returns and removes the top value of the stack
size() Returns the size of the stack
isFull() Checks if the stack if full

12
New cards

Queue methods

enQueue(value) Adds a new item to the end of the queue deQueue() Removes the item from the end of the queue isEmpty() Checks if the queue if empty
isFull() Checks if the queue is full

13
New cards

Linked lists

Dynamic data structure, each item is called a node and contains data, with a link or pointer which points to the next node.

<p>Dynamic data structure, each item is called a node and contains data, with a link or pointer which points to the next node.</p>
14
New cards

Graphs

Set of nodes linked together through edges. Is implemented using an adjacency matrix/list.
Directed graph - Can only traverse in one direction
Undirected graph - Can traverse either directions
Weighted graph - Each traversal has a cost attached

15
New cards

Adjacency matrix

knowt flashcard image
16
New cards

Adjacency list

knowt flashcard image
17
New cards

Adjacency matrix vs Adjacency list

Adjacency matrix is convenient to work with and easy to add nodes.
Adjacency list is space efficient for large networks.

18
New cards

Binary search tree

Has a maximum of two children and stores information in order stores each node using a left/right pointer.

<p>Has a maximum of two children and stores information in order stores each node using a left/right pointer.</p>
19
New cards

Pre-order traversal

2-1-3, middle-left-right

<p>2-1-3, middle-left-right</p>
20
New cards

In-order traversal

1-2-3, left-middle-right

<p>1-2-3, left-middle-right</p>
21
New cards

Post-order traversal

1-3-2, left-right-middle

<p>1-3-2, left-right-middle</p>
22
New cards

Hash table

Has a hash function which takes a key to produce the unique output (the hash). Used to map the key to a unique index in a hash table. If a collision happens the item will be stored in the next available spot.

23
New cards

Gates

AND = ^
OR = v
NOT = ¬
XOR = ⊻

24
New cards

Karnaugh Map

Used to simplify boolean expressions.

<p>Used to simplify boolean expressions.</p>
25
New cards

De Morgans Law

¬(A ^ B) = ¬A v ¬B
¬(A v B) = ¬A ^ ¬B

26
New cards

Distribution

A ^ (B v C) = (A ^ B) v (A ^ C)
A v (B ^ C) = (A v B) ^ (A v C)

27
New cards

Association

(A ^ B) ^ C = A ^ B ^ C
(A v B) v C = A v B v C

28
New cards

Commutation

A v B = B v A

29
New cards

Double negation

¬¬A = A

30
New cards

D-Type Flip Flops

knowt flashcard image
31
New cards

Full Adder

Three inputs

<p>Three inputs</p>
32
New cards

Half Adder

Two inputs

<p>Two inputs</p>