Lists Flashcards
What is an Abstract Data Type (ADT)?
An ADT is a mathematical model for data types where the data type is defined by its behavior from the point of view of a user, particularly in terms of possible values, possible operations on data of this type, and the behavior of these operations.
True or False: A list is an example of an Abstract Data Type.
True
What are the two main properties of a list ADT?
The two main properties are that the elements are ordered and that each element can be accessed by its position or index.
Fill in the blank: In a list, the first element is typically accessed at index ____.
0
What operation would you use to add an element to the end of a list?
Append
True or False: A linked list is a type of list ADT.
True
What is the main advantage of using a linked list over an array for a list ADT?
A linked list can grow and shrink dynamically, allowing for efficient insertions and deletions.
Multiple Choice: Which of the following is NOT a standard operation on a list ADT? A) Insert B) Delete C) Sort D) Multiply
D) Multiply
What is a common way to represent a list in programming languages?
Arrays or linked structures.
Fill in the blank: The operation to remove an element from a specific position in a list is called ____.
Delete
True or False: A list can contain duplicate elements.
True
What does it mean for a list to be ‘ordered’?
It means that the elements have a specific sequence or arrangement.
Multiple Choice: Which type of list allows for efficient random access? A) Singly Linked List B) Doubly Linked List C) Array List D) Circular Linked List
C) Array List
What is a ‘singly linked list’?
A linked list where each node points to the next node and the last node points to null.
True or False: A doubly linked list allows traversal in both directions.
True
What is the purpose of a ‘head’ pointer in a linked list?
It points to the first element of the list.
Fill in the blank: In a circular linked list, the last node points back to the ____ node.
first
What is a ‘dynamic array’?
An array that can resize itself when elements are added or removed.
Multiple Choice: Which operation has O(n) time complexity in an array list? A) Access B) Insert at end C) Delete from beginning D) Append
C) Delete from beginning
What is the ‘size’ of a list ADT?
The number of elements currently stored in the list.
True or False: Lists can only store elements of the same data type.
False
What is the difference between a stack and a list ADT?
A stack follows Last In First Out (LIFO) order, while a list does not impose any specific order.
Fill in the blank: The operation to retrieve an element from a list is called ____.
Access
What is a ‘sorted list’?
A list where the elements are arranged in a specific order, typically ascending or descending.