| 3 | Merge two sorted arrays-theory
Now A, B are two different Arrays with different data types
Let take two sorting arrays with A and B to merge them
New Array variable called C to combain two arrays A & B in Assending order
First essume that A[i] B[j] with start with sorting with 'i' to 'j' from LEFT to RIGHT
while as we know the count the DATA TYPES with 0,1,2,3,4, where values are i= [2,5,8,9,10] j=[2,4,7,18] count with [0,1,2,3]
maximum count from LEFT TO RIGHT i=[2,5,8,9,10] j=[2,4,7,18] => that means I to J Assending order SMALL to Higher values.
i=0 => 2 & j=0 =>2 :[2] =>2 is small from starting with 'i' compared to 'j'
j=0 => 2 & i=1 =>5 :[2,2] =>2 is small compared to'5' so 'j' value comes first and value 2 is forwoded
i=1 => 5 & j=1 =>4 :[2,2,4] => 4 is smaller compared to 5 so 'j' comes first and value 2,2 is forwored
i=1 => 5 & j=2 =>7 :[2,2,4,5] => 5 is smaller compared to 7 so 'i' comes first and value 2,2,4 is forworded
Till the Highest number comes and it ends with [2,2,4,5,7,8,9,18]
when we compare the array values between A & B , combine with C then the values look in the above picture
| 4 | Merge-sort-theory
| 14 | Selection-sort-working
| 10 | Countsort
Let us assume that count sort is not a comparision, however it is the array that we can not count from the range
It would be the certain range between [0,k] we can not expect the range in count sort but to some expect from this range like negative range or number,in an Array
Let we determine the number range array A=[2,5,1,4,4,2,6] => count=[0,1,2,3,4,5,6,7,8]
itterate to A with count values for instance A = 2 value in count =[0,0,1,0,0,0,0,0,0]
itterate to A with count values for instance A = 5 value in count =[0,0,1,0,0,1,0,0,0]
itterate to A with count values for instance A = 1 value in count =[0,1,1,0,0,1,0,0,0]
itterate to A with count values for instance A = 4 value in count =[0,1,1,0,1,1,0,0,0]
itterate to A with count values for instance A = 4 value in count =[0,1,1,0,2,1,0,0,0] Here 4 comes two times and the value of 4 is 2
itterate to A with count values for instance A = 2 value in count =[0,1,2,0,2,1,0,0,0] Here 2 value comes two times and the value of 2 is 2 times occurs
itterate to A with count values for instance A = 6 value in count =[0,1,2,0,2,1,1,0,0]
The count values of 7, 8 are 0,0-----------------------------count=[0,1,2,0,2,1,1,0,0]
Cumulative sum final result add result value from left 0, 0+1=1,1+2=3,3+0=3,3+2=5,5+1=6,6+1=7,7+0=7,7+0=7
-------------count=[0,1,3,3,5,6,7,7,7] is called cumelative sumNew result value array formula is K, COUNT[K]: [K-1], for instance [k =2] , [k-2-1-1], [k=5, K-1=5-1=4],
Counting sort count the number of elements
Complexity would be 'LINEAR'