Abstract data types

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

1/100

flashcard set

Earn XP

Description and Tags

If questions repeat, i am so sorry x. Cambrdige AS level computer science 2025. Textbook references: Cambridge International AS and A level computer science coursebook Sylvia Langfield, David Duddell 2019 press ||| Cambrdige International AS and A Levels Computer science by David Wastson, Helen Williams press 2019

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

101 Terms

1
New cards

what does ADT stand for

Abstract data type

2
New cards

what is ADT

collectiion of data and a set of operations on that data

3
New cards

name the types of ADTs

stack, queue, linked listt

4
New cards

how can ADTs be implemented

from arrays

5
New cards

how can ADTs be stored

in a record

6
New cards

what is a node

an element of a list

7
New cards

what is a pointer

what is a pointer a variable that stored the address of the not it points to

8
New cards

what is a null pointer

a pointer that does not point at anything

9
New cards

what is a start pointer

a variable that stored the address of the first element of a linked list

10
New cards

What does this operation in a stack ADT do?: isFull()

checks if the stack is full

11
New cards

What does this operation in a stack ADT do?: initialize()

initialising it to be empty

12
New cards

What does this operation in a stack ADT do?: push()

intsert an element into the stack

13
New cards

What does this operation in a stack ADT do?: pop()

delete an element from the stack

14
New cards

What does this operation in a stack ADT do?: isEmpty()

checks if stack is empty

15
New cards

what does a stack consist of

elements of stame type arranged in a sequential order

16
New cards

what does LIFO stand for

last in; first out

17
New cards

what is a stack

a structure in which elements are added or removed from only one end

18
New cards

what does push mean in stacks

add

19
New cards

what does popped mean in a stack

remove

20
New cards

what variable type is push and pop usually in

boolean

21
New cards

how can you implement a stack ADT

arryas or linked lists

22
New cards

what is the advantage of ADTs

you don’t need to worry about how implementations are peformed to use stacks in your program

23
New cards

what is a client program

a program that uses data structures

24
New cards

what is implementation

program which utilises data structures

25
New cards

what does ADT provide

abstraction

26
New cards

what is a stack

linear data structure with insertions and deletions allowed only at the end called the top

27
New cards

what is a lineear data structure

data organization method where elements are arranged sequentially, one after another

28
New cards
<p>what ADT is this? </p>

what ADT is this?

stack

29
New cards
<p>what ADT is this </p>

what ADT is this

queue

30
New cards
<p>what ADT is this </p>

what ADT is this

linked list

31
New cards
<p>what ADT is this?</p>

what ADT is this?

circular queue

32
New cards

how do you understand data in a stack

from the users point of view

33
New cards

What does this operation in a stack ADT do?: top()

returns the last inserted elements without removing it

34
New cards

What does this operation in a stack ADT do?: size()

returns the size or the number of elements in the stack

35
New cards

how do you declare a stack

DECLARE Stack ARRAY[0:7] OF CHAR

36
New cards

what makes a stack array different from a normal array

it behaves like a stack by using a variable usually called top

37
New cards

what makes a normal array different from a stack array

you can insert or remove data from any point of the array

38
New cards

what does the variable stack do

keep track of the last inserted element

39
New cards

how would you indicate the stack is empty

make the variable top -1

40
New cards

what does the BaseOfStackPointer() do

point to first slot in a stack

41
New cards

what does TopOfStackPointer() do

points to the last slot added to the stack

42
New cards

What does this operation in a stack ADT do?: peek()

return the lement at the top of the stack without removing it

43
New cards
<p>what does this pseudocode do? </p>

what does this pseudocode do?

set up a stack

44
New cards
<p>what does this pseudocode do? </p>

what does this pseudocode do?

add an item to a stack

45
New cards
<p>what does this pseudocode do? </p>

what does this pseudocode do?

remove an item from a stack

46
New cards

how does the push() operation work

increment value of top by 1, new element is pushed to the position top

47
New cards

what happens when a stack is now in an overflow state

new element cannot be pushed because stack is full

48
New cards

how does the pop() operation work

element at top position is deleted, pop is decremented by 1

49
New cards

how would you declare a stack array. global or local?

global

50
New cards

how would you declare a top variable. global or local?

global

51
New cards

why would you need a max variable for a stack

to show the total amount of element spaces in a stack

52
New cards

how to delete an element at the top index in a stack

