Advertisement
biswasrohit20

done

May 19th, 2021
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. Question 2(a)
  2.  
  3. 3
  4. 4
  5.  
  6.  
  7.  
  8. Question 2(b)
  9.  
  10. 0
  11. 0
  12. 0
  13.  
  14.  
  15.  
  16. Question 3(a)
  17.  
  18. 0
  19. 1
  20. 2
  21. 3
  22. 4
  23. 5
  24. 6
  25. 7
  26. 8
  27. 9
  28. 10
  29.  
  30.  
  31. Question 3(b)
  32.  
  33. 15
  34. 10
  35. 5
  36.  
  37. Question 3(c)
  38.  
  39. 0
  40. -3
  41. -2
  42.  
  43.  
  44.  
  45.  
  46.  
  47. Question 4(a)
  48.  
  49. function union(A, B) {
  50. var union = A
  51. for (var e of B) {
  52. if (A.includes(e) === false) {
  53. union.push(e)
  54. }
  55. }
  56. return union
  57. }
  58.  
  59.  
  60.  
  61. Question 4(b)
  62.  
  63.  
  64. function difference(A, B) {
  65. var diff = []
  66. for (var e of A) {
  67. if (B.includes(e) === false) {
  68. diff.push(e)
  69. }
  70. }
  71. for (var e of B) {
  72. if (A.includes(e) === false) {
  73. diff.push(e)
  74. }
  75. }
  76. return diff
  77. }
  78.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement