In one of the examination, they asked us to write a function "int similar()"
to check whether two list's data are similar or not irrespective of their order. they can also be of different sizes(in that case, they are dissimilar)
that is,. 3->2->-1 and -1>3>2 are similar
I wrote a program for that which is shown below.
that is, for list one,I am adding all the elements and storing in sum1.
I am multiplying all the elements and storing in product1.
similarly , sum2 and product2 for 2nd list.
if their sums and products are equal, then they must be containing same elements.
my question is that is this algorithm complete?
is there any case where my logic fails?
please help me

```
 #include<stdio.h>
 struct _node_
 {
   int data;
   struct _node_ *ptr;
 };

 typedef struct _node_ Node;

struct _linkedlist_
 {
   Node *head;
   Node *tail;
   int count;
 };

 typedef struct _linkedlist_ List;

 int similar(List *, List *);

int main()
{

 //...code//

return 0;
}

int similar(List *one, List *two)
{
 int sum1=0;
 int sum2=0;
 int product1=1;
 int product2=1;
 int i;
 Node *temp;

 temp=one->head;
 for(i=0;i<one->count;i++)
{
 sum1=sum1+(temp->data);
 prodcut1=product1*(temp->data);
 temp=temp->ptr;
 }   

temp=two->head;
for(i=0;i<two->count;i++)
{
  sum2=sum2+(temp->data);
  prodcut2=product2*(temp->data);
  temp=temp->ptr;
 }  

if(sum1==sum2 && product1==product2)
  return 1;

 return0;
 }

```