SlideShare a Scribd company logo
SWIFT
PROGRAMS ON ARRAY
INDEX
S.NO. PROGRAMS SIGNATURE
1 Program to print the numbers in an array horizontally
2 Program to search the number from a 1 D array using linear search
3 Program to search the number from a 1 D array using binary search
4 Program to insert the number in a 1 D array using Insertion sorted array
5 Program to insert the number in a 1 D array using Deletion sorted array
6 Program to sort the number in an array using bubble sort
7 Program to sort the number in an array using selection sort
8 Write a function Alter(), with array and size as a parameter ,which
should change all the multiples of 5 in the array to 5 and rest of the
element as 1
9 Write a function modify() with array and size as a parameter, which
should reposition the content after swapping each adjacent pair of
number in it
10 Write a function Large() with array and size as a parameter, which
should display the largest and second largest by returning both from an
array
11 Write a function addup() with array and size as a parameter,in which all
even position(0,2,4,…..) of the array should be added with the content
of element in the next position and odd position(1,3,5,…..) elements
should be increment by 10
12 Write a function twotoone() with array and size as an parameters,in
which accept two array X[] and Y[] and transfer all X[] numbers in even
places of Z[] and all Y[] numbers in odd places of Z[].
13 Write a function convert() with array and size as a parameter,which
reposition all the elements of the array by shifting each of them one to
one position before and by shifting the first elements to the last
position
14 Write a function SWAP() with array and size as a parameter,which swap
the numbers on the basis of example given:
If array A no : 10,20,30,40,50,60 the output after swapping
20,10,40,30,60,50
15 Write a function SWAP2() with array and size as a parameter,which
swap the numbers on the basis of example given:
If array A no : 10,20,30,40,50,60 the output after swapping
40,50,60,10,20,30
16 Write a function merge() with three array as a parameter array A,B, and
C with their size M , N , and M+N , where A is ascending order , B is
descending order and C accept numbers from A and B in ascending
order.
17 Write a function dispTen() with 2D array no and size as a parameter and
display only those numbers which are divisible by 10
18 Write a function rowsum() with 2D array A and size as a parameter and
display the sum of each row
20 Write a function diagonalsum() with 2D array A and size as a parameter
and display the sum
21 program to find the largest no from a 1D array of 10 numbers
22 Write a function swaparr() with 2D array A and size as a parameter and
swap or interchange the first row with the last row elements.
23 Write a function lefttrg() with 2D array A and size as a parameter and
display the output as given
Example: output
1 2 3 4
6 4 5 6 6
2 1 5 4 2 1
1 2 3 5 1 2 3
24 Write a function summatrix() with 2D array A , B , C and size as a
parameter, and display the sum of two matrix in C
25 Write a function copyarr() with 2D array A and B as 1D array and size as
a parameter,display the output as given below:
Example: if array B values are 1,2,3,4,5
Array A store values as:
1,2,3,4,5
1,2,3,4,0
1,2,3,0,0
1,2,0,0,0
1,0,0,0,0
//Program to print the numbers in an array horizontally
func display(no:[Int], k:Int)
{
var x = 0
while x < k
{
print("(no[x]), ",terminator:"")
x = x + 1
}
print("")
}
var n:[Int] = [10,20,30,40,50,60,70,80,90,100 ]
display(no:n, k:10)
----------------------------output ----------------------------------
10, 20, 30, 40, 50, 60, 70, 80, 90, 100,
// Program to search the number from a 1 D array using linear search
func lsearch(no:[Int], src:Int, k:Int) -> Int
{
var tmp = -1
var x = 0
while x < k
{
if no[x] == src
{
tmp = x
break
}
x = x + 1
}
return tmp
}
var n:[Int] = [40,10,51,86,19,87,70,3,14,100 ]
var rs = lsearch(no:n, src:19, k:10)
if rs < 0
{
print("no not found")
}else
{
rs = rs + 1
print("no found at pos =(rs)")
}
--------------------------output----------------------------
no found at pos =5
// Program to search the number from a 1 D array using binary search
func bsearch(no:[Int], src:Int, k:Int) -> Int
{
var tmp = -1
var x = 0
var beg = 0 , last = k - 1 , mid = 0
while beg < last
{
mid = (beg + last) / 2
if no[mid] == src
{
tmp = x
break
}else
{ if no[mid] > src
{
last = mid - 1
}else
{
beg = mid + 1
}
}
x = x + 1
}
return tmp
}
var n:[Int] = [40,45,58,75,86,89,92,97,99,120]
var rs = bsearch(no:n, src:58, k:10)
if rs < 0
{
print("no not found")
}else
{
rs = rs + 1
print("no found at pos =(rs)")
}
---------------output------------------
no found at pos =3
// Program to insert the number in a 1 D array using Insertion sorted array
func insertionUN(no:[Int],ser:Int,k:Int) -> Int
{
var pos:Int = -1
var flag = -1
var x = 0
let last = k - 1
while x < k
{
if no[0] >= ser
{
flag = 0
pos = 0
break
}else if no[last] <= ser
{
pos = last
flag = 1
break;
}
else if no[x] < ser && no[x + 1] > ser
{
flag = 2
pos = x + 1
break
}
x = x + 1
}
if flag == 0
{
pos = 0
}else if flag == 1
{
pos = pos + 1
}
return pos
}
var search = 67
print("before insertion")
var n:[Int] = [10,20,30,40,50,60,70,80]
var k1 = insertionUN(no:n, ser:search, k:n.count)
print("after insertion")
n.insert(search,at:k1)
print(n)
----------------------------output------------------------------
before insertion
[10, 20, 30, 40, 50, 60, 70, 80]
after insertion
[10, 20, 30, 40, 50, 60, 67, 70, 80]
// Program to insert the number in a 1 D array using Deletion sorted array
func deletionUN(no:[Int],ser:Int,k:Int) -> Int
{
var pos:Int = -1
var x = 0
while x < k
{
if no[x] == ser
{
pos = x
break
}
x = x + 1
}
return pos
}
var search = 40
var y = 0
var n:[Int] = [10,20,30,40,50,60,70,80]
print("before deletion array size = (n.count)")
print(n)
var k1 = deletionUN(no:n, ser:search, k:n.count)
if k1 > 0
{
y = k1
while y < n.count - 1
{
n[y] = n[y + 1]
y = y + 1
}
}
n.remove(at:n.count - 1)
print("after deletion array size =(n.count)")
print(n)
-------output----------------
before deletion array size = 8
[10, 20, 30, 40, 50, 60, 70, 80]
after deletion array size =7
[10, 20, 30, 50, 60, 70, 80]
// Program to sort the number in an array using bubble sort
func sortbubble(no:inout [Int],k:Int)
{
var x = 0 , y = 0
var tmp = 0
while x < k
{
y = 0
while y < k - 1
{
if no[y] > no[y + 1]
{
tmp = no[y]
no[y] = no[y + 1]
no[y + 1] = tmp
}
y = y + 1
}
x = x + 1
}
}
var n:[Int] = [60,2,33,55,5,22,1,8]
print("before sorting array ")
print(n)
sortbubble(no: &n, k:n.count)
print("after sorting array")
print(n)
----------------------------------output------------------------------------
before sorting array
[60, 2, 33, 55, 5, 22, 1, 8]
after sorting array
[1, 2, 5, 8, 22, 33, 55, 60]
// Program to sort the number in an array using selection sort
func sortselection(no:inout [Int],k:Int)
{
var x = 0 , y = 0
var tmp = 0
while x < k
{
y = x + 1
while y < k
{
if no[x] > no[y]
{
tmp = no[x]
no[x] = no[y]
no[y] = tmp
}
y = y + 1
}
x = x + 1
}
}
var n:[Int] = [60,2,33,55,5,22,1,8]
print("before sorting array ")
print(n)
sortselection(no: &n, k:n.count)
print("after sorting array")
print(n)
-----------------------------output------------------------------
before sorting array
[60, 2, 33, 55, 5, 22, 1, 8]
after sorting array
[1, 2, 5, 8, 22, 33, 55, 60]
/* Write a function Alter(), with array and size as a parameter ,which should
change all the multiples of 5 in the array to 5 and rest of the element as 1 */
func alter(no:inout [Int],k:Int)
{
var x = 0
while x < k
{
if no[x] % 5 == 0
{
no [x] = 5
}else
{
no[x] = 1
}
x = x + 1
}
}
var n:[Int] = [55,43,20,16,39,90,83,40,48,25]
print("before ")
print(n)
alter(no: &n, k:n.count)
print("after")
print(n)
------------------------output-----------------------------
before
[55, 43, 20, 16, 39, 90, 83, 40, 48, 25]
after
[5, 1, 5, 1, 1, 5, 1, 5, 1, 5]
/* Write a function modify() with array and size as a parameter, which should
reposition the content after swapping each adjacent pair of number in it */
func modify(no:inout [Int],k:Int)
{
var x = 0 , tmp = 0
while x < k
{
tmp = no[x]
no[x] = no[x + 2]
no[x + 2] = tmp
if x % 4 >= 1
{
x = x + 2
}
x = x + 1
}
}
var n:[Int] = [86,93,40,36,52,21,70,10]
print("before ")
print(n)
modify(no: &n, k:n.count)
print("after")
print(n)
----------------------------output-------------------------------------------------
before
[86, 93, 40, 36, 52, 21, 70, 10]
after
[40, 36, 86, 93, 70, 10, 52
/*Write a function Large() with array and size as a parameter, which should
display the largest and second largest by returning both from an array.*/
func large(no:inout [Int],k:Int) -> ( Int , Int )
{
var x = 0 , l = no[0] , sec1 = no[0]
while x < k
{
if no[x] > l
{
sec1 = l
l = no[x]
}else if no[x] > sec1
{
sec1 = no[x]
}
x = x + 1
}
return (l , sec1)
}
var n:[Int] = [86,93,40,136,52,21,70,10]
var (k , s ) = large(no: &n, k:n.count)
print("Largest no = (k) and second large = (s)")
--------------------------------output------------------------------------
Largest no = 136 and second large = 93
/* Write a function addup() with array and size as a parameter,in which all even
position(0,2,4,…..) of the array should be added with the content of element in
the next position and odd position(1,3,5,…..) elements should be increment by 10
*/
func addup(no:inout [Int] , k:Int)
{
var x:Int = 0
while x < k
{
if no[x] % 2 == 0
{
no[x] = no[x] + no[x + 1]
}else
{
no[x] = no[x] + 10
}
x = x + 1
}
}
var n:[Int] = [23,30,45,10,15,25,45,10,56,78,33]
print("before ")
print(n)
addup(no: &n, k:n.count)
print("after")
print(n)
----------------------------output--------------------------------
before
[23, 30, 45, 10, 15, 25, 45, 10, 56, 78, 33]
after
[33, 75, 55, 25, 25, 35, 55, 66, 134, 111, 43]
/* Write a function twotoone() with array and size as an parameters,in
which accept two array X[] and Y[] and transfer all X[] numbers in even
places of Z[] and all Y[] numbers in odd places of Z[]. */
func twotoone(z:inout [Int] ,x:[Int] ,y:[Int] , k:Int)
{
var a:Int = 0 , b:Int = 0
var c:Int = 0
while c < k
{
if c % 2 == 0
{
z.insert(x[a],at:c)
a = a + 1
}else
{
z.insert(y[b],at:c)
b = b + 1
}
c = c + 1
}}
var Z:[Int] = []
var X:[Int] = [10,20,30,40,50]
var Y:[Int] = [11,12,13,14,15]
print("before array Z")
print(Z)
print("before array X")
print(X)
print("before array Y")
print(Y)
twotoone(z:&Z, x:X, y:Y, k:10)
print("after")
print(Z)
---------------output---------------------
before array Z
[]
before array X
[10, 20, 30, 40, 50]
before array Y
[11, 12, 13, 14, 15]
After array Z
[10, 11, 20, 12, 30, 13, 40, 14, 50,
15]
/* Write a function convert() with array and size as a parameter,which
reposition all the elements of the array by shifting each of them one to
one position before and by shifting the first elements to the last
position*/
func convert(no:inout [Int] ,k:Int ,size:Int)
{
var tmp:Int = 0
var last:Int = size - 1
var x:Int = 1
var y:Int = 0
while x <= k
{
tmp = no[0]
y = 0
while y < size - 1
{
no[y] = no[y + 1]
y = y + 1
}
no[last] = tmp
x = x + 1
}
}
var X:[Int] = [10,20,30,40,50,60,70,80]
print("before")
print(X)
convert(no: &X, k:2, size:X.count)
print("After")
print(X)
--------------------------------------output----------------------------------------
before
[10, 20, 30, 40, 50, 60, 70, 80]
After
[30, 40, 50, 60, 70, 80, 10, 20]
/*Write a function SWAP() with array and size as a parameter,which
swap the numbers on the basis of example given:
If array A no : 10,20,30,40,50,60 the output after swapping
20,10,40,30,60,50 */
func swap(no:inout [Int] ,size:Int)
{
var tmp:Int = 0
var y:Int = 0
while y < size - 1
{
tmp = no[y]
no[y] = no[y + 1]
no[y + 1] = tmp
y = y + 2
}
}
var X:[Int] = [10,20,30,40,50,60]
print("before")
print(X)
swap(no: &X, size:X.count)
print("After")
print(X)
------------------------------output---------------------------
before
[10, 20, 30, 40, 50, 60]
After
[20, 10, 40, 30, 60, 50]
/*Write a function SWAP2() with array and size as a parameter,which
swap the numbers on the basis of example given:
If array A no : 10,20,30,40,50,60 the output after swapping
40,50,60,10,20,30 */
func swap2(no:inout [Int] ,size:Int)
{
var tmp:Int = 0
var y:Int = 0
var x:Int = size / 2
while y < size / 2
{
tmp = no[y]
no[y] = no[x]
no[x] = tmp
y = y + 1
x = x + 1
}
}
var X:[Int] = [10,20,30,40,50,60]
print("before")
print(X)
swap(no: &X, size:X.count)
print("After")
print(X)
---------------------------output---------------------------
before
[10, 20, 30, 40, 50, 60]
After
[40, 50, 60, 10, 20, 30]
/* Write a function merge() with three array as a parameter array A,B,
and C with their size M , N , and M+N , where A is ascending order , B
is descending order and C accept numbers from A and B in ascending
order. */
func merge(A1:[Int],B1:[Int],C1:inout [Int], M:Int, N:Int)
{
var x = 0
var a = 0
var k = 0
// var y = ( M + N ) - 1
var y = N - 1
while x < M && y >= 0
{
if A1[x] <= B1[y]
{
C1.append(A1[x])
k = k + 1
x = x + 1
}else
{
C1.append(B1[y])
k = k + 1
y = y - 1
}
}
if x < M
{
a = x
while a < M
{
C1.append(A1[a])
a = a + 1
}
}
if y >= 0
{
a = y
while a >= 0
{
C1.append(B1[a])
a = a - 1
}
}
}
var A:[Int] = [1,2,3,4,5,6,9,10,12]
var B:[Int] = [9,8,7,5,3,2,1]
var C:[Int] = []
print("before A")
print(A)
print("b numbers")
print(B)
merge(A1: A,B1: B,C1: &C,M:A.count , N:B.count)
print("After")
print(C)
----------------------------------output--------------------------------------
before A
[1, 2, 3, 4, 5, 6, 9, 10, 12]
b numbers
[9, 8, 7, 5, 3, 2, 1]
After
[1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 7, 8, 9, 9, 10, 12
/* Write a function dispTen() with 2D array A and size
as a parameter and display only those numbers which are
divisible by 10 */
func dispTen(n: [[Int]], size:Int)
{
var x = 0 , y = 0
while x < size
{
y = 0
while y < size
{
if n[x][y] % 10 == 0
{
print("(n[x][y]), ",terminator:"")
}
y = y + 1
}
x = x + 1
}
print("")
}
var no:[[Int]] = [[12,20,13],[2,10,30],[40,5,16]]
dispTen(n:no,size:no.count)
----------------------------output-----------------------------------
20, 10, 30, 40,
// Write a function rowsum() with 2D array A and size as
a parameter and display the sum of each row
func rowsum(n: [[Int]], size:Int)
{
var x = 0 , y = 0
var sum = 0
while x < size
{
y = 0
sum = 0
while y < size
{
sum = sum + n[x][y]
print("(n[x][y]) +",terminator:"")
y = y + 1
}
x = x + 1
print("=(sum)n",terminator:"")
}
print("")
}
var no:[[Int]] = [[12,20,13],[2,10,30],[40,5,16]]
rowsum(n:no,size:no.count)
----------------------output------------------------------
12 +20 +13 =45
2 +10 +30 =42
40 +5 +16 =61
// Write a function diagonalsum() with 2D array A and
size as a parameter and display the sum
func diagonalsum(A1:inout [[Int]] , k:Int) -> Int
{
var x:Int = 0 , y:Int = 0
var lsum = 0 , rsum = 0
while x < k
{
y = 0
while y < k
{
if x == y
{
lsum = lsum + A1[x][y]
}else if x + y == k - 1
{
rsum = rsum + A1[x][y]
}
y = y + 1
}
x = x + 1
}
return lsum + rsum
}
var A:[[Int]] = [[4,5,6],[7,8,9],[1,2,3]]
print("before array A")
print(A)
var rs = diagonalsum (A1:&A, k:A.count)
print(“sum of diagonal =(rs)”)
-----------------------------output--------------------------------
before array A
[[4, 5, 6], [7, 8, 9], [1, 2, 3]]
Sum of diagonal = 22
//program to find the largest no from a 1D array of 10 numbers
func largest(no:[Int], k:Int) -> Int
{
var large = no[0]
var x = 0
while x < k
{
if no[x] > large
{
large = no[x]
}
x = x + 1
}
return large
}
var n:[Int] = [51, 21, 30, 45, 75, 15, 2, 56, 120, 11 ]
var rs = largest(no:n, k:10)
print("largest no = (rs)")
------------------------output-------------------------------
Largest no = 120
/*Write a function swaparr() with 2D array A and size as
a parameter and swap or interchange the first row with
the last row elements.*/
func display(tmp:[[Int]], size:Int)
{
var x = 0 , y = 0
while x < size
{
y = 0
while y < size
{
print("(tmp[x][y]) , ",terminator:"")
y = y + 1
}
x = x + 1
print("n")
}
print("")
}
func swaparr (A1:inout [[Int]] , k:Int)
{
var a = 0 , last = k - 1
var t = 0
while a < k
{
t = A1[0][a]
A1[0][a] = A1[last][a]
A1[last][a] = t
a = a + 1
}
}
var A:[[Int]] = [[5,6,2,3],[1,2,4,9],[2,5,8,1],[9,7,5,8]]
print("before")
display(tmp:A,size:A.count)
swaparr(A1:&A,k:A.count)
print("after")
display(tmp:A,size:A.count)
-----------------------output--------------------------------------
before
5 , 6 , 2 , 3
1 , 2 , 4 , 9
2 , 5 , 8 , 1
9 , 7 , 5 , 8
after
9 , 7 , 5 , 8
1 , 2 , 4 , 9
2 , 5 , 8 , 1
5 , 6 , 2 , 3
/* Write a function lefttrg() with 2D array A and size as a parameter and
display lower triangle as the output given
Example: output
1 2 3 4
6 4 5 6 6
2 1 5 4 2 1
1 2 3 5 1 2 3 */
func display(tmp:[[Int]], size:Int)
{
var x = 0 , y = 0
while x < size
{
y = 0
while y < size
{
print("(tmp[x][y]) , ",terminator:"")
y = y + 1
}
x = x + 1
print("n")
}
print("")
}
func lfttrg(z:[[Int]] , k:Int)
{
var a = 0 , b = 0
var t = 0
while a < k
{
b = 0
while b < k
{
if a > b
{
print("(z[a][b]) , ",terminator:"")
}
b = b + 1
}
print("n",terminator:"")
a = a + 1
}
print("")
}
var A:[[Int]] = [[1,2,3,4],[6,4,5,6],[2,1,5,4],[1,2,3,5]]
print("before")
display(tmp:A,size:A.count)
print("lower triangle")
lfttrg(z:A,k:A.count)
-----------------------------output---------------------------
before
1 , 2 , 3 , 4
6 , 4 , 5 , 6
2 , 1 , 5 , 4
1 , 2 , 3 , 5
lower triangle
6
2 , 1
1 , 2 , 3
/* Write a function summatrix() with 2D array A , B , C and size as a parameter,
and display the sum of two matrix in C */
func display(tmp:[[Int]], size:Int)
{
var x = 0 , y = 0
while x < size
{
y = 0
while y < size
{
print("(tmp[x][y]) , ",terminator:"")
y = y + 1
}
x = x + 1
print("n")
}
print("")
}
func summat(A1:[[Int]], B1:[[Int]], C1:inout [[Int]], size:Int)
{
var x = 0 , y = 0
var sum = 0
while x < size
{
y = 0
while y < size
{
sum = A1[x][y] + B1[x][y]
C1[x][y] = sum
y = y + 1
}
x = x + 1
}
}
var A:[[Int]] = [[1,2,3],[1,2,3],[1,2,3]]
var B:[[Int]] = [[4,5,6],[4,5,6],[4,5,6]]
var C:[[Int]] = [[Int]](repeating:[Int] (repeating: 0, count: 3), count: 3)
print("Array A")
display(tmp:A,size:A.count)
print("Array B")
display(tmp:B,size:B.count)
summat(A1:A,B1:B,C1:&C,size:3)
print("Array C")
display(tmp:C,size:C.count)
--------------------output-----------------------
Array C
5 , 7 , 9 ,
5 , 7 , 9 ,
5 , 7 , 9 ,
---------------------output--------------------------
Array A
1 , 2 , 3 ,
1 , 2 , 3 ,
1 , 2 , 3 ,
Array B
4 , 5 , 6 ,
4 , 5 , 6 ,
4 , 5 , 6 ,
/* Write a function copyarr() with 2D array A and B as 1D array and size as a
parameter,display the output as given below:
Example: if array B values are 1,2,3,4,5
Array A store values as:
1,2,3,4,5
1,2,3,4,0
1,2,3,0,0
1,2,0,0,0
1,0,0,0,0
*/
func display(tmp:[[Int]], size:Int)
{
var x = 0 , y = 0
while x < size
{
y = 0
while y < size
{
print("(tmp[x][y]) , ",terminator:"")
y = y + 1
}
x = x + 1
print("n")
}
print("")
}
func copyarr(A1:inout [[Int]] , B1:[Int] , k:Int)
{
var x = 0 , y = 0
while x < k
{
y = 0
while y < k
{
if x + y < k
{
A1[x][y] = B1[y]
}else
{
A1[x][y] = 0
}
y = y + 1
}
x = x + 1
}
}
var B:[Int] = [10,20,30,40,50]
var A:[[Int]] = [[Int]](repeating:[Int] (repeating: 0, count: B.count), count: B.count)
print("before array B")
print(B)
copyarr(A1:&A, B1:B, k:B.count)
print("after array A")
display(tmp:A,size:A.count)
--------------------output--------------------------
before array B
[10, 20, 30, 40, 50]
After array A
10 20 30 40 50
10 20 30 40 0
10 20 30 0 0
10 20 0 0 0
10 0 0 0 0

More Related Content

What's hot (19)

Numpy tutorial(final) 20160303
Numpy tutorial(final) 20160303Numpy tutorial(final) 20160303
Numpy tutorial(final) 20160303
Namgee Lee
 
Pandas Series
Pandas SeriesPandas Series
Pandas Series
Sangita Panchal
 
The Essence of the Iterator Pattern
The Essence of the Iterator PatternThe Essence of the Iterator Pattern
The Essence of the Iterator Pattern
Eric Torreborre
 
Python object oriented programming (lab2) (2)
Python object oriented programming (lab2) (2)Python object oriented programming (lab2) (2)
Python object oriented programming (lab2) (2)
iloveallahsomuch
 
Python seaborn cheat_sheet
Python seaborn cheat_sheetPython seaborn cheat_sheet
Python seaborn cheat_sheet
Nishant Upadhyay
 
Multi dimensional array
Multi dimensional arrayMulti dimensional array
Multi dimensional array
Rajendran
 
Qno 3 (a)
Qno 3 (a)Qno 3 (a)
Qno 3 (a)
Praveen M Jigajinni
 
DataFrame in Python Pandas
DataFrame in Python PandasDataFrame in Python Pandas
DataFrame in Python Pandas
Sangita Panchal
 
Python bokeh cheat_sheet
Python bokeh cheat_sheet Python bokeh cheat_sheet
Python bokeh cheat_sheet
Nishant Upadhyay
 
Seminar PSU 10.10.2014 mme
Seminar PSU 10.10.2014 mmeSeminar PSU 10.10.2014 mme
Seminar PSU 10.10.2014 mme
Vyacheslav Arbuzov
 
N-Queens Combinatorial Problem - Polyglot FP for fun and profit - Haskell and...
N-Queens Combinatorial Problem - Polyglot FP for fun and profit - Haskell and...N-Queens Combinatorial Problem - Polyglot FP for fun and profit - Haskell and...
N-Queens Combinatorial Problem - Polyglot FP for fun and profit - Haskell and...
Philip Schwarz
 
Matlab plotting
Matlab plottingMatlab plotting
Matlab plotting
shahid sultan
 
Tupple ware in scala
Tupple ware in scalaTupple ware in scala
Tupple ware in scala
VulcanMinds
 
Matlab ploting
Matlab plotingMatlab ploting
Matlab ploting
Ameen San
 
Python3 cheatsheet
Python3 cheatsheetPython3 cheatsheet
Python3 cheatsheet
Gil Cohen
 
Oh, All the things you'll traverse
Oh, All the things you'll traverseOh, All the things you'll traverse
Oh, All the things you'll traverse
Luka Jacobowitz
 
The Ring programming language version 1.6 book - Part 183 of 189
The Ring programming language version 1.6 book - Part 183 of 189The Ring programming language version 1.6 book - Part 183 of 189
The Ring programming language version 1.6 book - Part 183 of 189
Mahmoud Samir Fayed
 
A quick introduction to R
A quick introduction to RA quick introduction to R
A quick introduction to R
Angshuman Saha
 
List and Dictionary in python
List and Dictionary in pythonList and Dictionary in python
List and Dictionary in python
Sangita Panchal
 
Numpy tutorial(final) 20160303
Numpy tutorial(final) 20160303Numpy tutorial(final) 20160303
Numpy tutorial(final) 20160303
Namgee Lee
 
The Essence of the Iterator Pattern
The Essence of the Iterator PatternThe Essence of the Iterator Pattern
The Essence of the Iterator Pattern
Eric Torreborre
 
Python object oriented programming (lab2) (2)
Python object oriented programming (lab2) (2)Python object oriented programming (lab2) (2)
Python object oriented programming (lab2) (2)
iloveallahsomuch
 
Python seaborn cheat_sheet
Python seaborn cheat_sheetPython seaborn cheat_sheet
Python seaborn cheat_sheet
Nishant Upadhyay
 
Multi dimensional array
Multi dimensional arrayMulti dimensional array
Multi dimensional array
Rajendran
 
DataFrame in Python Pandas
DataFrame in Python PandasDataFrame in Python Pandas
DataFrame in Python Pandas
Sangita Panchal
 
N-Queens Combinatorial Problem - Polyglot FP for fun and profit - Haskell and...
N-Queens Combinatorial Problem - Polyglot FP for fun and profit - Haskell and...N-Queens Combinatorial Problem - Polyglot FP for fun and profit - Haskell and...
N-Queens Combinatorial Problem - Polyglot FP for fun and profit - Haskell and...
Philip Schwarz
 
Tupple ware in scala
Tupple ware in scalaTupple ware in scala
Tupple ware in scala
VulcanMinds
 
Matlab ploting
Matlab plotingMatlab ploting
Matlab ploting
Ameen San
 
Python3 cheatsheet
Python3 cheatsheetPython3 cheatsheet
Python3 cheatsheet
Gil Cohen
 
Oh, All the things you'll traverse
Oh, All the things you'll traverseOh, All the things you'll traverse
Oh, All the things you'll traverse
Luka Jacobowitz
 
The Ring programming language version 1.6 book - Part 183 of 189
The Ring programming language version 1.6 book - Part 183 of 189The Ring programming language version 1.6 book - Part 183 of 189
The Ring programming language version 1.6 book - Part 183 of 189
Mahmoud Samir Fayed
 
A quick introduction to R
A quick introduction to RA quick introduction to R
A quick introduction to R
Angshuman Saha
 
List and Dictionary in python
List and Dictionary in pythonList and Dictionary in python
List and Dictionary in python
Sangita Panchal
 

Similar to Programs in array using SWIFT (20)

Programming in lua STRING AND ARRAY
Programming in lua STRING AND ARRAYProgramming in lua STRING AND ARRAY
Programming in lua STRING AND ARRAY
vikram mahendra
 
BUilt in Functions and Simple programs in R.pdf
BUilt in Functions and Simple programs in R.pdfBUilt in Functions and Simple programs in R.pdf
BUilt in Functions and Simple programs in R.pdf
karthikaparthasarath
 
arrays.pptx
arrays.pptxarrays.pptx
arrays.pptx
NehaJain919374
 
A brief introduction to apply functions
A brief introduction to apply functionsA brief introduction to apply functions
A brief introduction to apply functions
NIKET CHAURASIA
 
2D array
2D array2D array
2D array
A. S. M. Shafi
 
CLUSTERGRAM
CLUSTERGRAMCLUSTERGRAM
CLUSTERGRAM
Dr. Volkan OBAN
 
chapter1.ppt
chapter1.pptchapter1.ppt
chapter1.ppt
chetanvchaudhari
 
chapter1.ppt
chapter1.pptchapter1.ppt
chapter1.ppt
SankarTerli
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
BilawalBaloch1
 
1sequences and sampling. Suppose we went to sample the x-axis from X.pdf
1sequences and sampling. Suppose we went to sample the x-axis from X.pdf1sequences and sampling. Suppose we went to sample the x-axis from X.pdf
1sequences and sampling. Suppose we went to sample the x-axis from X.pdf
rushabhshah600
 
Basic_analysis.ppt
Basic_analysis.pptBasic_analysis.ppt
Basic_analysis.ppt
SoumyaJ3
 
Python High Level Functions_Ch 11.ppt
Python High Level Functions_Ch 11.pptPython High Level Functions_Ch 11.ppt
Python High Level Functions_Ch 11.ppt
AnishaJ7
 
Basic Analysis using Python
Basic Analysis using PythonBasic Analysis using Python
Basic Analysis using Python
Sankhya_Analytics
 
Python Cheat Sheet Presentation Learning
Python Cheat Sheet Presentation LearningPython Cheat Sheet Presentation Learning
Python Cheat Sheet Presentation Learning
Naseer-ul-Hassan Rehman
 
lect.no.3.pptx
lect.no.3.pptxlect.no.3.pptx
lect.no.3.pptx
ahmed343312
 
Los dskn
Los dsknLos dskn
Los dskn
Brenda Jazmin
 
Python programming workshop session 3
Python programming workshop session 3Python programming workshop session 3
Python programming workshop session 3
Abdul Haseeb
 
2.3 SciPy library explained detialed 1.pptx
2.3 SciPy library explained detialed 1.pptx2.3 SciPy library explained detialed 1.pptx
2.3 SciPy library explained detialed 1.pptx
RaveshRawal
 
matlab presentation fro engninering students
matlab presentation fro engninering studentsmatlab presentation fro engninering students
matlab presentation fro engninering students
SyedSadiq73
 
Data structures KTU chapter2.PPT
Data structures KTU chapter2.PPTData structures KTU chapter2.PPT
Data structures KTU chapter2.PPT
Albin562191
 
Programming in lua STRING AND ARRAY
Programming in lua STRING AND ARRAYProgramming in lua STRING AND ARRAY
Programming in lua STRING AND ARRAY
vikram mahendra
 
BUilt in Functions and Simple programs in R.pdf
BUilt in Functions and Simple programs in R.pdfBUilt in Functions and Simple programs in R.pdf
BUilt in Functions and Simple programs in R.pdf
karthikaparthasarath
 
A brief introduction to apply functions
A brief introduction to apply functionsA brief introduction to apply functions
A brief introduction to apply functions
NIKET CHAURASIA
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
BilawalBaloch1
 
1sequences and sampling. Suppose we went to sample the x-axis from X.pdf
1sequences and sampling. Suppose we went to sample the x-axis from X.pdf1sequences and sampling. Suppose we went to sample the x-axis from X.pdf
1sequences and sampling. Suppose we went to sample the x-axis from X.pdf
rushabhshah600
 
Basic_analysis.ppt
Basic_analysis.pptBasic_analysis.ppt
Basic_analysis.ppt
SoumyaJ3
 
Python High Level Functions_Ch 11.ppt
Python High Level Functions_Ch 11.pptPython High Level Functions_Ch 11.ppt
Python High Level Functions_Ch 11.ppt
AnishaJ7
 
Python Cheat Sheet Presentation Learning
Python Cheat Sheet Presentation LearningPython Cheat Sheet Presentation Learning
Python Cheat Sheet Presentation Learning
Naseer-ul-Hassan Rehman
 
Python programming workshop session 3
Python programming workshop session 3Python programming workshop session 3
Python programming workshop session 3
Abdul Haseeb
 
2.3 SciPy library explained detialed 1.pptx
2.3 SciPy library explained detialed 1.pptx2.3 SciPy library explained detialed 1.pptx
2.3 SciPy library explained detialed 1.pptx
RaveshRawal
 
matlab presentation fro engninering students
matlab presentation fro engninering studentsmatlab presentation fro engninering students
matlab presentation fro engninering students
SyedSadiq73
 
Data structures KTU chapter2.PPT
Data structures KTU chapter2.PPTData structures KTU chapter2.PPT
Data structures KTU chapter2.PPT
Albin562191
 
Ad

More from vikram mahendra (20)

Communication skill
Communication skillCommunication skill
Communication skill
vikram mahendra
 
Python Project On Cosmetic Shop system
Python Project On Cosmetic Shop systemPython Project On Cosmetic Shop system
Python Project On Cosmetic Shop system
vikram mahendra
 
Python Project on Computer Shop
Python Project on Computer ShopPython Project on Computer Shop
Python Project on Computer Shop
vikram mahendra
 
PYTHON PROJECT ON CARSHOP SYSTEM
PYTHON PROJECT ON CARSHOP SYSTEMPYTHON PROJECT ON CARSHOP SYSTEM
PYTHON PROJECT ON CARSHOP SYSTEM
vikram mahendra
 
BOOK SHOP SYSTEM Project in Python
BOOK SHOP SYSTEM Project in PythonBOOK SHOP SYSTEM Project in Python
BOOK SHOP SYSTEM Project in Python
vikram mahendra
 
FLOW OF CONTROL-NESTED IFS IN PYTHON
FLOW OF CONTROL-NESTED IFS IN PYTHONFLOW OF CONTROL-NESTED IFS IN PYTHON
FLOW OF CONTROL-NESTED IFS IN PYTHON
vikram mahendra
 
FLOWOFCONTROL-IF..ELSE PYTHON
FLOWOFCONTROL-IF..ELSE PYTHONFLOWOFCONTROL-IF..ELSE PYTHON
FLOWOFCONTROL-IF..ELSE PYTHON
vikram mahendra
 
FLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHONFLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHON
vikram mahendra
 
OPERATOR IN PYTHON-PART1
OPERATOR IN PYTHON-PART1OPERATOR IN PYTHON-PART1
OPERATOR IN PYTHON-PART1
vikram mahendra
 
OPERATOR IN PYTHON-PART2
OPERATOR IN PYTHON-PART2OPERATOR IN PYTHON-PART2
OPERATOR IN PYTHON-PART2
vikram mahendra
 
USE OF PRINT IN PYTHON PART 2
USE OF PRINT IN PYTHON PART 2USE OF PRINT IN PYTHON PART 2
USE OF PRINT IN PYTHON PART 2
vikram mahendra
 
DATA TYPE IN PYTHON
DATA TYPE IN PYTHONDATA TYPE IN PYTHON
DATA TYPE IN PYTHON
vikram mahendra
 
USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]
USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]
USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]
vikram mahendra
 
