DATA STRUCTURES AND ALGORITHMS REVIEW. | FROM
QUESTION TO PERFECTION| STUDY WITH CONFIDENCE!
Course Code:
Course Title:
Programme:
Academic Year: 2026/2027
Duration: 2 Hours
Total Marks: 70%
Candidate Instructions:
1) Write your Registration Number on every answer booklet used.
2) Answer ALL questions in Section A and ANY TWO (2) questions in Section B.
3) Read each question carefully before answering.
4) Begin each question on a new page.
5) The marks for each question are indicated in brackets.
6) This paper consists of several printed pages, including this page.
7) Ensure your copy is complete before the examination begins.
8) Unauthorized materials and communication with other candidates are not permitted.
Turn Over.
APPHIA – Crafted with Care and Precision for Academic Excellence.
1
,runtime error, wherein a program's syntax is correct but the program attempts an impossible
operation, such as dividing by zero or multiplying strings together (like 'Hello' * 'ABC').
Answer: A runtime error halts the execution of the program. Abrupt and unintended termination
of a program is often called a crash of the program.
NP-complete problems are a Answer: set of problems for which no known efficient algorithm
exists. NP-complete problems have the following characteristics:
No efficient algorithm has found been to solve an NP-complete problem.
No one has proven that an efficient algorithm to solve an NP-complete problem is impossible.
If an efficient algorithm exists for one NP-complete problem, then all NP-complete problem can
be solved efficiently.
An abstract data type (ADT) is a data type described by predefined user operations, such as
"insert data at rear," without indicating how each operation is implemented. Answer: It does not
specify how data will be organized in memory and what algorithms will be used for
implementing the operations.
Ex: A list is a common ADT for holding ordered data, having operations like append a data item,
remove a data item, search whether a data item exists, and print the list. A list ADT is commonly
implemented using arrays or linked list data structures.
how is an abstract data type and a data structure different from each other? Answer: Simply put,
an ADT (Abstract Data Type) is more of a logical description, while a Data Structure is
concrete.
Think of an ADT as a picture of the data and the operations to manipulate and change it.
A Data Structure is the the real, concrete thing. It can be implemented and used within an
algorithm.
Common ADTs
ADT:
List
Description:
A list is an ADT for holding ordered data.
Common underlying data structures:
Array, linked list Answer: Stack
A stack is an ADT in which items are only inserted on or removed from the top of a stack.
Linked list
APPHIA – Crafted with Care and Precision for Academic Excellence.
2
, Queue
A queue is an ADT in which items are inserted at the end of the queue and removed from the
front of the queue.
Linked list Answer: Deque
A deque (pronounced "deck" and short for double-ended queue) is an ADT in which items can
be inserted and removed at both the front and back.
Linked list
Bag
A bag is an ADT for storing items in which the order does not matter and duplicate items are
allowed.
Array, linked list Answer: Set
A set is an ADT for a collection of distinct items.
Binary search tree, hash table
Priority queue
A priority queue is a queue where each item has a priority, and items with higher priority are
closer to the front of the queue than items with lower priority.
Heap Answer: Dictionary (Map)
A dictionary is an ADT that associates (or maps) keys with values.
Hash table, binary search tree
List abstract data type Answer: A list is a common ADT for holding ordered data, having
operations like append a data item, remove a data item, search whether a data item exists, and
print the list. Ex: For a given list item, after "Append 7", "Append 9", and "Append 5", then
"Print" will print (7, 9, 5) in that order, and "Search 8" would indicate item not found.
Common list ADT operations Answer: Operation
Description
Example starting with list: 99, 77
Append(list, x)
Inserts x at end of list
Append(list, 44), list: 99, 77, 44
Prepend(list, x)
Inserts x at start of list
Prepend(list, 44), list: 44, 99, 77
APPHIA – Crafted with Care and Precision for Academic Excellence.
3
QUESTION TO PERFECTION| STUDY WITH CONFIDENCE!
Course Code:
Course Title:
Programme:
Academic Year: 2026/2027
Duration: 2 Hours
Total Marks: 70%
Candidate Instructions:
1) Write your Registration Number on every answer booklet used.
2) Answer ALL questions in Section A and ANY TWO (2) questions in Section B.
3) Read each question carefully before answering.
4) Begin each question on a new page.
5) The marks for each question are indicated in brackets.
6) This paper consists of several printed pages, including this page.
7) Ensure your copy is complete before the examination begins.
8) Unauthorized materials and communication with other candidates are not permitted.
Turn Over.
APPHIA – Crafted with Care and Precision for Academic Excellence.
1
,runtime error, wherein a program's syntax is correct but the program attempts an impossible
operation, such as dividing by zero or multiplying strings together (like 'Hello' * 'ABC').
Answer: A runtime error halts the execution of the program. Abrupt and unintended termination
of a program is often called a crash of the program.
NP-complete problems are a Answer: set of problems for which no known efficient algorithm
exists. NP-complete problems have the following characteristics:
No efficient algorithm has found been to solve an NP-complete problem.
No one has proven that an efficient algorithm to solve an NP-complete problem is impossible.
If an efficient algorithm exists for one NP-complete problem, then all NP-complete problem can
be solved efficiently.
An abstract data type (ADT) is a data type described by predefined user operations, such as
"insert data at rear," without indicating how each operation is implemented. Answer: It does not
specify how data will be organized in memory and what algorithms will be used for
implementing the operations.
Ex: A list is a common ADT for holding ordered data, having operations like append a data item,
remove a data item, search whether a data item exists, and print the list. A list ADT is commonly
implemented using arrays or linked list data structures.
how is an abstract data type and a data structure different from each other? Answer: Simply put,
an ADT (Abstract Data Type) is more of a logical description, while a Data Structure is
concrete.
Think of an ADT as a picture of the data and the operations to manipulate and change it.
A Data Structure is the the real, concrete thing. It can be implemented and used within an
algorithm.
Common ADTs
ADT:
List
Description:
A list is an ADT for holding ordered data.
Common underlying data structures:
Array, linked list Answer: Stack
A stack is an ADT in which items are only inserted on or removed from the top of a stack.
Linked list
APPHIA – Crafted with Care and Precision for Academic Excellence.
2
, Queue
A queue is an ADT in which items are inserted at the end of the queue and removed from the
front of the queue.
Linked list Answer: Deque
A deque (pronounced "deck" and short for double-ended queue) is an ADT in which items can
be inserted and removed at both the front and back.
Linked list
Bag
A bag is an ADT for storing items in which the order does not matter and duplicate items are
allowed.
Array, linked list Answer: Set
A set is an ADT for a collection of distinct items.
Binary search tree, hash table
Priority queue
A priority queue is a queue where each item has a priority, and items with higher priority are
closer to the front of the queue than items with lower priority.
Heap Answer: Dictionary (Map)
A dictionary is an ADT that associates (or maps) keys with values.
Hash table, binary search tree
List abstract data type Answer: A list is a common ADT for holding ordered data, having
operations like append a data item, remove a data item, search whether a data item exists, and
print the list. Ex: For a given list item, after "Append 7", "Append 9", and "Append 5", then
"Print" will print (7, 9, 5) in that order, and "Search 8" would indicate item not found.
Common list ADT operations Answer: Operation
Description
Example starting with list: 99, 77
Append(list, x)
Inserts x at end of list
Append(list, 44), list: 99, 77, 44
Prepend(list, x)
Inserts x at start of list
Prepend(list, 44), list: 44, 99, 77
APPHIA – Crafted with Care and Precision for Academic Excellence.
3