CompSci - Data 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

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
3
Q

Linked list

A

A web of nodes, each with its memory address, its data and a pointer to the next address.

SImple to add new items

Linear access

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

Stack definition

A

FILO or LIFO structure

Simple

Inflexible

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

Queue definition

A

FIFO or LILO structure

Simple

Inflexible

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

Binary trees

A

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

Mirrors hierachical relations

Limited child nodes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
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
8
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
9
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
10
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
11
Q

Queue uses

A

Data buffer
Printing queue

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

Circular queue

A

Fixed size queue that has connected front and rear elements

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

Binary tree traversal

A

Pre-order: Rlr
Copying

In-order: lRr
In order output

Post-order: lrR
Delete

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

Balancing binary trees

A

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

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

Fixed length

A

each field/record has a fixed length

Easy to search and calculate memory size

Potential redundant space

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
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)

17
Q

Benefits and Drawbacks

A

ACCESS MDC

Accessibility
Cost
Convenience
Efficiency
Security
Scalability

Maintenance
Dependence
Complexity

18
Q
A