USER DEFINE FUNCTIONS IN PYTHON
USER DEFINE FUNCTIONS IN PYTHONUSER DEFINE FUNCTIONS IN PYTHON
USER DEFINE FUNCTIONS IN PYTHON
vikram mahendra
 
FUNCTIONS IN PYTHON[RANDOM FUNCTION]
FUNCTIONS IN PYTHON[RANDOM FUNCTION]FUNCTIONS IN PYTHON[RANDOM FUNCTION]
FUNCTIONS IN PYTHON[RANDOM FUNCTION]
vikram mahendra
 
INTRODUCTION TO FUNCTIONS IN PYTHON
INTRODUCTION TO FUNCTIONS IN PYTHONINTRODUCTION TO FUNCTIONS IN PYTHON
INTRODUCTION TO FUNCTIONS IN PYTHON
vikram mahendra
 
Python Introduction
Python IntroductionPython Introduction
Python Introduction
vikram mahendra
 
GREEN SKILL[PART-2]
GREEN SKILL[PART-2]GREEN SKILL[PART-2]
GREEN SKILL[PART-2]
vikram mahendra
 
GREEN SKILLS[PART-1]
GREEN SKILLS[PART-1]GREEN SKILLS[PART-1]
GREEN SKILLS[PART-1]
vikram mahendra
 
Dictionary in python
Dictionary in pythonDictionary in python
Dictionary in python
vikram mahendra
 
Python Project On Cosmetic Shop system
Python Project On Cosmetic Shop systemPython Project On Cosmetic Shop system
Python Project On Cosmetic Shop system
vikram mahendra
 
Python Project on Computer Shop
Python Project on Computer ShopPython Project on Computer Shop
Python Project on Computer Shop
vikram mahendra
 
PYTHON PROJECT ON CARSHOP SYSTEM
PYTHON PROJECT ON CARSHOP SYSTEMPYTHON PROJECT ON CARSHOP SYSTEM
PYTHON PROJECT ON CARSHOP SYSTEM
vikram mahendra
 
BOOK SHOP SYSTEM Project in Python
BOOK SHOP SYSTEM Project in PythonBOOK SHOP SYSTEM Project in Python
BOOK SHOP SYSTEM Project in Python
vikram mahendra
 
FLOW OF CONTROL-NESTED IFS IN PYTHON
FLOW OF CONTROL-NESTED IFS IN PYTHONFLOW OF CONTROL-NESTED IFS IN PYTHON
FLOW OF CONTROL-NESTED IFS IN PYTHON
vikram mahendra
 
FLOWOFCONTROL-IF..ELSE PYTHON
FLOWOFCONTROL-IF..ELSE PYTHONFLOWOFCONTROL-IF..ELSE PYTHON
FLOWOFCONTROL-IF..ELSE PYTHON
vikram mahendra
 
FLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHONFLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHON
vikram mahendra
 
OPERATOR IN PYTHON-PART1
OPERATOR IN PYTHON-PART1OPERATOR IN PYTHON-PART1
OPERATOR IN PYTHON-PART1
vikram mahendra
 
OPERATOR IN PYTHON-PART2
OPERATOR IN PYTHON-PART2OPERATOR IN PYTHON-PART2
OPERATOR IN PYTHON-PART2
vikram mahendra
 
USE OF PRINT IN PYTHON PART 2
USE OF PRINT IN PYTHON PART 2USE OF PRINT IN PYTHON PART 2
USE OF PRINT IN PYTHON PART 2
vikram mahendra
 
USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]
USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]
USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]
vikram mahendra
 
USER DEFINE FUNCTIONS IN PYTHON
USER DEFINE FUNCTIONS IN PYTHONUSER DEFINE FUNCTIONS IN PYTHON
USER DEFINE FUNCTIONS IN PYTHON
vikram mahendra
 
FUNCTIONS IN PYTHON[RANDOM FUNCTION]
FUNCTIONS IN PYTHON[RANDOM FUNCTION]FUNCTIONS IN PYTHON[RANDOM FUNCTION]
FUNCTIONS IN PYTHON[RANDOM FUNCTION]
vikram mahendra
 
