Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Bits & Bytes OR OffOn Bit = Binary Digit (or Binary Digit) = {0, 1} Bits.

Slides:



Advertisements
Similar presentations
Citavi – Attaching Ebook Chapters from EBSCOhost to Reference Records.
Advertisements

Advanced Topics Object-Oriented Programming Using C++ Second Edition 13.
Binary number, Bits and Bytes and memory Sen Zhang.
Binary & Decimal numbers = 3* * *10 + 5*1 = 3* * * *10 0 Decimal system: Ten digits: 0,1,2,3,…,9 Example:
Level ISA3: Information Representation
66 CHAPTER SYSTEM UNIT. © 2005 The McGraw-Hill Companies, Inc. All Rights Reserved. 1-2 Announcement: Major Exam 01 Thursday, 17th March, 2005 Building.
The Binary Number System 6 th grade math. What is binary? The number system we use is decimal, based on the number 10 The binary system is instead based.
Computer Systems Nat 4/5 Computing Science Lesson 1: Binary.
Chapter 1 1 Number Systems. 2 Objectives  Understand why computers use binary (Base-2) numbering.  Understand how to convert Base-2 numbers to Base-
Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Basic Data Types Note that the methods we used to convert from decimal.
RM2F Input / Output (I/O) Pin grouping code!. I/O Pin Group Operations: The Spin language has provisions for assigning values to groups of bits in the.
STATISTIC & INFORMATION THEORY (CSNB134)
Chapter 5 Section 5 Counting Techniques.
5.5 Counting Techniques. More Challenging Stuff  The classical method, when all outcomes are equally likely, involves counting the number of ways something.
1 Survey of Computer Science CSCI 110, Spring 2011 Lecture 16 Digital Circuits, binary Numbers.
Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Strings Do we need to convert integers (or longs, or floats) to strings.
Boolean math is the cornerstone of digital communications, whether you are talking computers, PLC, or Cisco Routers on the Internet. ©Emil Decker, 2009.
Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Bits and Bytes There was one other problem with bytes: Compatibility Compatibility.
Computer Systems Chapter 1 Pages Hardware-physical pieces Key hardware components in a computer system: The physical parts. – Central processing.
Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Basic Data Types Chapter 2 Basic Data Types.
What is RAM? Nick Sims.
Data Types and Representation CS French Chapter 6 + Chapter 7 – Number Bases.
Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Bits and Bytes How Many bits (or ‘doughnuts’) do we really need? Good question!
Slide Slide 1 Copyright © 2007 Pearson Education, Inc Publishing as Pearson Addison-Wesley. Lecture Slides Elementary Statistics Tenth Edition and the.

Math Review Do you remember, from math class, how exponentiation operations are typically represented? anan is known as the "base" a is known as the "base"
Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Basic Data Types Floating-Point (real) numbers Consider the Number:4,
Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Basic Data Types Remember when we first talked about the different combinations.
Chapter 7—Objects and Memory The Art and Science of An Introduction to Computer Science ERIC S. ROBERTS Java Objects and Memory C H A P T E R 7 Yea, from.
Cosc 2150: Computer Organization Chapter 2 Part 1 Integers addition and subtraction.
Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Dynamic Memory Allocation Suppose we defined the data type: struct custrec.
Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Basic Data Types Characters vs. Numbers Adding in Binary: There are only.
Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft RAM Allocation Chapter 3.
Data Representation Bits, Bytes, Binary, Hexadecimal.
Binary A double zero educational presentation. Binary Basics Binary is the language computers use Only 1’s and 0’s can be found in Binary Very large numbers.
1 Ethics of Computing MONT 113G, Spring 2012 Session 1 Digital Circuits, binary Numbers Course webpage:
Number Systems by Dr. Amin Danial Asham. References  Programmable Controllers- Theory and Implementation, 2nd Edition, L.A. Bryan and E.A. Bryan.
Exploring Computer Science – Lesson 2-5. Click to add text.
Technology in Action Chapter 6 Behind the Scenes: A Closer Look at System Hardware.
Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Strings Chapter 5.
Computer Systems Nat 4/5 Computing Science Lesson 1: Binary.
PHY 201 (Blum)1 Shift registers and Floating Point Numbers Chapter 11 in Tokheim.
Logarithms. Strings of bits There is only one possible zero-length sequence of bits There are two possible “sequences” of a single bit: 0, 1 There are.
CHAPTER 2. Open Circuits Closed Circuits  Open Switch = device is off  Stops the circuit  Closed switch = device is on  Batteries have connections.
Binary 101 Gads Hill School. Aim To strengthen understanding of how computers use the binary number system to store information.
Divisibility Rules Outcome A6 – Develop and apply divisibility rules for 3, 4, 6, 9.
PHY 201 (Blum)1 Shift registers and Floating Point Numbers Chapter 11 in Tokheim.
Computer Studies Today Chapter 19 1 Chapter 19. Computer Studies Today Chapter 19 2 »Information stored in a computer is in two states: –ON –OFF.
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
Math Review Do you remember, from math class, how exponentiation operations are typically represented? an a is known as the "base" n is known as the "exponent".
Cosc 2150: Computer Organization
Binary & Decimal numbers
Bits and Bytes Bits and Bytes Chapter 1.
NUMBER SYSTEMS.
Lesson Objectives Aims You should be able to:
EGR 2261 Unit 10 Two-dimensional Arrays
Exploring Computer Science – Lesson 2-5
BINARY CODE.
Representation of data in computer systems
Other Kinds of Arrays Chapter 11
Number Systems.
Binary / Hex Binary and Hex The number systems of Computer Science.
Chapter 2: Number Systems
Unsigned Binary Encoding
Logarithms.
How to Represent Numbers on a Computer
The basics of any electronic device means either electricity is flowing or it is not i.e. a switch is either on or off Computers are electronic devices.
Information Technology Department
Shift registers and Floating Point Numbers
Course Code 114 Introduction to Computer Science
Presentation transcript:

Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Bits & Bytes OR OffOn Bit = Binary Digit (or Binary Digit) = {0, 1} Bits Assume you wish to send a message using a Light Switch A binary condition since the light switch can be either: Any binary condition can be represented with a single light switch : Good OR Bad Yes OR No Male OR Female Dead OR Alive

Page 2 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft But, what if there are more than two states? What if I want to represent the conditions GOOD, SO-SO, and BAD???? Add more Light SwitchesSimple ….. If there are 2 light switches, the total combinations are: #1#2#3#4 Off 0 Off 0 Off 0 On 1 Off 0 On 1 On 1 On 1 Interpreted as: Bad Interpreted as: So-So Interpreted as: Good Not Used

Page 3 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Bits and Bytes If I can transmit 4 messages with two bits, how many could I transmit if I had 3 bits? Or 4 bits? With 3-bits, there are 8 possible combinations: And, with 4-bits, there are 16 possible combinations:

Page 4 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Bits and Bytes Is there any way to know how many messages we could transmit for a given number of bits without having to test all possible combinations?? As in Decimal (base 10), it is possible to determine how many messages can be transmitted for any number of decimal places. In Binary (base 2), the same calculations are made, but using bits (instead of decimals). Decimal Number Number Number Places Messages Bits Messages = = = = = = = 1, = = 10, = = 100, = = 1,000, = = 10,000, = = 100,000, = =1,000,000, = =10,000,000, = 1,024

Page 5 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Bits and Bytes The General formula is: I = B n where: I = The amount of Information (messages) available B = The base we are working in (Decimal or Binary) n = The number of digits (decimals or bits) we have Applying the formula to both decimal and binary values: 10 0 = 12 0 = = = = = = 1, = = 10, = = 100, = = 1,000, = = 10,000, = = 100,000, = = 1,000,000, = = 10,000,000, = 1,024

Page 6 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Bits and Bytes What if I Know how much information (I = Number of Messages) I want to transmit. How do I determine the number of bits I need? Just reverse the process. If I = 10 n (decimal) OR I = 2 n (binary) then log(I) = n log(10) log(I) = n log(2) log(I) log(I) log(I) log(I) And n = = n = = log(10) log(2) = log(I) Since = 2 Information Decimals Needed Bits Needed 10 log(10) = log(10)/log(2) = 1.000/ = log(50) = log(50)/log(2) = 1.699/ = log(100) = log(100)/log(2) = 2.000/ = log(500) = log(500)/log(2) = 2.699/ = ,000 log(1000) = log(1000)/log(2) = 3.000/ = ,000 log(10000) = log(10000)/log(2) = 4.000/ = 13.29

Page 7 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Bits and Bytes How can we have partial bits (or decimals)? For example, how can we have 5.64 bits to represent 50 messages? We Can’t The formula given should have been: log(I) log(I) Where: n = = log(2) is the ceiling of the result (i.e., rounded up) And the number of bits needed would be: Messages Bits Needed 10 log(10)/log(2) = 1.000/ = 3.32 = 4 50 log(50)/log(2) = 1.699/ = 5.64 = log(100)/log(2) = 2.000/ = 6.64 = log(500)/log(2) = 2.699/ = 8.97 = 9 1,000 log(1000)/log(2) = 3.000/ = 9.97 = 10 10,000 log(10000)/log(2) = 4.000/ = = 14

Page 8 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Bits and Bytes Notice that we could have predicted that, for example, it would take 6 bits to represent 50 pieces of information since: 2 5 = 32 and 2 6 = 64 If we need 6 bits to represent 50 pieces of information, and we could represent 64 pieces of information, what happens to the remaining 16 pieces of information? They either remain unused, or are available for future use

Page 9 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Bits and Bytes What does this have to do with Computers? If we were to look inside a computer (especially earlier ones) we might see a series of ‘doughnuts’: Which were merely metal rings with wires running through them Depending on whether there was voltage running through them or not (actually, high voltage or low voltage) the series represented a sequence of messages. A BINARY SITUATION!

Page 10 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Bits and Bytes Notice that since there are 5 ‘doughnuts’, there are 2 5 or 32 Combinations Where and represent the different voltage states

Page 11 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft This Concludes The Slides for this Section  Repeat Slides for this SectionRepeat Slides for this Section  Go To Next Set of Slides For this ChapterGo To Next Set of Slides For this Chapter  Go To Slide Index For Chapter 1Go To Slide Index For Chapter 1  Go To Slide Index For Chapter 2Go To Slide Index For Chapter 2  Go To Slide Index For TextbookGo To Slide Index For Textbook  Go To Home PageGo To Home Page Choose an Option: