# ODU CS 419 - Elements of Computer Science (15 pages)

Previewing pages 1, 2, 3, 4, 5 of 15 page document
View Full Document

## Elements of Computer Science

Previewing pages 1, 2, 3, 4, 5 of actual document.

View Full Document
View Full Document

## Elements of Computer Science

21 views

Pages:
15
School:
Old Dominion University
Course:
Cs 419 - Internet Databases

Unformatted text preview:

CS149D Elements of Computer Science Ayman Abdel Hamid Department of Computer Science Old Dominion University Lecture 2 8 29 2002 Lecture 2 8 29 2002 CS149D Fall 2002 1 Outline Number Systems Decimal Binary Octal Hexadecimal Binary addition Representing Negatives Two s complement notation and addition Overflow problem Today s lecture covers sections 1 4 1 5 and 1 6 in Brookshear text Lecture 2 8 29 2002 CS149D Fall 2002 2 Introduction All computers use the binary number system base 2 basic nature of electronic circuits ON OFF TRUE FALSE current flow does not flow Machine alphabet has two letters 0 1 Each letter is a binary digit bit Byte is 8 bits Lecture 2 8 29 2002 CS149D Fall 2002 3 Number Systems Numbers can be represented in any base humans use base 10 Symbols for a number system of base B are 0 1 2 B 1 decimal base 10 0 1 2 9 binary base 2 0 1 notation numberB 375 in decimal is written 37510 1011 in binary is written 10112 Value of ith digit d is d Bi where i starts from 0 and increases from right to left 210 i 375 d 5 100 5 7 10 1 70 3 102 300 Lecture 2 8 29 2002 positional notation CS149D Fall 2002 Three hundred and seventy five 4 Conversion from binary to decimal Convert 10112 to decimal 3210i 1011d 1 20 1 21 0 22 1 23 1 2 0 8 1110 This process can be used for conversion from any number system to decimal TRY convert 1238 to decimal Lecture 2 8 29 2002 CS149D Fall 2002 5 Conversion from decimal to binary Step 1 divide value by 2 and record remainder Step 2 as long as quotient not zero continue to divide the newest quotient by 2 and record the remainder Step 3 when obtain a zero as quotient binary representation consists of remainders listed from right to left in order Convert 1310 to binary Operation Quotient remainder 13 by 2 6 1 6 by 2 3 0 3 by 2 1 1 1 by 2 0 1 1310 11012 Lecture 2 8 29 2002 CS149D Fall 2002 6 Other Number Systems Octal base 8 Symbols 0 1 2 3 4 5 6 7 Working with too long binary numbers is a problem Hexadecimal base 16 Symbols 0 1 2 3 4 5 6

View Full Document

Unlocking...