INTRODUCTION TO FUNCTIONS IN PYTHON
INTRODUCTION TO FUNCTIONS IN PYTHONINTRODUCTION TO FUNCTIONS IN PYTHON
INTRODUCTION TO FUNCTIONS IN PYTHON
vikram mahendra
 
Ad

Recently uploaded (20)

Agile Software Engineering Methodologies
Agile Software Engineering MethodologiesAgile Software Engineering Methodologies
Agile Software Engineering Methodologies
Gaurav Sharma
 
Top 5 Task Management Software to Boost Productivity in 2025
Top 5 Task Management Software to Boost Productivity in 2025Top 5 Task Management Software to Boost Productivity in 2025
Top 5 Task Management Software to Boost Productivity in 2025
Orangescrum
 
COBOL Programming with VSCode - IBM Certificate
COBOL Programming with VSCode - IBM CertificateCOBOL Programming with VSCode - IBM Certificate
COBOL Programming with VSCode - IBM Certificate
VICTOR MAESTRE RAMIREZ
 
dp-700 exam questions sample docume .pdf
dp-700 exam questions sample docume .pdfdp-700 exam questions sample docume .pdf
dp-700 exam questions sample docume .pdf
pravkumarbiz
 
Code and No-Code Journeys: The Coverage Overlook
Code and No-Code Journeys: The Coverage OverlookCode and No-Code Journeys: The Coverage Overlook
Code and No-Code Journeys: The Coverage Overlook
Applitools
 
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptxIMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
usmanch7829
 
GDG Douglas - Google AI Agents: Your Next Intern?
GDG Douglas - Google AI Agents: Your Next Intern?GDG Douglas - Google AI Agents: Your Next Intern?
GDG Douglas - Google AI Agents: Your Next Intern?
felipeceotto
 
FME as an Orchestration Tool - Peak of Data & AI 2025
FME as an Orchestration Tool - Peak of Data & AI 2025FME as an Orchestration Tool - Peak of Data & AI 2025
FME as an Orchestration Tool - Peak of Data & AI 2025
Safe Software
 
How the US Navy Approaches DevSecOps with Raise 2.0
How the US Navy Approaches DevSecOps with Raise 2.0How the US Navy Approaches DevSecOps with Raise 2.0
How the US Navy Approaches DevSecOps with Raise 2.0
Anchore
 
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Natan Silnitsky
 
DevOps for AI: running LLMs in production with Kubernetes and KubeFlow
DevOps for AI: running LLMs in production with Kubernetes and KubeFlowDevOps for AI: running LLMs in production with Kubernetes and KubeFlow
DevOps for AI: running LLMs in production with Kubernetes and KubeFlow
Aarno Aukia
 
Top 11 Fleet Management Software Providers in 2025 (2).pdf
Top 11 Fleet Management Software Providers in 2025 (2).pdfTop 11 Fleet Management Software Providers in 2025 (2).pdf
Top 11 Fleet Management Software Providers in 2025 (2).pdf
Trackobit
 
Migrating to Azure Cosmos DB the Right Way
Migrating to Azure Cosmos DB the Right WayMigrating to Azure Cosmos DB the Right Way
Migrating to Azure Cosmos DB the Right Way
Alexander (Alex) Komyagin
 
How Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines OperationsHow Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines Operations
Insurance Tech Services
 
Integration Ignited Redefining Event-Driven Architecture at Wix - EventCentric
Integration Ignited Redefining Event-Driven Architecture at Wix - EventCentricIntegration Ignited Redefining Event-Driven Architecture at Wix - EventCentric
Integration Ignited Redefining Event-Driven Architecture at Wix - EventCentric
Natan Silnitsky
 
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free DownloadWondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Puppy jhon
 
Integrating Survey123 and R&H Data Using FME
Integrating Survey123 and R&H Data Using FMEIntegrating Survey123 and R&H Data Using FME
Integrating Survey123 and R&H Data Using FME
Safe Software
 
Porting Qt 5 QML Modules to Qt 6 Webinar
Porting Qt 5 QML Modules to Qt 6 WebinarPorting Qt 5 QML Modules to Qt 6 Webinar
Porting Qt 5 QML Modules to Qt 6 Webinar
ICS
 
