Data Types And Structures Flashcards

1
Q

Setting up a maze

A
SET maze[0][1] TO 1
SET maze [1][1] TO 2
SET maze [1][2] TO 5
SET maze [2][3] TO 3
SET maze [3][4] TO 7....etc
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Moving from room to room

A

Procedure change

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

2D Arrays - Printing contents

A
FOR row from 0 TO 8 DO
FOR column from 0 TO 3 DO
SEND maze[row][column] TO display
END FOR
END FOR
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Advantages of a linked list

A

Is a dynamic data structure, meaning that its size is not fixed and can grow and shrink during execution
A linked list is flexible as the order of its items can be changed by moving links between data and not the actual data itself
Is more memory efficient than an array because it only needs to be as large as the number of items to be stored

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

Disadvantages of a linked list

A

It is not possible to identify a specific item directly using its index such as in an array
Instead you have to walk through the list from beginning to end

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

Linked lists are useful for implementation on

A

Dynamic data structures such as Queues and stacks

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

Setting up a linked list

A

Procedure Setuplist
DECLARE data INTEGER initially
DECLARE head pointer initially NUL
END Procedure

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

Inserting a new node to a linked list

A
PROCEDURE newnode (Integer data, Pointer next)
IF head = NUL THEN

Next = NUL
ELSE

Next = NUL
END IF
END PROCEDURE

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

Deleting a node from a linked list

A

Procedure deletenode (Integer data)
IF head = NUL THEN
SEND list is empty TO display
ELSE IF

THEN

END IF

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

Linked lists are useful for implementation on

A

Dynamic data structures such as Queues and stacks

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

Setting up a linked list

A

Procedure Setuplist
DECLARE data INTEGER initially
DECLARE head pointer initially NUL
END Procedure

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

Inserting a new node to a linked list

A
PROCEDURE newnode (Integer data, Pointer next)
IF head = NUL THEN

Next = NUL
ELSE

Next = NUL
END IF
END PROCEDURE

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

Deleting a node from a linked list

A

Procedure deletenode (Integer data)
IF head = NUL THEN
SEND list is empty TO display
ELSE IF

THEN

END IF

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