Write an algorithm to find uniqueness of elements in an array and give the mathematical analysis of this nonrecursive algorithm with all steps

7] Write an algorithm to find uniqueness of elements in an array and give the mathematical analysis of this non-recursive algorithm with all steps.

Analysis of Non-recursive Algorithms:

General Plan for Analyzing the Time Efficiency of Non-recursive Algorithms

  1. Decide on a parameter (or parameters) indicating an input’s size.
  2. Identify the algorithm’s basic operation. (As a rule, it is located in innermost loop.)
  3. Check whether the number of times the basic operation is executed depends only on the size of an input. If it also depends on some additional property, the worst-case,average-case, and, if necessary, best-case efficiencies have to be investigated separately.
  4. Set up a sum expressing the number of times the algorithm’s basic operation is executed.
  5. Using standard formulas and rules of sum manipulation, either find a closed form formula for the count or, at the very least, establish its order of growth.

Uniqueness of elements in an array :

Uniqueness of elements in an array :

Leave a Reply

Your email address will not be published. Required fields are marked *