COMPUTATIONAL THINIKING LAB MANUAL Updated 2022-2023 Final Copy-Updated
COMPUTATIONAL THINIKING LAB MANUAL Updated 2022-2023 Final Copy-Updated
LAB MANUAL
LAB TASKS
TASK
NAME OF TASK CO
NO
1 Sum of N Natural Numbers/ Factorial Computation CO1
Logic: The algorithm uses a simple loop to iterate from 0 to n, adding each natural number to the
sum variable. The loop continues until i exceeds n, at which point the final value of sum is printed.
Time Complexity:
The time complexity of this algorithm is O(n), because it needs to iterate n times to calculate the sum.
Space Complexity:
The space complexity of this algorithm is O(1), because it only uses a constant amount of space to
store the variables sum, i, and n.
RESULT:
Hence the algorithm and flowchart for sum of n natural numbers is verified and proved.
TASK (1.B)- FACTORIAL COMPUTATION
AIM: To compute factorial of a given number
ALGORITHM DEVELOPMENT:
n! = 1x2x3x…. (n-1) x n for n>=1
0! =1 1!= 1x1
2! =1x2
3! =1x2x3
4! =1x2x3x4
n! = n x (n-1)! For n>=1
ALGORITHM:
Step 1: Start
Step 2: Read the value of n
Step 3: Initialize the variable fact to 1
Step 4: Initialize the variable i to 1
Step 5: Compute fact = fact * i
Step 6: Increment i by 1
Step 7: Check whether i<=n
If the condition is true go to step 5
Step 8: Display p
Step 9: Stop
FLOWCHART:
Formula:
The formula for computing the factorial of n is:
n! = n × (n-1)!
This formula can be recursively applied to compute the factorial of any positive integer n.
Pseudocode:
function factorial(n) {
if (n <= 1) {
return 1;
} else {
return n * factorial(n-1);
}
}
Logic:
The algorithm uses a recursive approach to compute the factorial of n. The base cases are handled separately,
and the recursive case is used to compute the factorial of n-1 and multiply it by n.
Time Complexity: The time complexity of this algorithm is O(n), since it needs to recursively call itself n times
to compute the factorial.
Space Complexity: The space complexity of this algorithm is O(n), since it needs to store the recursive calls on
the call stack. However, if we use an iterative approach instead of recursion, the space complexity would be
O(1).
ALGORITHM VERIFICATION:
Steps n fact= fact * i i=i+1 i<=n
1 5 Initialize fact = 1 Initialize i=1 1<=5 yes
2 1 2 2<=5 yes
3 2 3 3<=5 yes
4 6 4 4<=5 yes
5 24 5 5<=5 yes
6 120 6 6<=5 no
Logic:
The algorithm uses a loop to iteratively compute the terms in the sine series, starting from x and
alternating between adding and subtracting terms. The loop continues until the absolute value of the
new term is less than or equal to the error threshold.
Time Complexity: The time complexity of this algorithm is O(n), where n is the number of terms in the
series that need to be computed.
Space Complexity: The space complexity of this algorithm is O(1), since it only uses a constant amount
of space to store the variables tsin, i, term, and error.
FLOW CHART
START
Read x
tsin = x
i=1
term=x
error = 0.0001
Term=term + I
Term= -1+x+x/i[i-1]
Tsin=tsin + term
term >
error
Display tsin
ALGORITHM VERIFICATION:
Sample input: x=0.5
STEPS x Tsin i Error t | t| error
2 0.5
3 0.5
4 1
5 0.00001
6 0.5
7 3
8 -0.02
9 0.48
10 No
7 5
8 0.00025
9 0.48025
10 No
7 7
8 0.000014
9 0.48024
10 Yes
11 0.48024
Sample Output: 0.48024
RESULT: Hence the algorithm and flowchart the sine series computation logic is analysed and studied.
Step 1: Start
Step 2: Read the value of N (number of persons)
Step 3: Compute nominee = random (1,n)
Step 4 : Initialize count to 0 and i to 1.
Step 5 : Check whether i not nominee if yes goto step 6 else goto step 9.
Step 6 : Read hands value.
Step 7 : Check whether hands=1 (raised) if yes goto step 8 else goto step 9.
Step 8 : Increment count by 1.
Step 9 : Check whether i=n, if yes goto step 10, else i=i+1 goto step 5.
Step 10 : Check whether count >n/2 if yes goto step 11, else step 12.
Step 11 : Display “argument wins” goto step 13
Step 12 : Display “argument loses”
Step 13 : Stop
FLOW CHART
ALGORITHM VERIFICATION:
STEPS n Nominee Count i hand i=nominee hands=1 i=n Count>n/2
2 5
3 2
4 0 1
5 No
6 1
7 Yes
8 1
9 2 No
5 Yes
9 3
5 No No
6 1
7 Yes
8 2
9 4
5 No No
6
7 Yes
8 3
9 5
10 Yes
Input = 5
Output: Argument wins
RESULT:
Hence the algorithm and flowchart for show of hands is verified.
TASK (3.A) - MAXIMUM NUMBER OF A LIST
AIM: To find the maximum number in a set of N numbers sorted as an array
ALGORITHM:
Step 1: Start
Step 2: Create an array with n element
Step 3: Initialize index[i] = 0
Step 4: Set maximum to a[0]
Step 5: Repeat step 6 by varying i from 1 to (n-1)
Step 6: Check if a[i]>Maximum, if yes set maximum = a[i]
Step 7: Display maximum
Step 8: Stop
ALGORITHM VERIFICATION:
Start
Maximum a[0]
I1
A[i]>
max Maxa[1]
I=i+1
I<n-1
Display max
End
Start
I1
A[i-1]!a[i]
and i<n-1
I=i+1
11
Set j=j-1
I<n-1
Stop
i-1!a[i]
J=j+1
A[j]=a[i]
RESULT: Thus the duplicates from ordered array is verified and proved
TASK (4.A): PARTITION ARRAY
AIM:
Given a randomly ordered array of n elements, partition the elements into two subset such that elements
<=x are in one subset and elements > x are in the other subset.
j
Variables:
1. i - to traverse from left to right (current upper boundary)
2. j – to traverse from right to left (current lower boundary)
3. x- as given in question. (INPUT)
4. t- temporary variable for exchange
5. Array ‘a’ to store given values - input
6. n- Number of elements in the given list. - input
7. p- partitioning point in the list (output)
PROGRAM LOGIC:
Step 1: Establish an array a of [0 to n-1] and read the partitioning value ‘x’.
Step 2: Move partitions to each other until a wrongly placed pair of elements are uncounted.
Step 3: While the two partitions have not met or crossed over do the following.
a) Exchange the wrongly partitioned pair and extend the partition inwards by one element.
b) Extend the left partition while the element is less than or equal to x(<=x).
c) Extend the right partition while the element are greater than x.
Step 4: Write the partitioning index p and the partitioned array.
ALGORITHM:
Step 1: Start
Step 2: Create an array a of n elements (a[0….n-1])
Step 3: Read the partitioning value i.e. x
Step 4: Initialise i to 0, j to n-1
Step 5: Repeat Step 6 as long as a[i]<=x and i<j
Step 6: Increment I by 1
Step 7: Repeat Step 8 as long as a[j]>x and i<j
Step 8: Decrement j by 1.
Step 9: Repeat Steps(10 to 18) as long as i<j
Step 10: Assign a[i] to t
Step 11: Assign a[j] to a[i]
Step 12: Assign t to a[j]
Step 13: Increment I by 1
Step 14: Decrement j by 1
Step 15: Repeat step 16 as long as a[i]<=x
Step 16: Increment i by 1
Step 17: Repeat step 18 as long as a[j]>x
Step 18: Decrement j by 1
Step 19: Assign p=j, Display the array
Step 20: Stop
FLOWCHART:
RESULT:
Thus the given array is partitioned such that all elements in left sub-list is lesser than the given x value and
the all elements in the right –list is greater than x.
TASK (4.B): FINDING THE KTH SMALLEST ELEMENT IN ARRAY
VARIABLES:
1. For lower limit-l
2. For upper limit-u
3. i – to traverse the array from left to right
4. j – to traverse the array from right to left
5. t-temporary variable for swapping
6. An array say ‘a’ where given list is stored
7. x – the array element present at kth position. i.e. x=a[k]
LOGIC:
1. Let l=1, u=n
2. Repeat while l<u
2.1 i=l, j=u
2.2 x=a[k]
2.3 Repeat while i<=k and j>=k
2.3.1 Repeat while a[i]< x
a) i=i+1
2.3.2 Repeat while x<a[j]
a) j=j-1
2.3.3 t=a[i]
2.3.4 a[i]=a[j]
2.3.5 a[j]=t
2.3.6 i=i+1
2.3.7 j=j-1
2.4 if j<k then l=i
2.5 if i>k then u=j
3. Print the element in the position k.
STOP
NOTE: At the end of the algorithm, the kth smallest element will be placed at the position k.
ALGORITHM:
Step 1: Start
Step 2: Read the value of k and array a[1…n]
Step 3: Initialise l to u and u to n
Step 4: Repeat steps (5 to 17) as long as (l<u)
Step 5: Initialise i to l, j to u and x to a[k]
Step 6: Repeat steps (7 to 15) as long as (i<k) and (j>=k)
Step 7: Repeat step 8 as long as (a[i] <x)
Step 8: Increment i by 1
Step 9: Repeat step 10 as long as (a[j]>x)
Step 10: Decrement j by 1
Step 11: Assign a[i] to t.
Step 12: Assign a[j] to a[i]
Step 13: Assign t to a[j]
Step 14: Increment i by 1
Step 15: Decrement j by 1
Step 16: Check if j<k , if yes, set l to i
Step 17: Check i>k, if yes, set u to j
Step 18: Display a[k]
Step 19: Stop
FLOWCHART:
RESULT: Thus the kth smallest element is found from the given list.
LAB TASK (5.A): SMILEY FACE DECOMPOSITION
AIM : To develop an algorithm to draw a smiley face using the process of decomposition.
ALGORITHM 1:
START
Step 1 🡪 Draw a circle
Step 2 🡪 Draw a curved line for mouth line
Step 3 🡪 Draw two dots for eyes
Step 4 🡪 Color the smiley face
STOP
ILLUSTRATION:
But this doesn’t tell us where the curved line and the dots should go in relation to the
circle, or each other.
ALGORITHM 2:
An algorithm that draws such an image might therefore look like this:
START
1. Draw circle with radius 30 at position 50,50 with line thickness 2.
2. Draw circle with radius 6 at position 40,40 with line thickness 1.
3. Draw circle with radius 3 at position 40,40 filled black.
4. Draw circle with radius 6 at position 60,40 with line thickness 1.
5. Draw circle with radius 3 at position 60,40 filled black.
6. Draw red line from position 30,70 to position 70,70 with line thickness 1.
STOP
FLOWCHART:
RESULT : Thus the algorithm and flowchart for drawing smiley face is successfully done using the
concept of decomposition.
TASK (5.b): SCIENCE PROJECT TASK DECOMPOSITION
AIM: To develop an algorithm for science project task using the process of decomposition.
RESULT:
Thus the above algorithm and flowchart generated and successfully verified.
TASK (6.A):DETECTION OF CRIMINAL CASE
AIM
To save the crime with decomposition
ALGORITHM
1) Identification of crime
1.1) Diamond Stolen
1.1.1) Cost
1.1.2) Place stolen
1.1.3) cont
1.2) Location
1.2.1) Street Name
1.2.2) Area
1.2.3) Land Mark
1.3)Time
1.3.1)Date
1.3.2)FN/AN
2)Investigate the witness
2.1)Lady Gather
2.1.1)Visual Identification
2.1.2)Suspect information
3)Collect all the evidences
3.1)Foot print
3.1.1)Size
3.1.2)Type
3.1.3)Suspect Height
3.2)CCTV Footage
3.2.1)Track video
3.2.2)Tool used for breaking glass
3.2.3)Suspect physique
3.2.4)Verification information
3.3)Finger Print
3.3.1)Send to forensic department
3.4)Broken Entry Glass
3.4.1)Tools
3.4.2)Broken outside/inside
3.5)Guess
3.5.1)Left Jewellery
4)Identification of suspect
4.1)Similarity in finger
4.1.1)Forensic lab
4.2)Face recognition
4.2.1)Software
4.3)Compare with crime
4.3.1)Suspected list
4.4)Display the suspect
4.4.1)Advertise
FLOWCHART
CRIME
DETECTION
Diamon locatio
d stones n
Conne Und
Attac Solder the
ct erst Connect Chec
Gath Attach Glu h wires
Positi motor and wiring to k
er the e motor
on driver the the wirin
mate wheel on driver
the circuit pro aurdino g
rials s and the circuit
aurdi cess
motor hea r
no
to the der
chasis
RESULT:Hence the algorithm for involve robot to build a new car is verified
TASK (7.A):DNA SEQUENCING
AIM:To find the DNA Sequence
ALGORITHM:
1)Start
2)Read the sequence in a DNA database
3)Generate a pattern for any sequence that begins with AC and is followed by one or more T
characters and finally by ac
4)Let i+ be (ACT+C)
5)Search the pattern in the given DNA sequence. If the pattern matches with DNA sequence, print
the sequence
6)stop
INPUT
Enron e-mail Database segment
Subject:enron-Living for country
PRIVILEGED AND CONFIDENTAL
OUTPUT
All caps word pattern(Incorrect)
(A-Z)+
All caps word pattern
v(A-Z)+\w
Revised pattern
Sequence of at least 3 all caps words
(\w[A-Z]+\w){3,}
Final output
PRIVILEGED AND CONFIDENTAL
\w[A-Z]+. \w[A-Z]+ \w[A-Z]+\w
FLOW CHART :
START
NO YES
Pattern
matchin
g with
input
Print the
sequence
Not Matching
STOP
AIM: To use patterns for miring textual database for useful legal information
ALGORITHM:
STEP 1: Start
STEP 2: read enron e-mail database segment
STEP 3: Generate a pattern that match only the three words PRIVILEGE and CONFIDENTIAL
STEP 4: Repeat step 3 by updating the pattern till decided results are found
STEP 5: Display the output by matching the pattern with e-mail segment
STEP 6: Stop
LOGIC:
INPUT: Enron e-mail database segment
Subject: enron-livingston country
PRIVILEGED AND CONFIDENTIAL
OUTPUT:
(A-Z)+
V>(A-Z)+\W{3}
REVISED PATTERN
\W(A-Z)+\W){3,}
FINAL OUTPUT:
PRIVILIGED - AND - CONFENDENTIAL
AIM :
To do the activity of Setting up a home aquarium using algorithm thinking
Algorithm:
1. Remove tank / aquarium from the box
2. Put your tank / aquarium in position
3. Rinse all gravel and ornaments
4. Fill your tank with water from a clean bucket.
5. Turn on filters
6. Repeat step 7 -11 every two weeks to cycle the tank.
7. Add fish food
8. Add water condition
9. Take a sample of water and test. If it is toxic remove the water. Go to step3
10. Add small number of fishes
11. Feed the fish 2 time
12. Stop
Flowchart
RESULT
Thus, the algorithm for setting up a home aquarium solved by using algorithmic thinking is verified.
TASK (9.B)- DRAWING A DOG - ABSTRACTION
AIM: To do the activity of drawing a dog using Abstraction
LOGIC:
ALGORITHM:
1. Draw two circles with dot inside it
2. Draw a small curved line from eyes ending with small circle for its nose
3. Draw a small curved line starts from eyes and end towards its eyes for getting its face
Draw a small down circle starts from nose and end towards its face for getting mouth
4. Draw a small U shaped curve starting below its mouth and ending in the same for getting
its tongue
5. Draw a two small doubled lines above the eyes for getting its eyebrow
6. Draw a curved U shaped line starting from its right eyebrow and ending in right eyebrow
7. Draw its forearm leg by double solid lines staring from its bottom face
8. Draw its another forearm leg , just draw a small straight line attached to it.
9. Draw it bottom leg by making a three shaped curve line, just behind the fore arm leg
10. Draw its tail by sharp edged double line, and join the line with its ears for getting its body
11. Draw a U shaped curve starting from its upper right eye brow and ending it in the same
for getting its right ear
12. Darken the nose circle by black color for distinguishing its nose
13. Draw a small double dashed line just above the tail
14. Draw a water droplet just below its tongue in order to get a complete dog picture
RESULT:
Thus the algorithm for drawing a dog completed using abstraction is verified.
TASK 10: LEFT AND RIGHT JUSTIFICATION OF TEXT
AIM:
To do the activity of left and right justification of text
LOGIC:
->Create an array whose length is equal to the no of space in the given text.
-> Let n space refers to the number of spaces in the given text.
-> Let old text length be the length of the given text.
-> Let new text length be the length of the justified text.
->Find extra space=new text length-old text length.
We use a variable delta=round (nspace/extraspace)
If delta=0, then delta=1
->Compute the next position to be added using
Next=round(delta+1)/2
->Check extraspace>nspace
If extraspace>nspace then
Space block= extra space/ nspace
->Repeat the process while next≤nspace and extra space >0
t[next]=t[next]+space block
next=next+delta
extra space= extra space-space block
ALGORITHM :
Step1: Start
Step2: Input the line to be justified
Step3: Find old Length =length of line
Step4: Input the new length of justification
Step5: compute extra space = new text length - old text length
Step6: if the old text length >new text length then display justification can’t be done go to
else proceed
Step7: Remove all the leading and trailing spaces in the line
Step8: Find the no of Spaces in the lines let it be n spaces
Step9: Create an array +[1 to n space ] and initialize it ‘s value as 1
Step10: Repeat the step (11, 12, 13) if extra spaces >0 and n space >0 else go to step-18
Step11: Compute delta= round (n Space/extra space)
If delta=0 set delta=1
Step12: Compute next=round (delta+1)/2
Step13: If the extra space > n space then compute space block=extra space/n space else space block1
Step 14: Repeat the space (15, 16,17) is next < n space and extra space >0
Step15: compute +[ next] =+ [next] +space block
Step16: compute next= next+ delta
Step17: compute extra space = extra space- space block
Step18: For the character in the line do the following if the character is a space the consult the array
and add the space indicated in the position else copy the character in the output array
Step19: print the justified step
Step20: Stop
Input :
She-sells-sea-shells-in-the-sea-shine
Extra space= new length-old length
47-37=10
N space=7
2 3 2 3 2 3 2
1 2 3 4 5 6 7
RESULT: Hence, the Algorithm for left and right justification of text is verified
RESULT : Hence, the algorithm and flowchart for text-line editing is verified
TASK (12.A) : GCD OF TWO INTEGERS
TRACING TABLE:
Steps M n r m%n=0
2 15 5
3 No
4 1
5 2
3 Yes
SAMPLE INPUT:
Enter m, n value
15 2
GCD= 1
RESULT: Thus the GCD of two numbers is found out by using the algorithm and the flowchart is drawn.
ALGORITHM :
Step 1: Start
Step 2: Read the value of n
Step3: Check whether n%2=0 print sdivisor=2
Step4: initialize d to 3
Step5: check whether (n mod d <>0) and (d<r) do d:=d+2;
Step6: check if n%d=0
Step 7: if yes assign sdivisor = d and print sdivisor
else
print sdivisor=1
Step8: Stop
FLOW CHART:
ALGORITHM DEVELOPMENT
Input =15
Output =3
RESULT: Hence, the algorithm and flowchart for smallest divisor of an integer is verified
ALGORITHM
Step 1: Start
Step 2: Read the value of n
Step 3: Repeat the step 4 as long as n%2=0
Step 4: Print ‘2’, compute n=n/2
Step 5: Repeat step 6 by initializing i to 3 upto n/2
Step 6: Check if n%i=0, if yes print ‘i’, compute n=n/i
Step 7: Repeat step 6 as long as n%i=0
Step 8: Increment i by 2
Step 9: Check n>2, if yes print n
Step 10: Stop
FLOWCHART
ALGORITHM VERIFICATION
2 36
3 YES
4 2 18
3 YES
4 2 9
3 NO
5 3
6 YES
7 3 3
6 YES
7 3 1
6 NO
8 5
NO
Input = 36
Output =2,2,3,3
RESULT: Hence, the algorithm and flowchart for prime factors computation is verified
TASK (13.A):BUDGET SHOPPING
ALGORITHM
Step 1 : Start
Step 2 : Set total to zero.
Step 3 : Display list of item code and unit price
Step 4 : Read Budget
Step 5 : Read item code and quantity
Step 6 : Compute price 🡪 quantity*unit price
Step 7 : Compute total 🡪 total + price
Step 8 : Check whether do you want purchase any more ,else go to step – 5
Step 9 : Check whether total > budget ,else go to step – 13
Step 10 : Read enter and quantity to remove
Step 11 : Compute price quantity to unit price
Step 12 : compute total 🡪 total price
Step 13 : Display “Shopping Cover”
Step 14 : Stop
FLOWCHART
START
Total = 0
Read Budget
Do you
want to
purchase
anything
Total = Total -
Price
STOP
RESULT : Hence, the algorithm and flowchart for budget shopping is verified.
TASK (13.B) - CHARACTER TO NUMBER CONVERSION
AIM:
To do the activity of character to number conversion
LOGIC:
Input: Read value of string
Process:
Initialize decimal to 0
i from 1 to n
if yes
read character(c )
get ASCII value of c
digit=ascii -48
decimal=decimal *10+digit
if no
output: display decimal
ALGORITHM:
1. Start
2. Read the value of string [character number]
3. Compute length of string, let it be n, initialize dec to 0
4. Repeat step [5 -8] by varying I from 1 to n.
5. Read character (c)
6. compute digit= ascii-48
7. compute dec= dec*10+digit
8. display dec
9. stop
TRACING TABLE
character (c
Steps String n i ) asc digit dec i<n
2 2194
3 4
4 1
5 2
6 50
7 2
8 2
4 yes
5 2
6 1
7 49
8 1
4 21
5 yes
6 3
7 9
8 57
4 9
5 219
6 yes
7 4
8 4
4 52
5 4
6 2194
7 no
8 5
4 2194
RESULT: Thus, the algorithm and flowchart for character to number conversion is verified.
TASK 14. THE MERGE SORT ALGORITHM BIRTHDAY PARTY
AIM :
To arrange and order the party guests by comparing their ages using Merge Sort
Algorithm.
ALGORITHM:
Step 1 : Find the middle index of the array,
Middle = 1 + (last - first)/2
Step 2. : Divide the array from the middle.
Step 3 : Repeat the steps 1 and 2 in first half of the array, until the atomic units of the array is
reached and further division is not possible.
Step 4 : Repeat the steps 1 and 2 in Second half of the array, until the atomic units of the
array is reached and further division is not possible.
Step 5 : After dividing the group of guests into individual persons, start merging the guests
based on comparison.
LOGIC :
64 25 12 22 11 36
[ 64, 25 ], 12 [ 22,11 ] 36
[25,64] 12 [ 11,22 ] 36
RESULT : Hence, the algorithm for merge sort - birthday party is verified
TASK 15 :SORTING BY EXCHANGE,SELECTION& INSERTION
AIM
Apply Exchange Sort (Exchange Bubble Sort) algorithm to sort the given number of
elements in an array.
FLOW CHART
RESULT: Thus, the Exchange sort has been successfully completed and verified.
AIM
Apply selection sort algorithm to sort the given array of numbers.
ALGORITHM
1. Get a list of unsorted numbers
2. Set a marker for the unsorted section at the front of the list
3. Repeat steps 4 - 6 until one number remains in the unsorted section
4. Compare all unsorted numbers in order to select the smallest one
5. Swap this number with the first number in the unsorted section
6. Advance the marker to the right one position
7. Stop
FLOWCHART
RESULT
Thus, the selection sort algorithm has been successfully completed and verified.
ALGORITHM
Step 1 − If it is the first element, it is already sorted return 1.
Step 2 − Pick next element.
Step 3 − Compare with all elements in the sorted sub-list.
Step 4 − Shift all the elements in the sorted sub-list that is greater than the value to be
sorted.
Step 5 − Insert the value.
Step 6 − Repeat until list is sorted.
FLOW CHART
RESULT: Thus, the Insertion sort algorithm has been successfully completed and verified.
VIVA QUESTIONS:
1. What is computational thinking?
2. Define logic.
3. Mention the types of logic.
4. List out the four pillars of computational thinking.
5. What is decomposition?
6. Give some examples for decomposition.
7. Define abstraction.
8. Give examples for pattern.
9. What is algorithm?
10. Define Linear pattern search ?
11. What is meant by algorithm ?
12. What is text editing ?
13. Define sub Linear pattern search
14. Write the sequence of searching DNA Database?
15. Define Linear search ?
16. Define Binary search ?
17. What is the definition of problem ?
18. Write the way of programming the car ?
19. Tell the procedure of detection of criminal case?\
20. Define sorting?
21. Can you explain how Insertion sort works?
22. Can you explain how Selection sort works?
23. Can you explain how Exchange sort works?
24. What is the worst case complexity for insertion sort?
25. What is difference between sorting and searching?
26. How is merge sort different from insertion sort?
27. Can you explain how Merge sort works?
28. How would you improve the performance of merge
sort?
29. What is the worst case complexity for Merge sort?
30. What are some ways to optimize merge sort?