LAB ASSIGNMENT Please could you use c++ programming language and Do it from scra
ID: 3812185 • Letter: L
Question
LAB ASSIGNMENT
Please could you use c++ programming language and Do it from scratch.
thank you in advance.
Please do both task. Thanks you so much.
Task 1:
Create a program that will compare to unsorted integer arrays of varying length.
Compare the two arrays placing the unique integers which occur in each individual array into new array called unique.
Unique values are integers that appear in the a single array but not both.
For Example
int array1[] = {12, 4, 5, 19, 25, 100}
int array2[] = {908, 12, 19, 205, 4, 100, 6}
Output =
int unique[] = {908,5 25, 205,6}
Attach Source Code below
Task 2:
Implement the solution for Task 1 using a Hash_Map or Dictionary
You can use the C++ STD Library to solve the problem. We will work towards implementing a custom Hash, Hash_Map, class in future assignments.
Compare the two arrays placing the unique integers which occur in each individual array into new array called unique.
Unique values are integers that appear in the a single array but not both.
For Example
int array1[] = {12, 4, 5, 19, 25, 100}
int array2[] = {908, 12, 19, 205, 4, 100, 6}
Output =
int unique[] = {908,5 25, 205,6}
Attach Source Code below
Explanation / Answer
int array1[] = {12, 4, 5, 19, 25, 100}
int array2[] = {908, 12, 19, 205, 4, 100, 6}
int uni[1];
unique = true;
for (int i =0;i<array1.length();i++)
{
for (int j=0;array2.length();j++)
{
if(array1[i] == array2[j])
{
unique = false;
continue;
}
else
{
unique = true;
}
if(unique)
{
cout<<uni[0];
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.