Posts

How recursive bubble sort work

                                              Recursive Bubble Sort Base Case: If array size is 1, return. Do One Pass of normal Bubble Sort. This pass fixes last element of current subarray. Recur for all elements except last of current subarray. Example: Index=     0 1  2 3 4 5 6 7   100                          90 80 70 60 50 40 30  Array []= Suppose we want to sort the above in the increasing order by the recursive bubble sort. Make a get grater which will return the grater of the array. Compare the first and last element of the array if the first is greater than last the swap with each other. And again call the sort function and decrement the array size by 1; 1) 30                     90 80 70 60 50 40 100    ...

How comb sort work

                                                       Comb sort     The comb sort has the following step: 1)       Create and anilities the variable gap  swap and constant Shrink factor a)       Gap=size of array b)       Swap=false c)       Shrink factor =1.3 2)       Set swap =false 3)       Set gap=gap/shrink factor 4)       Iterate over the array from i=0 To n<n-gap  If array[i]>array[i+gap] a)       Swap the element array[i] and array[i+gap] b)       Set swap=true 5)       Repeat the step 2-4 while gap1=1 and swap=true   Let us solve the example Array{7,5,1,50,3,-20,25,-4,30,0} Gap=10 K=1.3 1 st pass After update gap value =10/1.3=7 7,5,1,50,3, -20,25, -4,30,0 ...

simple calculator apps project in android studio

Image
                                         calculator apps                                                                XML CODE <? xml version ="1.0" encoding ="utf-8" ?> <LinearLayout xmlns: android ="http://schemas.android.com/apk/res/android"     xmlns: app ="http://schemas.android.com/apk/res-auto"     xmlns: tools ="http://schemas.android.com/tools"     android :layout_width ="match_parent"     android :layout_height ="match_parent"     android :orientation ="vertical"     android :padding ="16dp"     tools :context =".MainActivity" >     <TextView         android :id ="@+id/tvResult"         android :layout_width ="375dp"         android :layout_height ="137dp"         android :b...