0 0 votes What is the best-case time complexity of the following Python code snippet, assuming $N$ is the length of the list $\verb|L|$ ?def data_check(L): seen = set() for item in L: if item in seen: return True seen.add(item) return False # L is a list of items $O(N \log N)$ $O(N)$ $O(1)$ $O(N^2)$ Programming in Python goclasses python-&-dsa goclasses-da-dpp goclasses-da-dpp-day-69 goclasses-python-&-dsa-practice-questions + – GO Classes 247 views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
1 1 vote The best case occurs if the first $2$ elements of the list are same then the fn returns on the second iteration hence best case time complexity of this program is $O(1)$ GO Classes answered Dec 17, 2025 GO Classes comment Share Follow 0 reply Please log in or register to add a comment.