DS250723 - DSA-Basic Quiz1 doubt

@mohammedaliparkar342 @Divya
Q8. We can implement never-ending stacks using?
Ans. I selected option as “Either Arrays or Link List!”
but it showing as Wrong option & correct option is Only Linked List
I need clarification as


it will use both in my opinion & also while i cross checked online also - mentioned same
can you clarify this

Q10. What is the time complexity of searching a given element in Arrays?
Ans. I selected option as “O(1)”
but it showing as Wrong option & correct option is O(n)
I need clarification as
image
it should be in O(1) in my opinion & also while i cross checked online also - mentioned same
can you clarify this

1 Like

For Question 8 , it will be updated

For Question 10

The time complexity of searching for a given element in an array depends on the search algorithm used.

  1. Linear Search: If you perform a linear search (iterate through the array one element at a time until you find the desired element), the time complexity is O(n), where ‘n’ is the number of elements in the array. In the worst case, you might have to examine every element in the array.

  2. Binary Search: If the array is sorted and you use binary search, the time complexity is O(log n), where ‘n’ is the number of elements. Binary search repeatedly divides the search interval in half, which results in a much faster search for large arrays compared to linear search.

So, the time complexity of searching for an element in an array can be either O(n) or O(log n), depending on the search algorithm and the nature of the array (sorted or unsorted).

1 Like

@mohammedaliparkar342
Thank you for clarification on Q10
is Q8 updated means - will respective score also Updated as even one mark is useful somehow ?

1 Like

Will inform you regarding that