Thursday, July 29, 2010

Arithmetic Operation -Octal & Hexadecimal

Octal Addition and Subtraction : Radix or Base for Octal numbers are 8 and consists 0 to 7. While adding we follow following rules:

Addition

We already know that 8 is the base or radix of the Octal Number System, after adding of two digit if you get below 8 then write down it, but if it is more than 7 then divide the result by 8 and write down the remainder in the place of result and the quotient as carry numbers.

Example-1

(447)8 + (622)8
                      
                                                                    Rules

       1                     1) 7 + 2 = 9 (above 7) 9/8 Quotient=1 Remainder=1 (Carry = 1)
 ------------            2) 4 + 2 + 1(carry)=7 is below 8 (Carry = 0)
    4 4 7                   3) 4 + 6 = 10 (above 7) 10/8 Quotient=1 Remainder=2(Carry = 1)
    6  2 2
 ------------
  1 2 7 1
 ------------
  Answer :  (447)8 + (622)8= (1271)8



Example-2

(237.54)8 + (753.74)8
    
                                                            Rules

    1 1 1 1                1) 4 + 4 = 8 (8/8 Quotient=1 Remainder=0)(Carry = 1)
---------------          2) 5 + 7 + 1 (carry) = 13(13/8 Quotient=1 Remainder=5)Carry = 1)
   
3 7 . 5 4               3) 7 + 2 + 1 (carry) = 10(10/8 Quotient=1 Remainder=2)(Carry = 1)
    7 2 . 7 4              4) 3 + 7 + 1 (carry) = 11(11/8 Quotient=1 Remainder=3)(Carry = 1)
---------------
 1 3 2 . 5 0
---------------

  Answer :  (37.54)8 + (72.74)8= (132.50)8


Subtraction


Octal Subtraction : While subtracting if minuend digit smaller than subtend then add 8 to the minuend digit and then subtract and in the process 1 should be borrow from the minuend digit at the end.

Example-1

(345)8 - (126)8

                                                    Rules
     1                     1) 5 is less than 6 so 5+8 = 13 - 6= 7 (Borrow = 1)
------------          2) 4 -1(borrow) = 3 is bigger than subtend so 3 - 2=1(Borrow = 0)
  
3 4 5                 3) 3 -1 = 2 (Borrow = 0)
   1 2 6
 ------------
   2 1 7
 ------------
  Answer :  (345)8 - (126)8 = (217)8



Example-2

(246.24)8 - (157.56)8

                                                           Rules


   1 1 1    1           1) 4 + 8 - 6 = 6 (Borrow = 1)
 --------------      2) 2-1(borrow) =1 + 8 - 5 = 4 (Borrow = 1)
    2 4 5 .2 4         3) 5-1(borrow) =4 + 8 - 7 = 5 (Borrow = 1)
   1 5 7 . 5 6         4) 4-1(borrow) =3 + 8 - 5 = 6 (Borrow = 1)
 ---------------       5) 2-1(borrow) =1 - 1 = 0 (Borrow = 0)
   0 6 5 . 4 6
 ---------------

  Answer :  (246.24)8 - (157.56)8 = (65.56)8



Hexadecimal Addition and Subtraction : Radix or Base for Octal numbers are 16 and consists 0 to 15 (0 - 9, A, B, C, D, E, F). While adding we follow following rules:

Addition

We already know that 16 is the base or radix of the Hexadecimal Number System, after adding of two digit if you get below 16 then write down it, but if it is more than 15 then divide the result by 15 and write down the remainder in the place of result and the quotient as carry numbers. Replace Alphabet with its equivalent decimal numbers. e.g.. A = 10 or E = 14

Example-1

B83)16 + (A2D)16 = (11 8 3)16 + (10 2 13)16

                                                             Rules

         1                 1) 3 + 13 = 16(above 15) 16/16 Quotient=1 Remainder=0(Carry=1)
 ------------          2) 8 + 2 + 1(carry)= 11 is below 15 (Carry=0)
    11   8   3         3) 10 + 11 = 21(above 15) 21/16 Quotient=1 Remainder=5(Carry=1)
    10   2 13
 ------------
  1 5   11 0  = 1 5 B 0
 ------------

  Answer :(B83)16 + (A2D)16 = (15B0)16



Example-2

(AB.CD)16 + (D5.2F)16 = (10 11.12 13)16 + (13 5.2 15)16

                                                      Rules

   1          1                1) 13 + 15 = 28 (28/16 Quotient=1 Remainder=12(Carry = 1))
 -----------------        2) 12 + 2 + 1(carry) = 15 is below 15 (Carry = 0))
   10 11 .12 13          3) 11 + 5 = 16 (16/16 Quotient=1 Remainder=0 (Carry = 1))
   13  5  .  2 15         4) 10 + 13 + 1(carry)= 24 (24/16 Quotient=1 Remainder=8 (Carry = 1))
