Data Types, Data structures and algorithms 1.4 Flashcards

1
Q

What data type should be used for storing a phone number?

A

String - if stored as an integer this would remove the zero at the start of the number

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

What is an Array?

A

An ordered, finite set of elements of a single type

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

How can you visualize a two-dimensional array?

A

A spreadsheet or table

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

How can you visualize a three-dimensional array?

A

A three dimensional array can be visualized as a multipage

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

What is a record?

A

A row in a file

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

What is a record made up of?

A

A record is made up of fields

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

What is the definition of a list?

A

A data structure consisting of a number of items. Items can appear more than once

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

What are the main differences between an array and a list?

A
  1. List can store data Non-contiguously whereas arrays store data in order
  2. List can store many data types
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a tuple?

A

An immutable, ordered set of values of any type

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

What is the difference between a tuple and an array?

A

Tuples use normal brackets instead of square brackets

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

What is a linked list?

A

A linked list is a dynamic data structure used to hold an ordered set of items that are not stored in contiguous locations.

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

What is the name of an item in a linked list?

A

Nodes

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

What does each node in a linked list contain?

A

each node contains its data and the address of the next node

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

What is a stack?

A

A LIFO data structure where items can only be removed and added on the top of the stack

LIFO = Last in First out

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

Give an example of when a stack may be used

A

Back button in a web page

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

What is a queue?

A

A FIFO data structure where items are added to the back of the queue and removed from the front

FIFO = First in first out

17
Q

What is a Tree?

A

A data structure with a root node and a child node connected with branches

18
Q

What is the purpose of a binary search tree?

A

A binary search tree is used to search for values quickly

19
Q

What is a Hash Table?

A

A hash table is an array which is coupled with a hash function. The hash function takes in data (a key) and releases an output (the hash). The role of the hash function is to map the key to an index in the hash table.

20
Q

What is a collision? (hashing)

A

A collision is when two inputs result in the same hash value

21
Q

What properties does a good hashing algorithm have?

A
  1. Low chance of collision
  2. Fast
22
Q

What does the operation isEmpty() do?

A

Checks if the list is empty

23
Q

What does the operation pop() do?

(Stack)

A

takes out the last item in the stack out

24
Q

What does the operation Push(value) do?

(Stack)

A

It adds the value to the top of the stack

25
Q

What does the operation peek() do?

(Stack)

A

Returns the top value of the stack

26
Q

What does the operation isFull() do

(Stack)

A

Checks if the stack is full

27
Q

What does the operation size() do

(stack)

A

Returns the size of the stack

28
Q

What does the operation enQueue do

A

Add a item to the back of the queue

29
Q
  1. What does the operation deQueue() do?
A

Removes the item from the end of the queue

30
Q

Add questions of hash(maps)

A