CompSci - Data Organisation + Structures Flashcards

commit suicie later

1
Q

Purpose of data structures

A

MOE

Manipulation
Organisation
Efficiency

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

Operations on data structures

A

CSS TRIM

Copy
Search
Sort
Traverse
Remove
Insert
Merge

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

Array definition

A

Collection of elements that are identified by unique indicies and stored in consecutive memory locations

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

Linked list definition

A

A web of nodes, each with its memory address, its data and a pointer to the next address. Nodes don’t have to be near each other in memory.

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

Stack definition

A

FILO or LIFO structure

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

Queue definition

A

FIFO or LILO structure

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

Binary trees definition

A

Web of nodes connected by branches and two child nodes for each individual node.

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

Hashing table definition

A

Memory address of the data is calculated by the output of the hashing algorithm that is applied on the data itself.

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

OUTPUT ALL linked list

A

pointer = 1
linked_list = []
while pointer != -1
node = linked_list(pointer)
output node(data)
pointer = node(pointer)

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

LINEAR SEARCH linked list

A

flag = False
linked_list = []
input target
address = 1
while address != -1
node = linked_list(address)
if node(data) == target
return “Target is at: “ address
flag = True
address = node(pointer)
if flag == False:
return “Target not found ):”

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

Adding / Removing nodes from linked lists

A

To add, change the pointer of the previous node to the address of the new node + change the pointer of the new node to the address of the next node

To remove, change the pointer of the previous node to the address of the next node.

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

Simple and doubly linked lists

A

Simple linked lists only have the pointers to the next node’s address and their data

address + data + pointer>

Doubly linked lists have the previous and next nodes’ addresses and their data

<pointer + address + data + pointer>

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

Stack and queue removing and inserting

A

For stacks, pushing and popping

For queues, enqueuing and dequeuing

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

Stack and queue advantages and disadv

A

Fast processing
Efficient memory
Simple implementation

Inflexible applications
Difficult to manipulate elements

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

Stack uses

A

Store actions in a program
Store function return addresses

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

Queue uses

A

Data buffer
Printing queue

17
Q

Circular queue

A

Fixed size queue that has connected front and rear elements

18
Q

Binary tree traversal

A

Pre-order: Rlr
Copying

In-order: lRr
In order output

Post-order: lrR
Delete

19
Q

Balancing binary trees

A

If the difference between the heights of the left and right subtrees is > 1, the tree is unbalanced.

20
Q

Hashing tables advantages and disadv

A

Fast access
Efficient memory

Collisions
Memory redundancy
Complex algorithms

21
Q

Collision operations

A

Best

Rehashing - reapply algorithm or change
Daisy chaining - creates linked list at collision address
Linear probing - stores data at next free address
Overflow area - creates unsorted serial file to store collisions.

Worst

22
Q

Fixed length

A

each field/record has a fixed length

Easy to search and calculate memory size
Potential redundant space

23
Q

Variable length

A

each field has no set length. Elements are separated by delimiters

don’t need to predetermine memory size
no redundant space

difficult to search
potential redundant space if element length is known (delimiter)