8000 Added New Data-Structure program · AllAlgorithms/python@a632c74 · GitHub
[go: up one dir, main page]

Skip to content

Commit a632c74

Browse files
YuvrajSHADabranhe
authored andcommitted
Added New Data-Structure program
the code will Help the user to find same elements in given two arrays by the user. Thank You!!
1 parent 3df093a commit a632c74

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

data-structures/Array Intersection.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
### Here You can Use this Program For Finding Same elements in two Arrays.
2+
def Array_Inter(arr1,n,arr2,m): ## Here I am Function
3+
for i in range(n) :
4+
for j in range(m) :
5+
if arr1[i] == arr2[j] :
6+
print(arr1[i], end = " ")
7+
break
8+
t=int(input("Test cases: ")) ## take test cases to be run
9+
for k in range(t):
10+
n=int(input("Size of Array One: ")) ## Size of array one by the user
11+
arr1=[int(x) for x in input().split()] ## take inputs from user seperated by space
12+
m=int(input("Size Of Array Two: "))
13+
arr2=[int(y) for y in input().split()]
14+
Array_Inter(arr1,n,arr2,m)

0 commit comments

Comments
 (0)
0