The Future of Open Source Reporting Best Alternatives to Jaspersoft.pdf
The Future of Open Source Reporting Best Alternatives to Jaspersoft.pdfThe Future of Open Source Reporting Best Alternatives to Jaspersoft.pdf
The Future of Open Source Reporting Best Alternatives to Jaspersoft.pdf
Varsha Nayak
 
Software Testing & it’s types (DevOps)
Software  Testing & it’s  types (DevOps)Software  Testing & it’s  types (DevOps)
Software Testing & it’s types (DevOps)
S Pranav (Deepu)
 
Agile Software Engineering Methodologies
Agile Software Engineering MethodologiesAgile Software Engineering Methodologies
Agile Software Engineering Methodologies
Gaurav Sharma
 
Top 5 Task Management Software to Boost Productivity in 2025
Top 5 Task Management Software to Boost Productivity in 2025Top 5 Task Management Software to Boost Productivity in 2025
Top 5 Task Management Software to Boost Productivity in 2025
Orangescrum
 
COBOL Programming with VSCode - IBM Certificate
COBOL Programming with VSCode - IBM CertificateCOBOL Programming with VSCode - IBM Certificate
COBOL Programming with VSCode - IBM Certificate
VICTOR MAESTRE RAMIREZ
 
dp-700 exam questions sample docume .pdf
dp-700 exam questions sample docume .pdfdp-700 exam questions sample docume .pdf
dp-700 exam questions sample docume .pdf
pravkumarbiz
 
Code and No-Code Journeys: The Coverage Overlook
Code and No-Code Journeys: The Coverage OverlookCode and No-Code Journeys: The Coverage Overlook
Code and No-Code Journeys: The Coverage Overlook
Applitools
 
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptxIMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
usmanch7829
 
GDG Douglas - Google AI Agents: Your Next Intern?
GDG Douglas - Google AI Agents: Your Next Intern?GDG Douglas - Google AI Agents: Your Next Intern?
GDG Douglas - Google AI Agents: Your Next Intern?
felipeceotto
 
FME as an Orchestration Tool - Peak of Data & AI 2025
FME as an Orchestration Tool - Peak of Data & AI 2025FME as an Orchestration Tool - Peak of Data & AI 2025
FME as an Orchestration Tool - Peak of Data & AI 2025
Safe Software
 
How the US Navy Approaches DevSecOps with Raise 2.0
How the US Navy Approaches DevSecOps with Raise 2.0How the US Navy Approaches DevSecOps with Raise 2.0
How the US Navy Approaches DevSecOps with Raise 2.0
Anchore
 
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Natan Silnitsky
 
DevOps for AI: running LLMs in production with Kubernetes and KubeFlow
DevOps for AI: running LLMs in production with Kubernetes and KubeFlowDevOps for AI: running LLMs in production with Kubernetes and KubeFlow
DevOps for AI: running LLMs in production with Kubernetes and KubeFlow
Aarno Aukia
 
Top 11 Fleet Management Software Providers in 2025 (2).pdf
Top 11 Fleet Management Software Providers in 2025 (2).pdfTop 11 Fleet Management Software Providers in 2025 (2).pdf
Top 11 Fleet Management Software Providers in 2025 (2).pdf
Trackobit
 
How Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines OperationsHow Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines Operations
Insurance Tech Services
 
Integration Ignited Redefining Event-Driven Architecture at Wix - EventCentric
Integration Ignited Redefining Event-Driven Architecture at Wix - EventCentricIntegration Ignited Redefining Event-Driven Architecture at Wix - EventCentric
Integration Ignited Redefining Event-Driven Architecture at Wix - EventCentric
Natan Silnitsky
 
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free DownloadWondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Puppy jhon
 
Integrating Survey123 and R&H Data Using FME
Integrating Survey123 and R&H Data Using FMEIntegrating Survey123 and R&H Data Using FME
Integrating Survey123 and R&H Data Using FME
Safe Software
 
Porting Qt 5 QML Modules to Qt 6 Webinar
Porting Qt 5 QML Modules to Qt 6 WebinarPorting Qt 5 QML Modules to Qt 6 Webinar
Porting Qt 5 QML Modules to Qt 6 Webinar
ICS
 
The Future of Open Source Reporting Best Alternatives to Jaspersoft.pdf
The Future of Open Source Reporting Best Alternatives to Jaspersoft.pdfThe Future of Open Source Reporting Best Alternatives to Jaspersoft.pdf
The Future of Open Source Reporting Best Alternatives to Jaspersoft.pdf
Varsha Nayak
 
Software Testing & it’s types (DevOps)
Software  Testing & it’s  types (DevOps)Software  Testing & it’s  types (DevOps)
Software Testing & it’s types (DevOps)
S Pranav (Deepu)
 

Programs in array using SWIFT

  • 2. INDEX S.NO. PROGRAMS SIGNATURE 1 Program to print the numbers in an array horizontally 2 Program to search the number from a 1 D array using linear search 3 Program to search the number from a 1 D array using binary search 4 Program to insert the number in a 1 D array using Insertion sorted array 5 Program to insert the number in a 1 D array using Deletion sorted array 6 Program to sort the number in an array using bubble sort 7 Program to sort the number in an array using selection sort 8 Write a function Alter(), with array and size as a parameter ,which should change all the multiples of 5 in the array to 5 and rest of the element as 1 9 Write a function modify() with array and size as a parameter, which should reposition the content after swapping each adjacent pair of number in it 10 Write a function Large() with array and size as a parameter, which should display the largest and second largest by returning both from an array 11 Write a function addup() with array and size as a parameter,in which all even position(0,2,4,…..) of the array should be added with the content of element in the next position and odd position(1,3,5,…..) elements should be increment by 10 12 Write a function twotoone() with array and size as an parameters,in which accept two array X[] and Y[] and transfer all X[] numbers in even places of Z[] and all Y[] numbers in odd places of Z[]. 13 Write a function convert() with array and size as a parameter,which reposition all the elements of the array by shifting each of them one to one position before and by shifting the first elements to the last position 14 Write a function SWAP() with array and size as a parameter,which swap the numbers on the basis of example given: If array A no : 10,20,30,40,50,60 the output after swapping 20,10,40,30,60,50 15 Write a function SWAP2() with array and size as a parameter,which swap the numbers on the basis of example given: If array A no : 10,20,30,40,50,60 the output after swapping 40,50,60,10,20,30 16 Write a function merge() with three array as a parameter array A,B, and C with their size M , N , and M+N , where A is ascending order , B is descending order and C accept numbers from A and B in ascending order. 17 Write a function dispTen() with 2D array no and size as a parameter and display only those numbers which are divisible by 10 18 Write a function rowsum() with 2D array A and size as a parameter and display the sum of each row
  • 3. 20 Write a function diagonalsum() with 2D array A and size as a parameter and display the sum 21 program to find the largest no from a 1D array of 10 numbers 22 Write a function swaparr() with 2D array A and size as a parameter and swap or interchange the first row with the last row elements. 23 Write a function lefttrg() with 2D array A and size as a parameter and display the output as given Example: output 1 2 3 4 6 4 5 6 6 2 1 5 4 2 1 1 2 3 5 1 2 3 24 Write a function summatrix() with 2D array A , B , C and size as a parameter, and display the sum of two matrix in C 25 Write a function copyarr() with 2D array A and B as 1D array and size as a parameter,display the output as given below: Example: if array B values are 1,2,3,4,5 Array A store values as: 1,2,3,4,5 1,2,3,4,0 1,2,3,0,0 1,2,0,0,0 1,0,0,0,0
  • 4. //Program to print the numbers in an array horizontally func display(no:[Int], k:Int) { var x = 0 while x < k { print("(no[x]), ",terminator:"") x = x + 1 } print("") } var n:[Int] = [10,20,30,40,50,60,70,80,90,100 ] display(no:n, k:10) ----------------------------output ---------------------------------- 10, 20, 30, 40, 50, 60, 70, 80, 90, 100,
  • 5. // Program to search the number from a 1 D array using linear search func lsearch(no:[Int], src:Int, k:Int) -> Int { var tmp = -1 var x = 0 while x < k { if no[x] == src { tmp = x break } x = x + 1 } return tmp } var n:[Int] = [40,10,51,86,19,87,70,3,14,100 ] var rs = lsearch(no:n, src:19, k:10) if rs < 0 { print("no not found") }else { rs = rs + 1 print("no found at pos =(rs)") } --------------------------output---------------------------- no found at pos =5
  • 6. // Program to search the number from a 1 D array using binary search func bsearch(no:[Int], src:Int, k:Int) -> Int { var tmp = -1 var x = 0 var beg = 0 , last = k - 1 , mid = 0 while beg < last { mid = (beg + last) / 2 if no[mid] == src { tmp = x break }else { if no[mid] > src { last = mid - 1 }else { beg = mid + 1 } } x = x + 1 } return tmp } var n:[Int] = [40,45,58,75,86,89,92,97,99,120] var rs = bsearch(no:n, src:58, k:10) if rs < 0 { print("no not found") }else { rs = rs + 1 print("no found at pos =(rs)") } ---------------output------------------ no found at pos =3
  • 7. // Program to insert the number in a 1 D array using Insertion sorted array func insertionUN(no:[Int],ser:Int,k:Int) -> Int { var pos:Int = -1 var flag = -1 var x = 0 let last = k - 1 while x < k { if no[0] >= ser { flag = 0 pos = 0 break }else if no[last] <= ser { pos = last flag = 1 break; } else if no[x] < ser && no[x + 1] > ser { flag = 2 pos = x + 1 break } x = x + 1 } if flag == 0 { pos = 0 }else if flag == 1 { pos = pos + 1 } return pos }
  • 8. var search = 67 print("before insertion") var n:[Int] = [10,20,30,40,50,60,70,80] var k1 = insertionUN(no:n, ser:search, k:n.count) print("after insertion") n.insert(search,at:k1) print(n) ----------------------------output------------------------------ before insertion [10, 20, 30, 40, 50, 60, 70, 80] after insertion [10, 20, 30, 40, 50, 60, 67, 70, 80]
  • 9. // Program to insert the number in a 1 D array using Deletion sorted array func deletionUN(no:[Int],ser:Int,k:Int) -> Int { var pos:Int = -1 var x = 0 while x < k { if no[x] == ser { pos = x break } x = x + 1 } return pos } var search = 40 var y = 0 var n:[Int] = [10,20,30,40,50,60,70,80] print("before deletion array size = (n.count)") print(n) var k1 = deletionUN(no:n, ser:search, k:n.count) if k1 > 0 { y = k1 while y < n.count - 1 { n[y] = n[y + 1] y = y + 1 } } n.remove(at:n.count - 1) print("after deletion array size =(n.count)") print(n) -------output---------------- before deletion array size = 8 [10, 20, 30, 40, 50, 60, 70, 80] after deletion array size =7 [10, 20, 30, 50, 60, 70, 80]
  • 10. // Program to sort the number in an array using bubble sort func sortbubble(no:inout [Int],k:Int) { var x = 0 , y = 0 var tmp = 0 while x < k { y = 0 while y < k - 1 { if no[y] > no[y + 1] { tmp = no[y] no[y] = no[y + 1] no[y + 1] = tmp } y = y + 1 } x = x + 1 } } var n:[Int] = [60,2,33,55,5,22,1,8] print("before sorting array ") print(n) sortbubble(no: &n, k:n.count) print("after sorting array") print(n) ----------------------------------output------------------------------------ before sorting array [60, 2, 33, 55, 5, 22, 1, 8] after sorting array [1, 2, 5, 8, 22, 33, 55, 60]
  • 11. // Program to sort the number in an array using selection sort func sortselection(no:inout [Int],k:Int) { var x = 0 , y = 0 var tmp = 0 while x < k { y = x + 1 while y < k { if no[x] > no[y] { tmp = no[x] no[x] = no[y] no[y] = tmp } y = y + 1 } x = x + 1 } } var n:[Int] = [60,2,33,55,5,22,1,8] print("before sorting array ") print(n) sortselection(no: &n, k:n.count) print("after sorting array") print(n) -----------------------------output------------------------------ before sorting array [60, 2, 33, 55, 5, 22, 1, 8] after sorting array [1, 2, 5, 8, 22, 33, 55, 60]
  • 12. /* Write a function Alter(), with array and size as a parameter ,which should change all the multiples of 5 in the array to 5 and rest of the element as 1 */ func alter(no:inout [Int],k:Int) { var x = 0 while x < k { if no[x] % 5 == 0 { no [x] = 5 }else { no[x] = 1 } x = x + 1 } } var n:[Int] = [55,43,20,16,39,90,83,40,48,25] print("before ") print(n) alter(no: &n, k:n.count) print("after") print(n) ------------------------output----------------------------- before [55, 43, 20, 16, 39, 90, 83, 40, 48, 25] after [5, 1, 5, 1, 1, 5, 1, 5, 1, 5]
  • 13. /* Write a function modify() with array and size as a parameter, which should reposition the content after swapping each adjacent pair of number in it */ func modify(no:inout [Int],k:Int) { var x = 0 , tmp = 0 while x < k { tmp = no[x] no[x] = no[x + 2] no[x + 2] = tmp if x % 4 >= 1 { x = x + 2 } x = x + 1 } } var n:[Int] = [86,93,40,36,52,21,70,10] print("before ") print(n) modify(no: &n, k:n.count) print("after") print(n) ----------------------------output------------------------------------------------- before [86, 93, 40, 36, 52, 21, 70, 10] after [40, 36, 86, 93, 70, 10, 52
  • 14. /*Write a function Large() with array and size as a parameter, which should display the largest and second largest by returning both from an array.*/ func large(no:inout [Int],k:Int) -> ( Int , Int ) { var x = 0 , l = no[0] , sec1 = no[0] while x < k { if no[x] > l { sec1 = l l = no[x] }else if no[x] > sec1 { sec1 = no[x] } x = x + 1 } return (l , sec1) } var n:[Int] = [86,93,40,136,52,21,70,10] var (k , s ) = large(no: &n, k:n.count) print("Largest no = (k) and second large = (s)") --------------------------------output------------------------------------ Largest no = 136 and second large = 93
  • 15. /* Write a function addup() with array and size as a parameter,in which all even position(0,2,4,…..) of the array should be added with the content of element in the next position and odd position(1,3,5,…..) elements should be increment by 10 */ func addup(no:inout [Int] , k:Int) { var x:Int = 0 while x < k { if no[x] % 2 == 0 { no[x] = no[x] + no[x + 1] }else { no[x] = no[x] + 10 } x = x + 1 } } var n:[Int] = [23,30,45,10,15,25,45,10,56,78,33] print("before ") print(n) addup(no: &n, k:n.count) print("after") print(n) ----------------------------output-------------------------------- before [23, 30, 45, 10, 15, 25, 45, 10, 56, 78, 33] after [33, 75, 55, 25, 25, 35, 55, 66, 134, 111, 43]
  • 16. /* Write a function twotoone() with array and size as an parameters,in which accept two array X[] and Y[] and transfer all X[] numbers in even places of Z[] and all Y[] numbers in odd places of Z[]. */ func twotoone(z:inout [Int] ,x:[Int] ,y:[Int] , k:Int) { var a:Int = 0 , b:Int = 0 var c:Int = 0 while c < k { if c % 2 == 0 { z.insert(x[a],at:c) a = a + 1 }else { z.insert(y[b],at:c) b = b + 1 } c = c + 1 }} var Z:[Int] = [] var X:[Int] = [10,20,30,40,50] var Y:[Int] = [11,12,13,14,15] print("before array Z") print(Z) print("before array X") print(X) print("before array Y") print(Y) twotoone(z:&Z, x:X, y:Y, k:10) print("after") print(Z) ---------------output--------------------- before array Z [] before array X [10, 20, 30, 40, 50] before array Y [11, 12, 13, 14, 15] After array Z [10, 11, 20, 12, 30, 13, 40, 14, 50, 15]
  • 17. /* Write a function convert() with array and size as a parameter,which reposition all the elements of the array by shifting each of them one to one position before and by shifting the first elements to the last position*/ func convert(no:inout [Int] ,k:Int ,size:Int) { var tmp:Int = 0 var last:Int = size - 1 var x:Int = 1 var y:Int = 0 while x <= k { tmp = no[0] y = 0 while y < size - 1 { no[y] = no[y + 1] y = y + 1 } no[last] = tmp x = x + 1 } } var X:[Int] = [10,20,30,40,50,60,70,80] print("before") print(X) convert(no: &X, k:2, size:X.count) print("After") print(X) --------------------------------------output---------------------------------------- before [10, 20, 30, 40, 50, 60, 70, 80] After [30, 40, 50, 60, 70, 80, 10, 20]
  • 18. /*Write a function SWAP() with array and size as a parameter,which swap the numbers on the basis of example given: If array A no : 10,20,30,40,50,60 the output after swapping 20,10,40,30,60,50 */ func swap(no:inout [Int] ,size:Int) { var tmp:Int = 0 var y:Int = 0 while y < size - 1 { tmp = no[y] no[y] = no[y + 1] no[y + 1] = tmp y = y + 2 } } var X:[Int] = [10,20,30,40,50,60] print("before") print(X) swap(no: &X, size:X.count) print("After") print(X) ------------------------------output--------------------------- before [10, 20, 30, 40, 50, 60] After [20, 10, 40, 30, 60, 50]
  • 19. /*Write a function SWAP2() with array and size as a parameter,which swap the numbers on the basis of example given: If array A no : 10,20,30,40,50,60 the output after swapping 40,50,60,10,20,30 */ func swap2(no:inout [Int] ,size:Int) { var tmp:Int = 0 var y:Int = 0 var x:Int = size / 2 while y < size / 2 { tmp = no[y] no[y] = no[x] no[x] = tmp y = y + 1 x = x + 1 } } var X:[Int] = [10,20,30,40,50,60] print("before") print(X) swap(no: &X, size:X.count) print("After") print(X) ---------------------------output--------------------------- before [10, 20, 30, 40, 50, 60] After [40, 50, 60, 10, 20, 30]
  • 20. /* Write a function merge() with three array as a parameter array A,B, and C with their size M , N , and M+N , where A is ascending order , B is descending order and C accept numbers from A and B in ascending order. */ func merge(A1:[Int],B1:[Int],C1:inout [Int], M:Int, N:Int) { var x = 0 var a = 0 var k = 0 // var y = ( M + N ) - 1 var y = N - 1 while x < M && y >= 0 { if A1[x] <= B1[y] { C1.append(A1[x]) k = k + 1 x = x + 1 }else { C1.append(B1[y]) k = k + 1 y = y - 1 } } if x < M { a = x while a < M { C1.append(A1[a]) a = a + 1 } } if y >= 0 {
  • 21. a = y while a >= 0 { C1.append(B1[a]) a = a - 1 } } } var A:[Int] = [1,2,3,4,5,6,9,10,12] var B:[Int] = [9,8,7,5,3,2,1] var C:[Int] = [] print("before A") print(A) print("b numbers") print(B) merge(A1: A,B1: B,C1: &C,M:A.count , N:B.count) print("After") print(C) ----------------------------------output-------------------------------------- before A [1, 2, 3, 4, 5, 6, 9, 10, 12] b numbers [9, 8, 7, 5, 3, 2, 1] After [1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 7, 8, 9, 9, 10, 12
  • 22. /* Write a function dispTen() with 2D array A and size as a parameter and display only those numbers which are divisible by 10 */ func dispTen(n: [[Int]], size:Int) { var x = 0 , y = 0 while x < size { y = 0 while y < size { if n[x][y] % 10 == 0 { print("(n[x][y]), ",terminator:"") } y = y + 1 } x = x + 1 } print("") } var no:[[Int]] = [[12,20,13],[2,10,30],[40,5,16]] dispTen(n:no,size:no.count) ----------------------------output----------------------------------- 20, 10, 30, 40,
  • 23. // Write a function rowsum() with 2D array A and size as a parameter and display the sum of each row func rowsum(n: [[Int]], size:Int) { var x = 0 , y = 0 var sum = 0 while x < size { y = 0 sum = 0 while y < size { sum = sum + n[x][y] print("(n[x][y]) +",terminator:"") y = y + 1 } x = x + 1 print("=(sum)n",terminator:"") } print("") } var no:[[Int]] = [[12,20,13],[2,10,30],[40,5,16]] rowsum(n:no,size:no.count) ----------------------output------------------------------ 12 +20 +13 =45 2 +10 +30 =42 40 +5 +16 =61
  • 24. // Write a function diagonalsum() with 2D array A and size as a parameter and display the sum func diagonalsum(A1:inout [[Int]] , k:Int) -> Int { var x:Int = 0 , y:Int = 0 var lsum = 0 , rsum = 0 while x < k { y = 0 while y < k { if x == y { lsum = lsum + A1[x][y] }else if x + y == k - 1 { rsum = rsum + A1[x][y] } y = y + 1 } x = x + 1 } return lsum + rsum } var A:[[Int]] = [[4,5,6],[7,8,9],[1,2,3]] print("before array A") print(A) var rs = diagonalsum (A1:&A, k:A.count) print(“sum of diagonal =(rs)”) -----------------------------output-------------------------------- before array A [[4, 5, 6], [7, 8, 9], [1, 2, 3]] Sum of diagonal = 22
  • 25. //program to find the largest no from a 1D array of 10 numbers func largest(no:[Int], k:Int) -> Int { var large = no[0] var x = 0 while x < k { if no[x] > large { large = no[x] } x = x + 1 } return large } var n:[Int] = [51, 21, 30, 45, 75, 15, 2, 56, 120, 11 ] var rs = largest(no:n, k:10) print("largest no = (rs)") ------------------------output------------------------------- Largest no = 120
  • 26. /*Write a function swaparr() with 2D array A and size as a parameter and swap or interchange the first row with the last row elements.*/ func display(tmp:[[Int]], size:Int) { var x = 0 , y = 0 while x < size { y = 0 while y < size { print("(tmp[x][y]) , ",terminator:"") y = y + 1 } x = x + 1 print("n") } print("") } func swaparr (A1:inout [[Int]] , k:Int) { var a = 0 , last = k - 1 var t = 0 while a < k { t = A1[0][a] A1[0][a] = A1[last][a] A1[last][a] = t a = a + 1 } } var A:[[Int]] = [[5,6,2,3],[1,2,4,9],[2,5,8,1],[9,7,5,8]] print("before") display(tmp:A,size:A.count) swaparr(A1:&A,k:A.count) print("after") display(tmp:A,size:A.count) -----------------------output-------------------------------------- before 5 , 6 , 2 , 3 1 , 2 , 4 , 9 2 , 5 , 8 , 1 9 , 7 , 5 , 8 after 9 , 7 , 5 , 8 1 , 2 , 4 , 9 2 , 5 , 8 , 1 5 , 6 , 2 , 3
  • 27. /* Write a function lefttrg() with 2D array A and size as a parameter and display lower triangle as the output given Example: output 1 2 3 4 6 4 5 6 6 2 1 5 4 2 1 1 2 3 5 1 2 3 */ func display(tmp:[[Int]], size:Int) { var x = 0 , y = 0 while x < size { y = 0 while y < size { print("(tmp[x][y]) , ",terminator:"") y = y + 1 } x = x + 1 print("n") } print("") } func lfttrg(z:[[Int]] , k:Int) { var a = 0 , b = 0 var t = 0 while a < k { b = 0 while b < k { if a > b { print("(z[a][b]) , ",terminator:"") } b = b + 1 }
  • 28. print("n",terminator:"") a = a + 1 } print("") } var A:[[Int]] = [[1,2,3,4],[6,4,5,6],[2,1,5,4],[1,2,3,5]] print("before") display(tmp:A,size:A.count) print("lower triangle") lfttrg(z:A,k:A.count) -----------------------------output--------------------------- before 1 , 2 , 3 , 4 6 , 4 , 5 , 6 2 , 1 , 5 , 4 1 , 2 , 3 , 5 lower triangle 6 2 , 1 1 , 2 , 3
  • 29. /* Write a function summatrix() with 2D array A , B , C and size as a parameter, and display the sum of two matrix in C */ func display(tmp:[[Int]], size:Int) { var x = 0 , y = 0 while x < size { y = 0 while y < size { print("(tmp[x][y]) , ",terminator:"") y = y + 1 } x = x + 1 print("n") } print("") } func summat(A1:[[Int]], B1:[[Int]], C1:inout [[Int]], size:Int) { var x = 0 , y = 0 var sum = 0 while x < size { y = 0 while y < size { sum = A1[x][y] + B1[x][y] C1[x][y] = sum y = y + 1 } x = x + 1 } } var A:[[Int]] = [[1,2,3],[1,2,3],[1,2,3]] var B:[[Int]] = [[4,5,6],[4,5,6],[4,5,6]] var C:[[Int]] = [[Int]](repeating:[Int] (repeating: 0, count: 3), count: 3) print("Array A") display(tmp:A,size:A.count) print("Array B") display(tmp:B,size:B.count) summat(A1:A,B1:B,C1:&C,size:3) print("Array C") display(tmp:C,size:C.count) --------------------output----------------------- Array C 5 , 7 , 9 , 5 , 7 , 9 , 5 , 7 , 9 , ---------------------output-------------------------- Array A 1 , 2 , 3 , 1 , 2 , 3 , 1 , 2 , 3 , Array B 4 , 5 , 6 , 4 , 5 , 6 , 4 , 5 , 6 ,
  • 30. /* Write a function copyarr() with 2D array A and B as 1D array and size as a parameter,display the output as given below: Example: if array B values are 1,2,3,4,5 Array A store values as: 1,2,3,4,5 1,2,3,4,0 1,2,3,0,0 1,2,0,0,0 1,0,0,0,0 */ func display(tmp:[[Int]], size:Int) { var x = 0 , y = 0 while x < size { y = 0 while y < size { print("(tmp[x][y]) , ",terminator:"") y = y + 1 } x = x + 1 print("n") } print("") } func copyarr(A1:inout [[Int]] , B1:[Int] , k:Int) { var x = 0 , y = 0 while x < k { y = 0 while y < k { if x + y < k { A1[x][y] = B1[y]
  • 31. }else { A1[x][y] = 0 } y = y + 1 } x = x + 1 } } var B:[Int] = [10,20,30,40,50] var A:[[Int]] = [[Int]](repeating:[Int] (repeating: 0, count: B.count), count: B.count) print("before array B") print(B) copyarr(A1:&A, B1:B, k:B.count) print("after array A") display(tmp:A,size:A.count) --------------------output-------------------------- before array B [10, 20, 30, 40, 50] After array A 10 20 30 40 50 10 20 30 40 0 10 20 30 0 0 10 20 0 0 0 10 0 0 0 0