-----------------
  1 8 0  . 15 12       = 180.FC16
------------
  Answer : (AB.CD)16 + (D5.2F)16  = (180.FC)16



Subtraction


Hexadecimal Subtraction : While subtracting if minuend digit smaller than subtend then add 16 to the minuend digit and then subtract and in the process 1 should be borrow from the minuend
digit at the end.

Example-1

(BA3)16 - (AB4)16 = (11 10 3)16 - (10 11 5)16)

                                                             Rules

         1              1) 3 is less than 5 so 3 + 16 = 19 - 4= 15 (F) (Borrow = 1)
-------------       2) 10 - 1(borrow) = 9 + 16 = 25 - 11 = 14 (E) (Borrow = 1)
  11 10  3           3) 11 -1 = 10 = 10 - 10 = 0 (Borrow = 0)
 
10 11  4
------------
   0   E   F
------------

  Answer : (BA3)16 - (AB4)16 = (EF)16



Example-2

(C5.A2)16 - (A7.B3)16 =  ((12 5.10 2)16 - (10 7.11 3)16)

                                               Rules

   1    1    1                 1)  2 + 16 - 3 = 15 (F) (Borrow = 1)
---------------              2)  10-1(borrow) =9 + 16 - 11 = 14 (E) (Borrow = 1)
  12  5 . 10  2             3)  5-1(borrow) =4 + 16 - 7 = 13 (D) (Borrow = 1)
  10  7 . 11  3             4)  12-1(borrow) =11 - 10 = 1
---------------
  1  D .  E   F
---------------
  Answer : (C5.A2)16 - (A7.B3)16 = (17.EF)8



After fortnight coming back with some more with system only. !

Thursday, July 15, 2010

Binary Addition & Subtraction - Back to the basic

Binary Addition  : Radix or Base for Binary numbers are 2 and having two digits 0 and 1. so while adding we follow following rules:


0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 0 and carry 1 (Decimal 2 and Binary 10)
1 + 1 + 1 = 1 and carry 1 (Decimal 3 and Binary 11)
1 + 1 + 1 + 1 = 0 carry 10 (Decimal 4 and Binary 100)




Example : 1 Example : 2
Carry >>
       1 1 1 1
Carry >>
    1  1 1 1      1
    1 1 1 0 1     1 0 1 0 . 1 0 1

    0 1 1 1 1

    1 1 0 1 . 1 0 1
Answer :  1 0 1 1 0 0 Answer :  1 1 1 0 0 . 0 1 0

Binary Subtraction
While subtracting we follow the following rules:
0 - 0     = 0
0 + 1     = 1  borrow 1
1 + 0     = 1
1 + 1     = 0


Example : 1 Example : 2

Borrow >>

    1 1 1

Borrow >>

          1

    1 1 1 0 1

   1 0 1 0 . 1 0 1


    0 1 1 1 1


    1 0 0 1 . 1 0 0
Answer :     0 1 1 1 0 Answer :     0 0 0 1 . 0 0 1




Subtraction often is very tricky, you can solve it by using 1's Compliment or 2's Compliment

Like you have 50 - 12 = 38 same 50 + (-12) = 38



Compliment means Invert or all 0's change to 1 and 1's become 0. So Rules for 1's Compliment is :

Make the both side equal by placing leading 0's. Replace all the 1's with 0's and the 0's with 1's, then add both the numbers.

If there was 4 bits and after adding you getting five, the leading bits known as carry bits. If there is a carry bits then remove that from leading position and add to the result of the addition and write the answer down.



 Example :(10010)2 - (1001)2 Minuend : 10010 and Subtrahend : 1001. Minuend contain 5 bits where Subtrahend having 4, so it will be 01001 (both side with same numbers of digits and done by adding leading zeros) 01001 (decimal 9) 0110 (one's complement) Add




Example : 1  Addition

Carry >>

       1 1 1
   18    1 0 0 1 0

+ -9

    1 0 1 1 0
 1 0 1 0 0 0
    0 1 0 0 0
 +             1   
Answer :+9     0 1 0 0 1

1 is a carry bit because after adding two four bits number we are getting 5 bits, remove the carry from there and add to the remaining part of the result.

Result of : (10010)2 - (1001) = (1001)2 or 18 + (-9) = 9



The two's complement of a binary number is obtained by:
1. Replacing all the 1's with 0's and the 0's with 1's (1's Compliment).
2. Adding 1 to the result of 1's compliment using the rules of binary addition.
Now you have the two's complement. The decimal subtraction 18 - 9 = 9 is the same as adding (18) + (-9) = 9
1. Convert the number to be subtracted to its two's complement:(10010)2 - (1001)2 = (10010)2 - (01001)2, 01001 (decimal 9) 10110 (one's complement) + 00001 (add 1 (two's complement)) 10111 (We get)

10111 now represents -9.


Example : 1  Addition

Carry >>


       1 1 1
  18    1 0 0 1 0

+ -9

    1 0 1 1 1
Answer :+9 1 0 1 0 0 1
Note that the final carry 1 is ignored and dropped permanently. So you get :Result of : (10010)2 - (1001) = (1001)2 or 18 + (-9) = 9



If no carry that indicate a negative result. When a subtraction produce negative result then you have to re-compliment the result of addition to get the correct answer.
(1000)2 - (1001)2 = (1000)2 - (0110)2, (one's complement).

Example : 1  Addition

Carry >>

     8    1 0 0 0

+ -9

    0 1 1 0
    1 1 1 0


If no carry bit then re-compliment the result 1110 = 0001 (after 1's compliment)   Result of : (1000)2 - (1001) = (-1)2 or 8 + (-9) = -1  

Answer :  (1000)2 - (1001)2 = (-0001)2




With above example with 2's compliment :(1000)2 - (1001)2 1001 (decimal 9) after 1'compliment we get 0110 + 1 (2's Compliment ) ------- 0111

Example : 1  Addition

Carry >>


 
    8    1 0 0 0

+ -9

    0 1 1 1
    0 1 1 1


If no carry bit then re-compliment the result

0111 = 1111 (after 1's compliment) 1111+1 = 0001(2's compliment)


The result will be -0001 Result of : (1000)2 - (1001) = (-1)2 or 8 + (-9) = -1



 Binary Multiplication

Binary multiplication is same as normal multiplication only we have to know the rules of addition properly.
(1010.11)2 x (101.10)2



Example : 1
      
            1 0 1 0 . 1 1
 x                   1 0 1 . 1 0
                  0 0 0 0 0 0
               1 0 1 0 1 1
            1 0 1 0 1 1
         0 0 0 0 0 0

     1 0 1 0 1 1
  1 1 1 0 1 1 . 0 0 1 0

Answer : (1010.11)2 x (101.11)2= (1javascript:void(0)11011.0010)2



Binary Division

Binary division too is same as decimal division but binary subtraction rules going used here.
(110011)2 / (111)2

Example : 1
1 1 1   1 1 0 0 1 1 1


     1 1 1    


  1 0 0 0 1


     1 1 1

        1 1 1 1


        1 1 1

        0 0 0

          1 1 1
Answer : (110011)2 / (111)2= (111)2


!!!Hope it will be helpful!!!

Thursday, July 1, 2010

Number Systems-II - This one not that systematic, do not get lost.


Last time we have seen the methods and way to convert the Decimal numbers to Binary, Octal and Hexadecimal. Today I will tell you how you can convert the Binary, Octal and Hexadecimal numbers to Decimal

Binary to Decimal

(101)2=(?)10  (Convert binary 101 to decimal). Now we have 101 means three digit, so let us consider n=3.

101 = 1 x 2n-1+ 0 x 2n-2 + 1 x 2n-3

= 1 x 23-1 + 0 x 23-2 + 1 x 2n-3
= 1 x 22 + 0 x 21 + 1 x 20
= 1 x 4 + 0 x 2 + 1 x 1
= 4 + 0 + 1 = 5
= (101)2 = (5)10


For fractional Numbers :

(.11)2=(?)10

Here 'n' is 2,
.11 = 1 x 2n-(n+1) + 1 x 2n-(n+2)
= 1 x 2-1 + 1 x 2n-2
= 1/21 + 1/22
= 1/2 +1/4
= 3/4 = .75
= (.11)2 - (.75)10


Another example : (11.011)2 - (?)10
= 1 x 21+ 1 x 20             + 0 x 2-1 + 1 x 2-2 + 1 x 2-3
 = 1 x 21 + 1 x 20           + 0 x 2-1 + 1 x 2-2 + 1 x 2-3
 = 2 + 1                         + 1/4 + 1/8
= 3.3/8  = 3.375
= (11.011)2 - (3.375)10


Easy way out:

8 4 2 1   2 4
1 0 0 1 . 1 1
Check the numbers on the top, its 20 onwards 2n-1, values written on the top for whole number right most digit to start with and for fractional numbers left most digit. For whole numbers add the values for non zero elements like 1 and 8 because 4 and 2 having a '0' below it. So by adding 8 + 1 =9 and divide the values for fractional numbers: 1/2 + 1/4 = 3/4 = .75.

(1001.11)2=(9.75)10



Octal to Decimal

if you understand the conversion of Binary to decimal then other number system will be same process with different power.

Octal to Decimal
(56.34)8=(?)10

Two digit means n=2,
 = 5 x 8n-1+ 6 x 8n-2          + 3 x 8n-(n+1)+ 4 x 8n-(n+2)
= 5 x 81+ 6 x 80                 + 3/81+ 4 x 82
= 5 x 8 + 6 X 1                  + 3/8 + 4/ 64
= 40 + 6                             + 3/8 + 4/ 64
= 46.4375
= (56.34)8 = (46.4375)10



Hexadecimal to Decimal

(75.55)16=(?)10
Two digit means n=2, so
 = 7 x 16n-1+ 5 x 16n-2         + 5 x 16n-(n+1)+ 5 x 16n-(n+2)
= 7 x 161+ 5 x 160               + 5/161+ 5 x 162
= 7 x 16 + 5 x 1                   + 5/16 + 5/256
= 112 + 5 + 5/16 + 5/256
= 117.332031

(75.55)16 = (117.332031)10



Another Example :

(3A.B)16=(?)10

Here 'A to F' to be considered as 10 to 15 and as a single unit
3 x 16n-1+ 10 x 16n-2        +11 x 16n-(n+1)
= 3 x 16 + 10 x 1              + 11/16
=  48 + 10                        + 11/16
=   58.6875
= (3A.B)16 = (58.6875)10



Octal to Binary and Binary to Octal

Last number of Octal number system is 7. 7 equivalent to binary is 111, that means three digit. so while converting Octal to binary just write down the binary value of the octal number.

(56.34)8=(?)2

   5     6   .  3    4
101 110   011 100(56.34)8=(101110.011100)2


Same for Binary to Octal, only first you have to three digits of binary nose, where for whole number start from last digit and fractional numbers start from first digit. At the end if numbers of digits less than three than put a leading zero for whole number and a trailing zero for fractional part.

(1011011101.1101101)2=(?)8

001 011 011 101 . 110 110 100

1      3      3     5   .   6    6     4

(1011011101.1101101)1=(13335.664)8



Hexadecimal to Binary and Binary to Hexadecimal

Last number of Octal number system is F means 15. 15 equivalent to binary is 1111, that means four digit. so while converting Hexadecimal to binary just write down the binary value of the Hexadecimal number.
(7A.3B)16=(?)2

0111 1010   . 0011 1011

7         A      .    3       B

(7A.3B)16=(01111010.00111011)2


Same for Binary to Hexadecimal, only first you have to group four bits for whole numbers right to left and for fractions left to right  At the end if numbers of digits less than three than put a zero at leading position for whole numbers and a trailing zero for fractional part.
(1010011100.1101101)2=(?)8

 0010 1001 1100  .  1101 1010

2          9       12    .    13      10

(1011011101.1101101)2=(29C.DA)16


Thursday, June 17, 2010

Number System-I, Very Systematic


As promised, coming back after a week. this time we will talk about Number System and its conversation.

Positional number systems

Our decimal number system is known as a positional number system, because the value of the number depends on the position of the digits. For example, the number 156 has a very different value than the number 165, although the same digits are used in both numbers.

In a positional number system, the value of each digit is determined by which place it appears in the full number. The lowest place value is the rightmost position, and each successive position to the left has a higher place value.

In our decimal number system, the rightmost position represents the "ones" column, the next position represents the "tens" column, the next position represents "hundreds", etc. Therefore, the number 156 represents 1 hundred and 5 tens and 6 ones, whereas the number 165 represents 1 hundreds and 6 tens and 5 one.

Other number systems use different bases. The binary number system uses base 2, so the place values of the digits of a binary number correspond to powers of 2. The octal number system uses base 8, so the place values of the digits of a octal number correspond to powers of 8. The Hexadecimal number system uses base 16, so the place values of the digits of a binary number correspond to powers of 16. However, Hexadecimal number system also represent by alphabets. From 0 to 9 as numbers and 10 to 15 numbers are represent by alphabet A-F.

Decimal to Binary

(75.625)10 -> (?)2 First take the whole number and divide by 2, the radix or base of binary number or to which number system you want to convert.

Integer Part :

NotesProcessQuotientRemainder
Start by dividing the number by 2
In this case, 75 divided by 2
Quotient is 37 and the remainder is 1
75 / 2371
Then, divide the quotient again by 2,
and repeat it .
37 /2181
18 / 290
9 / 24 1
4 / 220
2 / 210
Stop because the result is already 0 (0 divided by 2 will always be 0). Write down the numbers in remainders column in reverse order, last digit to the first.1 / 201



Decimal Part

NotesProcessResultWhole number
Multiply the decimal part by 2 and The whole number part of the result is the first binary digit to the right of the point, put away it and continue multiple the fraction part.625 * 21.251
No whole number indicate a '0'.25 * 2.500
When there are no fraction left, the conversion is complete. Here you have to write the values top to bottom order.50 * 21.001
Sometime you will find the process going infinite nos. of times, just do till five or six places and write result with [approx]



The result : (75.625)10 -> (1001011.101)2

The process for converting decimal to octal or decimal to Hexadecimal will be same only the radix or base will change from 2 to 8 or 16.

Decimal to Octal

(75.625)10 -> (?)8 First take the whole number and divide by 2, the radix or base of binary number or to which number system you want to convert.

Integer Part :

NotesProcessQuotientRemainder
Start by dividing the number by 8
In this case, 75 divided by 8
Quotient is and the remainder is
75 / 893
Then, divide the quotient again by 8,
and repeat it .
9 /811
Stop because the result is already 0 (0 divided by 8 will always be 0). Write down the numbers in remainders column in reverse order, last digit to the first. 1 / 801

Decimal Part

NotesProcessResultWhole number
Multiply the decimal part by 8 and The whole number part of the result is the first binary digit to the right of the point, put away it and continue multiple the fraction part.625 * 85.0005
When there are no fraction left, the conversion is complete. Here you have to write the values top to bottom order
Sometime you will find the process going infinite nos. of times, just do till five or six places and write result with [approx]


Result : (75.625)10 = (113.5)8

Decimal to Hexadecimal

(75.625)10 -> (?)16 First take the whole number and divide by 2, the radix or base of binary number or to which number system you want to convert.

Integer Part :

NotesProcessQuotientRemainder
Start by dividing the number by 16
In this case, 75 divided by 16
Quotient is and the remainder is
75 / 16411
Then, divide the quotient again by 16,
and repeat it .
4 / 1604
Stop because the result is already 0 (0 divided by 8 will always be 0). Write down the numbers in remainders column in reverse order, last digit to the first.

Decimal Part

NotesProcessResultWhole number
Multiply the decimal part by 16and The whole number part of the result is the first binary digit to the right of the point, put away it and continue multiple the fraction part.625 * 1612.00012
When there are no fraction left, the conversion is complete. Here you have to write the values top to bottom order
Sometime you will find the process going infinite nos. of times, just do till five or six places and write result with [approx]


Result : (75.625)10 -> (4B.C)16

Following chart show the relation between the four number system.

Decimal Binary Octal Hexadecimal
0 0000 0 0
1 0001 1 1
2 0010 2 2
3 0011 3 3
4 0100 4 4
5 0101 5 5
6 0110 6 6
7 0111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
16 10000 20 10

After fortnight I will back with converting other number system to decimal.

Thursday, June 3, 2010

Some Abbreviation – Short and Sweet


A
API Application Program Interface
ARPANET Advanced Research Projects Agency Network
ASCII American Standard Code for Information Interchange
ASP Active Server Page
AT Advanced Technology
AWT Abstract Window Toolkit [Java]

B
BASH Bourne Again Shell
BASIC Beginner's All-purpose Symbolic Instruction Code
BCNF Boyce-Codd Normal Form
BIOS Basic Input/Output System
BLOG Web Log
BMP Basic Mapping Support
BYTE Binary Element String

C
CAB Compressed Application Binary
CAD Computer Aided Design
CAM Computer Aided Manufacturing
CD Compact Disk
CDMA Code Division Multiple Access
CGA Color Graphics Adapter
CHCP Change Code Page
CMOS Complementary Metal-Oxide Semiconductor
COBOL Common Business-oriented Language (See HLL)
CP/M Control Program for Microcomputers
CPU Central Processing Unit
CSMA/CA Carrier Sense Multiple Access/with Collision Avoidance
CSMA/CD Carrier Sense Multiple Access/with Collision Detection
CTCP Client-To-Client Protocol

D
DB Data Base
DBMS Data Base Management System
DCL Data Control Language
DDL Data Definition Language
DDR Double Data Rate
DLL Dynamic Link Library
DLM Dynamic Link Module
DMA Direct Memory Access Facility
DML Data Manipulation Language
DOS Disk Operating System
DRAM Dynamic Random Access Memory
DSDD Double Sided Double Density
DSL Domain Specific Language
DVD Digital Video Disk

E
EDSAC Electronic Delay Storage Automatic Calculator
EDVAC Electronic Discrete Variable Automatic Computer
EEPROM Electrically Erasable Programmable Read-Only Memory
EGA Enhanced Graphics Adapter
E-MAIL Electronic Mail
ENIAC Electronic Numerical Integrator Analyzer and Computer
EPROM Electrically Programmable Read Only Memory
EROM Erasable Read Only Memory

F
FD Floppy Disk
FIFO First-In First-Out
FM Frequency Modulation

G
GDI Graphical Device Interface
GIGO Garbage In Garbage Out
GPRS General Packet Radio Service

H
HDD Hard Disk Drive
HTML HyperText Markup Language
HTTP HyperText Transfer Protocol

I
IBM International Business Machines (Corporation)
IC Integrated Circuit
IEEE Institute of Electrical and Electronics Engineers
IPTV Internet Protocol Television
ISDN Integrated Services Digital Network

J
JPEG Joint Photographic Experts Group
JVM Java Virtual Machine

K
KIPS Kodak Internet Print Service

L
LAN Local Area Network
LDAP Lightweight Directory Access Protocol
LIFO Last In First Out
LILO Last In Last Out
LISP List Processing (Language)(See HLL)
LPT Line Printer Terminal

M
MAC Multiple Access Computers
MAN Metropolitan Area Network
MAPI Mail/Messaging Applications Programming
MBps Megabytes Per Second
Mbps Megabits Per Second
MBR Master Boot Record
MCGA Multicolor Graphics Array
MD Make Directory
MFC Microsoft Foundation Class
MICR Magnetic Ink Character Recognition
MICRO One-millionth
MIDI Musical Instrument Digital Interface
MIME Multipurpose Internet Mail Extensions
MIMO Multiple Input Multiple Output
MIPS Million Instructions Per Second
MODEM Modulator/Demodulator
MOSFET Metal Oxide Semiconductor Field Effect Transistor
MP3 MPEG Audio Layer 3
MS-DOS Microsoft - Disk Operating System
MVGA Monochrome Video Graphics Array

N
NAND Not And
NANO One thousand-millionth
NIC Network Information CenterNetwork Interface Card
NVRAM Non-Volatile Random Access Memory

O
OCR Optical Character Recognition
ODBC Open Data Base Connectivity
OLAP Online Analytical Processing
OS/2 Operating System/2

P
PABX Private Automatic Branch Exchange
PAN Personal Area Network
PATA Parallel Advanced Technology Attachment
PBX Private Branch Exchange
PC Personal Computer
PIN Personal Identification Number
POP Post Office Protocol
POP3 Post Office Protocol Version 3
POST Power-On Self Test
PS/2 Programming System 2

R
RAID Redundant Arrays of Independent Disks
RAM Random Access Memory
RAND Random
RDBMS Relational Database Management System
RDO Remote Data Object
REGEDIT
Registry Editor [Microsoft]
RGB Red-Green-Blue
R/W Read/Write

S
SAP Systems Applications and Products
SATA Serial Advanced Technology Attachment
SDK Software Development Kit [Microsoft]
SHTML Server-Side Include HyperText Markup Language
SMS Short Message Service
SMTP Simple Mail Transfer Protocol
SPOOL Simultaneous Peripheral Operations On Line
SRAM Static Random Access Memory
STDIN Standard Input
STDOUT Standard Output
STP Shielded Twisted Pair
SVGA Super Video Graphics Array

T
TAG Technical Advisory Group
TASM Turbo Assembler [Borland]
TCP/IP Transmission Control Protocol/Internet Protocol
.TIF Tagged Image File (filename extension)
TOC Table Of Contents

U
UID User Identifier
UNIVAC Universal Automatic Computer
UPS Uninterruptible Power Supply/System
URI Uniform Resource Identifier
URL Uniform Resource Locator
USENET User's Network
UTP Unshielded Twisted-Pair (cable)
UUCP Unix-To-Unix Copy Protocol

V
VB Visual Basic
VBA Visual Basic for Applications
VDDM Virtual Device Driver Manager
VDISK Virtual Disk
VDM Virtual DOS Machine
VDU Video Display Unit
VEGA Video Enhanced Graphics Adapter
VESA Video Electronics Standards Association
VGA Video Graphics Array
VLSI Very Large Scale Integration

W
WAN Wide Area Network
WAP Wireless Application Protocol
WDM Wavelength Division Multiplexing
WIFI Wireless Fidelity
WML Wireless Markup Language
WORM Write Once Read Many
WSP Wireless Session Protocol
WWW World-Wide Web [Internet]
WXGA Wide Extended Graphics Array

WYSIWYG
What You See Is What You Get

X
XCOPY Extended Copy
XHTML Extensible HyperText Markup Language
XML Extensible Markup Language

Y
Y2K Year 2000


!!!Some common used abbreviation I am putting here, if you
fill some missing then can mail me.!!!

Wednesday, May 12, 2010

Recursion – Life Cycle- what you give that come back

In computer often, we have to use a recursive function. Often it is easy to perform a routine by using a recursive function than using a loop.

Recursive Function: is one that calls itself. A main function cannot be use as a recursive function. Must have a base function from which we call the recursive function and after at one point control will back to the same function.

Not all programming languages support recursion. Want to use Iteration (Loops) or Recursion it is dilemma, please follow these and take you decision :

  • Iteration is faster and occupies less memory.

  • In some problems will be easier using recursion.

  • All Recursive function may always be replace by iteration.

  • Converting Recursive function to iteration is called “unrolling”.

Advantage of Recursion

  • Expressive Power

  • Shorter code in recursion than iterative.

  • Problems it is more appropriate.


Disadvantage of Recursion

  • Slower than Iteration

  • Big programs will be very difficult to debug.

  • Use of more memory space

I will give a few Programs that use recursive function. Remember that every recursive function needs a logical escape route, otherwise system will hang.

In first program, I am giving you a factorial of ‘N’ number. I am using Integer declaration; it will work up to a smaller number only for big value use long or double. Also, check for negative values.




//Factrial using Recursion - C
#include <stdio.h>
#include <conio.h>
//sending n-1 and when value of n=1 the resul return to main function
static int fact(int n) //Recursive function
{
if(n<=1)
{
return n;// return to main program
}
else
{
return n*fact(n-1);// calling self
}
}

void main()
{
int n,f;
clrscr();
printf("Enter a No. : ");
scanf("%d",&n);
f=fact(n);
printf("Factorial of %d = %d ",n,f);
getch();
}



//Fibonacci Series - C
#include <stdio.h>
#include <conio.h>

int fibo(int n,int a,int b)
{
int c;
if(n<=1)
{
return 0;
}
else
{
c=a+b;
printf(" %d ",c);
return fibo(n-1,b,c);
}
}
//this main function we are not printing anything
void main()
{
int n;
clrscr();
printf("Enter a No. : ");
scanf("%d",&n);
n=fibo(n,1,0); // 1 and 0 the value of a and b
getch();
}


//Factrial using Recursion - Java

import java.io.*;
public class Rfactorial
{
//sending n-1 and when value of n=1 the resul return to main function
static int Rfact(int n) //Recursive function
{
if(n<=1)
{
return n; // return to main program
}
else
{
return n*Rfact(n-1); // calling self
}
}

public static void main(String args[])throws IOException
{
int n,f;
BufferedReader Br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter a No. : ");
n=Integer.parseInt(Br.readLine());
f=Rfact(n);
System.out.println("Factorial of "+n+" = "+f);
}
}



//Fibonacci Series - Java

import java.io.*;
public class Rfibo
{
static int fibo(int n,int a,int b)
{
int c;
if(n<=1)
{
return 0;
}
else
{
c=a+b;
System.out.print(c+" ");
return fibo(n-1,b,c);
}
}
//here in main function we are not printing anything
public static void main(String args[])throws IOException
{
int n;
BufferedReader Br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter a No. : ");
n=Integer.parseInt(Br.readLine());
n=fibo(n,1,0); // 1 and 0 the value of a and b
}
}


!!!Flying to Fiji Island and say you Moce Mada but in reply you have to say Vinaka!!!

Thursday, April 22, 2010

Arrays - that only moves between Rows and Columns

We already know that a variable cannot store more than one data at a time. Whenever we store a data in a variable it overwrite the old one. So if we want to store a same type of data and more than one we have no choice that we have to declare multiple variable. It is possible for small amount of data but not more, so here we need an array. Array is a variable with capability to store multiple data with an unique location can be compared with a cupboard with many racks.

What are Arrays?

To store similar types of data under a common variable name, instead of declaring N number of variables for the N number of data, we use an array. An array is a collection of similar type of variables under a common variable. Thus we can have a collection or Array of integers, floats, characters (which are known as strings), but remember that all elements of any given array must be of the same type, i.e. we cannot have an array of numbers some of which are int and some float etc. Either all should be int or all should be float or all should be char. The different components of an array are called the Array Elements. Arrays also known as subscripted variable

How to Declare an Array:

Like all other variables, an array needs to be declared first before it can be used. The declaration consists of stating the type of data-type used in the array, the name of the array and the number of elements in the array.

Data Type Array_Variable[ number of elements ] ;

Example :

(C or C++) : int age[20]; float salary[20]; char name[20];
In C/C++, char array indicate a String.
Java : int a[]=new int[20]; String name[]=new String[20];
Basic : dim n(10), a$(10)

Suppose we declare an array if integer with 5 elements, N[5] then

N[0]
N[1]
N[2]
N[3]
N[4]
Here N is variable and [0] to [4] is subscript or element location. When we input data in N[0] to N[4] location we can recall back in any point in that particular program. Above array also known as single dimensional array. We can initialize the array with a list of values.

Example :

(C or C++) : int age[4]={23,45,67,89};
char name[20]={"Anil","Sunil"};
Java : int a[]={1,5,6,7};
String name[]={1,5,6,7};

Initialization can be done when we use a fixed numbers of known data but there is no shortcut method to initialize large number of elements. Enter in data in an Array and printing back. Some example of Input and display the array elements.

C C++


#include<stdio.h>
#include <iostream.h>
#include<conio.h>

void main()
{
int N[5],i;
printf("\nEnter 5 Nos "); // cout<<"Enter 5 Nos. ";
for(i=0;i<5;i++)
{
scanf("%d",&N[i]); // cin>>N[i];
}
printf("\nNos in Array"); // cout<<"Nos in Array ";
for(i=0;i<5;i++)
{
printf("%d ",N[i]); // cout<<N[i];
}
getch();
}

Java


import java.io.*;
class Arrays
{
public static void main(String args[])throws IOException
{
BufferedReader Br=new BufferedReader(new InputStreamReader(System.in));
int N[]=new int[5], i;
System.out.print("Enter 5 Numbers : ");
for(i=0;i<5;i++)
{
N[i]=Integer.parseInt(Br.readLine());
}
System.out.print("\nNumbers in Array : ");
for(i=0;i<5;i++)
{
System.out.print(N[i]+" ");
}
}
}

Multi dimensional Arrays:

Where Single Dimensional Arrays has one column and multiple rows, multi-dimensional arrays has multiple rows as well as multiple columns. Milti-dimensional data structure also known as matrices. A multi-dimensional array with 3 rows and 3 columns is shown. There are two array subscripts. One subscript denotes the row & the other the column.

N[0][0]N[0][1]N[0][2]
N[1][0]N[1][1]N[1][2]
N[2][0]N[2][1]N[2][2]
data_type array_variable[row_size][column_size];
The declaration of two dimension arrays is as follows:
(C/C++) : int N[4][5] ;
Java : int N[][]=new int[4][5];

Here m is declared as a matrix having 4 rows( subscript from 0 to 3) and 5 columns subscript 0 through 4). The first element of the matrix is N[0][0] and the last row last column is N[3]4]. When a matrix declared with same numbers of rows and column, is known as square matrix. The initialization is done row by row. Initializes the elements (C/C++)

int N[2][3]={5,1,2,3,4,5};
int N[][]={{2,3,4},{4,5,6}};

Some example of Input and display the multi-dimensional array elements.

C C++


#include<stdio.h>
#include <iostream.h>
#include<conio.h>

void main()
{
int N[3][4],i,j;
printf("\nEnter 12 Nos "); // cout<<"Enter 12 Nos. ";
for(i=0;i<3;i++)
{
for(j=0;j<4;j++)
{
scanf("%d",&N[i][j]); // cin>>N[i][j];
}
}
printf("\nNos in Array"); // cout<<"Nos in Array ";
for(i=0;i<3;i++)
{
for(j=0;j<4;j++)
{
printf("%d ",N[i][j]); // cout<<N[i][j];
}
}
getch();
}

Java


import java.io.*;
class Arrays
{
public static void main(String args[])throws IOException
{
BufferedReader Br=new BufferedReader(new InputStreamReader(System.in));
int N[][]=new int[3][4], i,j;
System.out.print("Enter 5 Numbers : ");
for(i=0;i<3;i++)
{
for(j=0;j<4;j++)
{
N[i][j]=Integer.parseInt(Br.readLine());
}
}
System.out.print("\nNumbers in Array : ");
for(i=0;i<3;i++)
{
for(j=0;j<4;j++)
{
System.out.print(N[i][j]+" ");
}
}
}
}


!!!Its too hot around here, take you all the way to Canada and for time being
say you Matcaci!!!