give an illusion just by decrementing the top variable

53
New cards

if the top variable is pointing to the middle of a stack, what happens to the other elements after that index

they are still stored there but cannot be accessed

54
New cards

what does underflow state mean

new element cannot be pushed because too many elements were popped

55
New cards

What does this operation in a queue ADT do?: enqueue()

insert an element at the end of the queue

56
New cards

What does this operation in a queue ADT do?: dequeue()

remove and return the first element of queue, if the queue is not empty

57
New cards

What does this operation in a queue ADT do?: peek()

return the element of the queue without removing it, if the queue is not empty

58
New cards

What does this operation in a queue ADT do?: size()

retunr the number of elements in the queue

59
New cards

What does this operation in a queue ADT do?: isEmpty()

return true if the queue is empty, otherwise return false

60
New cards

What does this operation in a queue ADT do?: isFull()

return true if the queue is full, otherwise retunr false

61
New cards

how can a queue ADT be represented

array, linked list

62
New cards

what is a queue ADT

linear data structure which insertion and deletion operations are performed at two different ends

63
New cards

what does rear mean in queue ADT

insertion point

64
New cards

what does front mean in queue ADT

deletion point

65
New cards

what does FIFO stand for

first in; first out

66
New cards

which ADT uses FIFO

queue

67
New cards

which ADT uses LIFO

stack

68
New cards
<p>what does this pseudocode do? </p>

what does this pseudocode do?

to set up a queue

69
New cards
<p>what does this pseudocode do? </p>

what does this pseudocode do?

to add an item onto a queue

70
New cards
<p>what does this pseudocode do? </p>

what does this pseudocode do?

to remove an item from the queue and store it

71
New cards

How do you show an empty queue

EndOfQueuePointer = -1

72
New cards

what is a more efficient queue

circular queue

73
New cards

how does a circular queue work

wraps around to the beginning and you will see an empty space

74
New cards

what happens when something is moved out the queue

everything is pushed forward and adjusts EndOfQueue pointer

75
New cards

how is a queue implemented

using an array and a set of pointers

76
New cards
<p>what does this pseudocode do </p>

what does this pseudocode do

set up a linked list

77
New cards
<p>what does this pseudocode do </p>

what does this pseudocode do

find an element in an ordered linked list

78
New cards
<p>what does this pseudocode do </p>

what does this pseudocode do

delete a node from an ordered linked list

79
New cards

how do you add a node at the front

startPointer is copied into the new node's pointer field and startpointer is set to point to the new node

80
New cards

how do you add a node after a given node

we copy the pointer field a node into the pointer field of a new node. Change the pointer field of first node to point to the new node

81
New cards

how do you add a node at the end

pointer field of last node points to new node. new node contains null pointer

82
New cards

how do you delete the first node in the list

copy pointer field of the node to be deleted into startpointer

83
New cards

how do you delete the last node in the list

set the pointer field for the preveious node to the null pointer

84
New cards

how do you delete a new node within the list

copy the pointer field of the node to be deleted into the pointer field of the node before that

85
New cards
<p>what does this diagram do?</p>

what does this diagram do?

add a node at the front of the list

86
New cards
<p>what does this diagram do?</p>

what does this diagram do?

add a node after a given node

87
New cards
<p>what does this diagram do?</p>

what does this diagram do?

add a node at the end

88
New cards
<p>what does this diagram do?</p>

what does this diagram do?

delete the first node in the list

89
New cards
<p>what does this diagram do?</p>

what does this diagram do?

delete the last node in the list

90
New cards
<p>what does this diagram do?</p>

what does this diagram do?

delete a node within the list

91
New cards

what is a pro of using linked lists

saves time, only the pointer needs to change in a linked list

92
New cards

what is a con of using linked lists

need more storage space

93
New cards

what do you do with unused nodes

form another linked list

94
New cards

what do you call a linked list with all emptu nodes

free list

95
New cards

how will a linked list appear when first inistialised

empty and null pointer will be the start pointer

96
New cards

what does the data value in the node box represent

key field of that node

97
New cards

what is an ordered linked list

list linked together in order of key field value

98
New cards

how can you implement a linked list

using arrays

99
New cards

what is a use for stacks?

memory management, expression evaluation, backtracking in recursion

100
New cards

what is a use for queues?

management of files sent to a printer, buffers used with keyboards, scheduling