Test on Data structures
Data Structures: A Student's Guide to Essential Concepts
Test: Fundamentals of Data Structures, Specific Data Structures, Algoritmy, Teorie grafů
20 questions
Question 1: Arrays provide direct access to elements, typically achieving O(1) time complexity for read/write operations.
A. Yes
B. No
Explanation: The study materials state under the 'Arrays' section that 'Accessing an element at a specific index takes constant time, O(1), because its memory address can be calculated directly from the base address and the index.' The comparison table also confirms 'Direct (O(1))' access for arrays.
Question 2: According to the study materials, what is the worst-case time complexity for search, insertion, and deletion operations in a Binary Search Tree?
A. O(1)
B. O(log N)
C. O(N)
D. O(N log N)
Explanation: The study materials state that for Search, Insertion, and Deletion operations in a Binary Search Tree, the worst-case time complexity is O(N). This occurs in a skewed tree resembling a linked list.
Question 3: Queue operations implemented with a linked list inherently have a different time complexity than those implemented with an array, according to the study materials.
A. Yes
B. No
Explanation: The study materials state that 'All queue operations (Enqueue, Dequeue, Peek, IsEmpty) typically take O(1) constant time.' This general statement on time complexity applies regardless of whether the queue is implemented using an array or a linked list, indicating no inherent difference in time complexity between the two implementation methods.
Question 4: According to the FIFO principle of a queue, where are elements added and from where are they removed?
A. Elements are added to the front and removed from the rear.
B. Elements are added to the rear and removed from the front.
C. Elements are added to the top and removed from the top.
D. Elements are added to the rear and removed from the rear.
Explanation: A queue follows the First-In, First-Out (FIFO) principle. This means elements are added to one end, specifically the rear, and removed from the other end, which is the front. The element that was first added to the queue is the first one to be removed.
Question 5: O(N log N) time complexity is common in efficient sorting algorithms.
A. Yes
B. No
Explanation: The study materials explicitly state: 'O(N log N): Common in efficient sorting algorithms.'