In given list of n elements, we need to find the first repeated element. Which of the
Question:
In given list of n elements, we need to find the first repeated element.
Which of the following methods will work for us. If a method works, then implement it.
• Brute force exhaustive search.
• Use Hash-Table to keep an index of the elements and use the second scan to find the element.
• Sorting the elements.
• If we know the range of the element then we can use counting technique.
When order in which elements appear in input is important, we cannot use sorting.
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Problems Solving In Data Structures And Algorithms Using C++
ISBN: 9789356273177
2nd Edition
Authors: Hemant Jain
Question Posted: