Saturday, July 31, 2010
Posted by venu k
14 comments | 4:18 PM
Palindrome: A palindrome is a word, phrase, number or other sequenceof units that can be read the same way in either direction (the adjus-tment of punctuation and spaces between words is generally permitted).Examples: Phrases: Dammit, I'm mad!Quotations: Able was I ere I saw Elba. Madam, I'm Adam.Names: Some people have names that are palindromes.Lon Nol (1913- 1985) was Prime Minister of Cambodia. Palindromic names are very common in Finland. Examples include Emma Lamme,Sanna Rannas, Anni Linna...
Thursday, July 29, 2010
Posted by venu k
7 comments | 9:34 AM
#!/bin/bash#!/bin/bash# SCRIPT: insertionsort.sh## LOGIC: Here, sorting takes place by inserting a particular element# at the appropriate position, that’s why the name insertion sorting.# In the First iteration, second element ARRAY[1] is compared with# the first element ARRAY[0]. In the second iteration third element# is compared with first and second element. In general, in every# iteration an element is compared with all the elements before it.# While comparing if it is found that the element can be inserted at# a suitable position, then space...
Posted by venu k
9 comments | 9:29 AM
#!/bin/bash#!/bin/bash# SCRIPT: selectionsort.sh## LOGIC : Here, to sort the data in ascending order, the first element# ARRAY[0] is compared with all the other elements till the end of the# array. If it is greater than any other the elements then they are# interchanged. So after the first iteration of the outer for loop# smallest element will be placed at the first position. The same pro-# cedure is repeated for the other elements too.####################################################################### Define Functions...
Posted by venu k
14 comments | 9:23 AM
#!/bin/bash# SCRIPT: bubblesort.sh# LOGIC:# Bubble sort is a simple sorting, it works by repeatedly stepping# through the list to be sorted, comparing two items at a time and# swapping them if they are in the wrong order. If you are sorting# the data in Ascending order, at the end of the first pass, the# "heaviest" element has move to bottom. In the second pass, the# comparisons are made till the last but one position and now second# largest element is placed at the last but one position. And so# forth.#######################################################################...
Subscribe to:
Posts (Atom)