Posts

Showing posts with the label code

Selection Sort

Image
When sorting using selection sort algorithm, There are two parts as unsorted and sorted parts while sorting. Minimum value is selected from sorted part and swapped with the leftmost element of the unsorted part of the array. Example is given below, In this algorithm, every time minimum element is selected from unsorted part and swapped with leftmost element 10 is the smallest value 10 is swapped with 14 14 is the smallest value in the unsorted part Swap 14 with 14(in is already on the leftmost of the array) 15 is the smallest from index 2 to 5 15 is swapped with 76 53 is the smallest in unsorted part 53 is swapped with 76 72 is the smallest in the unsorted array Swapping 72 and 76 76 is the smallest Array is sorted

Bubble sort

Image
Given unsorted array is scanned n-1 times(n - number of elements in the array) and always it compares with the adjacent current element and if current element is greater then both elements are swapped. In the given example array is sorted choosing largest value, and sorted largest to smallest(last element first element). Comparing 3 and 72 and take 72 as curent element Comparing 50 and 72, since 50 is smaller, 50 and 72 are swapped Comparing 68 and 72, since 68 is smaller, 68 and 72 are swapped Comparing 68 and 72, since 69 is smaller, 69 and 72 are swapped Comparing 22 and 72, since 68 is smaller, 22 and 72 are swapped 72 is sorted to index 5 as the largest value in the array Comparing 3 and 50 Comparing 50 and 68 Comparing 68 and 69 Comparing 22 and 69, 69 and 22 are swapped since 22 is smaller Array is sorted 4 index to 5 index Comparing 3 and 50 Comparing 50 and 68 Comparing 22 and 68, 22 and 68 areswapped sin...

Course - Learn Git in Code Academy

git init - initialize and this command sets up all the tools Git needs to begin tracking changes made to the project. in a git project, there are three parts and they are A Working Directory : where we'll be doing all the work: creating, editing, deleting and organizing files A Staging Area : where we'll list changes we make to the working directory A Repository : where Git permanently stores those changes as different versions of the project we can check the status of those changes with: git status - it shows the untracked files in red color and then we should do git add 'file name' to add the file and then  we should do 'git commit' to reposit the file git show HEAD git log to see the history

Note - Google cookies

1.Preference            Most Google will have preference cookie called "NID"  in their browser. A browser sends NID to Google sites and there is an ID in it. and it helps to keep a track of the languages we use and some activities we do.   2.Security            Security cookie for authenticate users and prevent fraudulent use of login and protect user data from unauthenticated parties. 3.Process            Make website work and deliver services that website visitors expect. 4.Advertising            Help to customize ads on Google properties.  5.Session state 6.Analytics            Google's analytics tool that helps website and app owners to understand how their visitors engage with their properties. content - Google_cookies

Target 8 - Ruby tutorial

Image
Ruby tutorial was finished and a certificate was issued in www.sololearn.com

Target 2-finished

Image
 I finished my second tutorial, java tutorial course in  www.sololearn.com  on 27 July 2016 and a certificate was issued. And it was exited to know about new languadges.

Target 1 - finished

Image
 I finished a HTML tutorial course in  www.sololearm.com  and a certificate was issued in 14 August 2016.

Simple Tasks on numbers - C programming

Task 01 Write a program to read two integers with the following significance. The first integer value represents a time of day on a 24 hour clock, so that 1245 represents quarter to one mid-day, for example. The second integer represents time duration in a similar way, so that 345 represents three hours and 45 minutes. This duration is to be added to the first time, and the result printed out in the same notation, in this case 1630 which is the time 3 hours and 45 minutes after 12.45. #include <stdio.h> int main(){ int time,duration,end_time; printf("Enter the start time: "); scanf("%d",&time); printf("Enter the duration: "); scanf("%d",&duration); int count=0; if(duration>60){ while(duration>60){ duration=duration-60; count++; } } int hours,minutes; hours=(time/100+count)*100; //(duration/60); minutes=time%100+duration; end_time=hours+minutes; if(end_time>=2400){ end_tim...