Answered step by step
Verified Expert Solution
Question
1 Approved Answer
project to be done in C only ( Duplicate Elimination ) Use a one - dimensional array to solve the following problem. Read 2 0
project to be done in C only
Duplicate Elimination Use a onedimensional array to solve the following
problem. Read numbers, each of which is between and inclusive. As each
number is read, print it only if its not a duplicate of a number already read. Provide
for the worst case in which all numbers are different. Use the smallest possible
array to solve this problem.
If the following numbers are entered as input to the program note that the numbers and are not valid, and are thus not counted towards the valid inputs required:
Only the following numbers will be output at the end the remainder are either invalid numbers or duplicate numbers:
You should attempt to implement an algorithm that is reasonably efficient in regards to calculating whether a number was previously entered. A hint is that this algorithm does NOT require you to sort the numbers input, which would NOT be efficient for such a small number of inputs. A hashing algorithm is also NOT appropriate here.
Your solution must include a function called isUnique that returns true if the number input is unique and false otherwise I will leave it to YOUR BEST JUDGEMENT to decide what parameters to pass to this function. The implementation of this function must follow AFTER the implementation of main in your c file.
HINT: When you have completed inputting the numbers, there is no requirement that the array contain all of the numbers input by the user. Only the unique numbers are required to be stored in the array.
NOTE: So as to help you narrow down possible acceptable algorithms, I will be looking for your solution to use only a single one dimensional array and the array should have exactly elements.
Note: You should not have any non const global variables as part of your solution.
NOTE: The output your solution produces must emulate the exes output AS CLOSELY AS POSSIBLE.
NOTE: I have supplied sample test output with different sets of inputs. Your test output that you submit with your solution should use the identical test data sets.
below is an sample output
Enter # :
The number: is unique
Enter # :
The number: is unique
Enter # :
The number: is unique
Enter # :
The number entered is not in the valid range of to
Enter # :
The number entered is not in the valid range of to
Enter # :
The number: is unique
Enter # :
The number: is unique
Enter # :
The number: is unique
Enter # :
The number: is unique
Enter # :
The number: is unique
Enter # :
The number: is unique
Enter # :
The number: is unique
Enter # :
The number: is unique
Enter # :
The number: is unique
Enter # :
The number: is unique
Enter # :
The number: is unique
Enter # :
The number: is unique
Enter # :
The number: is unique
Enter # :
The number: is unique
Enter # :
The number: is unique
Enter # :
The number: is unique
Enter # :
The number: is unique
All of the unique numbers found are:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started