2. By Mr.Solomon E.
Data Structure
What is a Data Structure?
• A data structure is a way of organizing, managing, and storing data so
that it can be accessed and modified efficiently.
• It provides a systematic way to perform operations on data, such as
insertion, deletion, searching, and sorting.
• Why Are Data Structures Important?
They help in organizing data for better efficiency and performance.
They are essential for implementing algorithms.
3. By Mr.Solomon E.
Types of Data Structures
• Linear Data Structures: Data is arranged in a sequential manner.
e.g. Array, Stack, Queue, Linked list..
• Non-Linear Data Structures: Data is arranged hierarchically or in a
non-sequential manner. e.g. Tree, Graph..
• Hash-Based Data Structures: Data is stored and retrieved using a key-
value pair. e.g. Hash table
4. By Mr.Solomon E.
Linear Data Structures
Array
• A collection of elements stored at contiguous memory
locations.
• store a collection of elements of the same data type
• Accessed using an index.
• Arrays excel at providing fast, direct access to elements
However, their fixed size can be a limitation
Example: An array of integers: [10, 20, 30, 40]
50. By Mr.Solomon E.
What is the time complexity of the Linear Search algorithm in the worst case?
**
a) O(1)
b) O(log n)
c) O(n)
d) O(n²)
51. By Mr.Solomon E.
Which of the following is a requirement for the Binary Search algorithm to work correctly?
a) The array must be unsorted
b) The array must be sorted
c) The array must contain duplicate elements
d) The array must be of size n > 100
52. By Mr.Solomon E.
In a Binary Search, if the search key is greater than the middle element, what happens next?
a) The search continues in the first half of the array
b) The search continues in the second half of the array
c) The search terminates unsuccessfully
d) The middle element is swapped with the key
53. By Mr.Solomon E.
Which sorting algorithm works by repeatedly finding the smallest element and placing it at the
beginning?
a) Insertion Sort
b) Selection Sort
c) Bubble Sort
d) Linear Sort
54. By Mr.Solomon E.
What does O(1) time complexity indicate?
a) The runtime grows linearly with the input size
b) The runtime is constant regardless of input size
c) The runtime grows logarithmically with the input size
d) The runtime grows quadratically with the input size