Free Essay

Binary Numbers

In:

Submitted By darke1061
Words 653
Pages 3
Binary Numbers





Binary numbers are ”Base 2” numbers.
Binary numbers follow all the same rules as
Base 10 number (our decimal system)
Binary numbers are made up of combinations of 0's and 1's

Place Value – Base 10


Base 10 numbers have place value...
… 1,000's 100's 10's 1's
These are powers of 10....
1 = 100
10 = 101
100 = 102
1000 = 103 etc... 

Each place value increases by a factor of 10... hence
”Base 10”

Place Value – Base 2


Base 2 numbers have place value...
… 8's 4's 2's 1's
These are powers of 10....
1 = 20
2 = 21
4 = 22
8 = 23 etc... 

Each place value increases by a factor of 2... hence
”Base 2”

Binary to Decimal
Take the binary number 10110011...
To convert this to a decimal number, look at each digit and its place value.
Start with the right most digit (1). It is in the 1's place so it has a value of 1
(1x1=1).
The next right most digit is in the 2's place. It has a value of 2 (1x2=2).
The next right most digit is in the 4's place. It has a vlaue of 0 (0x4=0).
And so on....
1x27 + 0x26 + 1x25 + 1x24 + 0x23 + 0x22 + 1x21 + 1x20 = 179
So... 101100112 = 17910

Place Value - again...
So, to summarize... We are working with binary numbers as they pertain to IP addresses. Since an IP address contains 4 octets and each octed is a byte (or 8 bits), we need only remember the first 8 place values.... 128 64 32 16 8 4 2 1

Practice...


Try convering the following to decimal...
11000011
11110000
10101010
10011001
11111111

195
240
170
153
255

Decimal to Binary



Decimal to Binary is a bit more difficult...
First find the smallest power of 2 that is larger than the decimal number in question...
Ex. if the decimal is 55, then the smallest power of 2 larger than 55 would be 64 or 26.
This means we will need 6 bits to represent 55 in binary.

Conversion... Subtraction


Remember the powers of 2 for a byte (8 bits)
128

64

32

16

8

4

2

1

So, lets get back to 55 base 10... The six bits we require start at the
32's place and go down to the 1's place. So we can fill in a 0 for the 128's and the 64's...
0 0 __ __ __ __ __ __
Now we need to find the remaining bits. This is a subtraction process... Conversion – Subtaction (contd.)
0 0 __ __ __ __ __ __
Now we need to find the remaining bits. This is a subtraction process... So, take the original number (55) and see if the next place value goes into 55 (ie does 32 go into 55?).
Since 32 goes into 55, the next bit would be a 1 (it only goes in 1 time). We now have ...
0 0 1 __ __ __ __ __
And 55 – 32 is 23. Our new value is 23. The next place value is 16.
Are there any 16's in 23? Yes. The next bit is a 1.
0 0 1 1 __ __ __ __
And 23 – 16 is 7. The next place value is 8. Are there any 8's in 7?
NO! The next bit is a 0.

Conversion – Subtaction (contd.)
0 0 1 1 0 __ __ __
And our value is still 7. The next place value is 4. Are there any 4's in
7? Yes. The next bit is a 1 and our new value is 7­4=3.
0 0 1 1 0 1 __ __
Are there any 2's in 3, Yes. The next bit is a 1 and our new value is 3­
2=1.
0 0 1 1 0 1 1 __
This new (last) value becomes the last bit.
0 0 1 1 0 1 1 1
So, 5510 = 001101112

Similar Documents

Free Essay

Binary Numbers

...Binary Numbers Overview Binary is a number system used by digital devices like computers, cd players, etc.  Binary is Base 2, unlike our counting system decimal which is Base 10 (denary).  In other words, Binary has only 2 different numerals (0 and 1) to denote a value, unlikeDecimal which has 10 numerals (0,1,2,3,4,5,6,7,8 and 9).  Here is an example of a binary number: 10011100  As you can see it is simply a bunch of zeroes and ones, there are 8 numerals in all which make this an 8 bit binary number. Bit is short for Binary Digit, and each numeral is classed as a bit.  The bit on the far right, in this case a 0, is known as the Least significant bit (LSB).  The bit on the far left, in this case a 1, is known as the Most significant bit (MSB)  notations used in digital systems: 4 bits = Nibble 8 bits = Byte 16 bits = Word 32 bits = Double word 64 bits = Quad Word (or paragraph)  When writing binary numbers you will need to signify that the number is binary (base 2), for example, let's take the value 101. As it is written, it would be hard to work out whether it is a binary or decimal (denary) value. To get around this problem it is common to denote the base to which the number belongs, by writing the base value with the number, for example:  1012 is a binary number and 10110 is a decimal (denary) value.  Once we know the base then it is easy to work out the value, for example:  1012 = 1*22 + 0*21 + 1*20 = 5 (five)  10110 = 1*102 + 0*101 +...

Words: 647 - Pages: 3

Premium Essay

Is4670 Project

...A detailed search of the Web site has been conducted, and no files were found beyond the static HTML Web pages expected. Three workstations are used to update content on the Web site, and a network packet trace has been captured for traffic between the workstations and the internal FTP upload site for posting data to the Web server. This packet trace is available for your use. Once you understand the situation, your manager tells you to divide the investigation into three parts. The first part involves the use of NetWitness Investigator to identify user credentials, correlate source host address(s), and evaluate network traffic for unusual activity that might provide a starting point for your system forensic investigation. In the second part, you will use Paraben P2 Commander to examine a forensic system image and evaluate files, communications, and applications, which could be items of potential evidentiary value in this investigation. You will use your findings from the first part of the investigation to guide your selection of workstation(s) for review and user profile(s) for specific investigation. In the third part, you need to document your results along with the investigative process and any indicators you discovered that led to additional actions on your part. The investigation must be limited to the scope identified by these indicators, and all investigative actions should be supportable if you are called as an expert witness in later proceedings. AAA Computer...

Words: 1589 - Pages: 7

Free Essay

Random

...Solution: Number Of Nodes: 1. /* 2.  * C Program to Find the Number of Nodes in a Binary Tree 3.  */ 4. #include <stdio.h> 5. #include <stdlib.h> 6.   7. /* 8.  * Structure of node 9.  */ 10. struct btnode 11. { 12. int value; 13. struct btnode *l; 14. struct btnode *r; 15. }; 16.   17. void createbinary(); 18. void preorder(node *); 19. int count(node*); 20. node* add(int); 21.   22. typedef struct btnode node; 23. node *ptr, *root = NULL; 24.   25. int main() 26. { 27. int c; 28.   29. createbinary(); 30. preorder(root); 31. c = count(root); 32. printf("\nNumber of nodes in binary tree are:%d\n", c); 33. } 34. /* 35.  * constructing the following binary tree 36.  * 50 37. ...

Words: 1523 - Pages: 7

Premium Essay

Program Design & Development

...Questions Chapter 1 1.1 A program is a set of instructions that a computer follows to perform a task. 1.2 Hardware is all of the physical devices, or components, that a computer is made of. 1.3 The central processing unit (CPU), main memory, secondary storage devices, input devices, and output devices. 1.4 The CPU 1.5 Main memory 1.6 Secondary storage 1.7 Input device 1.8 Output device 1.9 One byte 1.10 A bit 1.11 The binary numbering system. 1.12 It is an encoding scheme that uses a set of 128 numeric codes to represent the English letters, various punctuation marks, and other characters. These numeric codes are used to store characters in a computer's memory. (ASCII stands for the American Standard Code for Information Interchange.) 1.13 Unicode 1.14 Digital data is data that is stored in binary, and a digital device is any device that works with binary data. 1.15 Machine language 1.16 Main memory, or RAM 1.17 The fetch-decode-execute cycle. 1.18 It is an alternative to machine language. Instead of using binary numbers for instructions, assembly language uses short words that are known as mnemonics. 1.19 A high-level language 1.20 Syntax 1.21 A compiler 1.22 An interpreter 1.23 A syntax error 1.24 The operating system 1.25 A utility program 1.26 Application software Chapter 2 2.1 Any person, group, or organization that is asking you to write a program. 2.2 A single function that the program must perform in order to satisfy the customer...

Words: 5516 - Pages: 23

Free Essay

Sdfsd Is D

...1. a. The number of nodes at level h is at most d^h. The total number of nodes in a tree of height h is at most 1 + d + ... + d^h = Θ(d^h). Setting d^h = n implies the height is Θ(logd n). b. same as binary heaps. running time is given by Heapify. Heapify operation on d-ary heaps is similar to the one on binary heaps: Heapify_D(A, i) i. find largest element l = max{A[i], Children(A[i])} ii. if l != i then exchange A[i] ↔ A[l] and Heapify D(A, i) The running time of Heapify d is Θ(d · logd n). The d term is because at each iteration a node compares its value and the values of its d children to find the maximum, which takes O(d) time. c. same as binary heaps. The running time is Θ(height) = Θ(logd n). d. The running time is O(logd n) if A[i] < k. Heap_Increase_Key _D(A, i, k) i. if A[i] < k then A[i] = k while i > 1 and A[Parent(i)] < A[i] do exchange A[i] ↔ A[Parent(i)] i = Parent(i) 2. log(n!) = log(1) + log(2) + ... + log(n-1) + log(n) log(1) + log(2) + ... + log(n) <= log(n) + log(n) + ... + log(n) = n*log(n) log(1) + ... + log(n/2) + ... + log(n) >= log(n/2) + ... + log(n)>= log(n/2) + ... + log(n/2) = n/2 * log(n/2) 3. T(n) is the best-case time for the procedure QUICKSORT on an input of size of n. T(n) = min (T(q) + T(n − q − 1)) + Θ(n)) 1≤q≤n−1 We guess that T(n) ≥ cn lg n -> T(n) ≥ min (cq lg q + c(n − q − 1) lg(n − q − 1)) + Θ(n) (1≤q≤n−1) = c min(q lg q + (n...

Words: 473 - Pages: 2

Free Essay

Astronomy Paper

...Astronomy paper Introduction: Searching for extra-solar planets is not a very easy task. Because most of the times we find them by not actually looking at them but by the effects they produce mainly on the star around which they are rotating. It is because planets look like just a dull spec of light through a telescope. The distance between us and a nearby planet is very large. In our scale model it will be like looking at a dust particle in Thunder Bay Ontario if we are sitting in Halifax with our telescope. That’s why astronomers have adopted various techniques to find extra-solar planets. In most of the techniques we focus on the star around which planets are rotating and by noticing the changes occurring in star we can decide whether that star has planet(s) or not. The following methods are used for that purpose. 1. Astrometry 2. Radial Velocity Method 3. Pulsar Timing 4. Transit Method 5. Gravitational Microlensing Astrometry: This is the oldest method used to search extra-solar planets. This planet is basically used to find the mass of thee planet. This method is based on the gravitational effect of planet on its host star. As the planet rotates around its star, it applies gravitational force on the star and makes the star to move under the effect of its (planet) gravity. Thus, both the star and the planet revolve around a common center of mass also called center of gravity. Thus, the position of star always keeps on changing, which...

Words: 2012 - Pages: 9

Free Essay

Dbms

...Information Retrieval P. BAXENDALE, Editor A Relational Model of Data for Large Shared Data Banks E. F. CODD IBM Research Laboratory, San Jose, California Future users of large data banks must be protected from having to know how the data is organized in the machine (the internal representation). A prompting service which supplies such information is not a satisfactory solution. Activities of users at terminals and most application programs should remain unaffected when the internal representation of data is changed and even when some aspects of the external representation are changed. Changes in data representation will often be needed as a result of changes in query, update, and report traffic and natural growth in the types of stored information. Existing noninferential, formatted data systems provide users with tree-structured files or slightly more general network models of the data. In Section 1, inadequacies of these models are discussed. A model based on n-ary relations, a normal form for data base relations, and the concept of a universal data sublanguage are introduced. In Section 2, certain operations on relations (other than logical inference) are discussed and applied to the problems of redundancy and consistency in the user’s model. KEY WORDS AND PHRASES: data bank, data base, data structure, data organization, hierarchies of data, networks of data, relations, derivability, redundancy, consistency, composition, join, retrieval language,...

Words: 9945 - Pages: 40

Free Essay

The Data Structure

...array 以行为主的顺序分配 row major order 以列为主的顺序分配 column major order 三角矩阵 truangular matrix 对称矩阵 symmetric matrix 稀疏矩阵 sparse matrix 转置矩阵 transposed matrix 链表 linked list 线性链表 linear linked list 单链表 single linked list 多重链表 multilinked list 循环链表 circular linked list 双向链表 doubly linked list 十字链表 orthogonal list 广义表 generalized list 链 link 指针域 pointer field 链域 link field 头结点 head node 头指针 head pointer 尾指针 tail pointer 串 string 空白(空格)串 blank string 空串(零串) null string 子串 substring 树 tree 子树 subtree 森林 forest 根 root 叶子 leaf 结点 node 深度 depth 层次 level 双亲 parents 孩子 children 兄弟 brother 祖先 ancestor 子孙 descentdant 二叉树 binary tree 平衡二叉树 banlanced binary tree 满二叉树 full binary tree 完全二叉树 complete binary tree 遍历二叉树 traversing binary tree 二叉排序树 binary sort tree 二叉查找树 binary search tree 线索二叉树 threaded binary tree 哈夫曼树 Huffman tree 有序数 ordered tree 无序数 unordered tree 判定树 decision tree 双链树 doubly linked tree 数字查找树 digital search tree 树的遍历 traversal of tree 先序遍历 preorder traversal 中序遍历...

Words: 1522 - Pages: 7

Free Essay

Nt 1110 Transfer Time

...Time and File Size Transfer Time 2 Abstract Calculating Transfer Rate, Transfer Time and File size can be pretty difficult unless one has a basic knowledge of binary numbers and the different types of storage capacities that are out there. In order to figure out how fast a download will take there is some math that needs to be figured out and in this paper I will mention the way to conquer this task. Transfer Time 3 Transfer Time and File Size The very first step to understanding transfer time and file size is to first know that 1 byte is equal to 8 bits as well as what each component is exactly. A bit is defined as:” a single basic unit of information, used in connection with computers and electronic communication”. (Quote, n.d.) A byte is “pronounced ‘bite’, is the next size up basic unit of measurement for information storage, usually consisting of 8 bits”. (Quote, n.d.) The next set of terms that are used is: Kilo (kilobytes) equal to 1,000 bits stated in decimal form or 1,024 bytes stated in binary form. Then we have Mega (megabytes) equal to 1,000,000 decimal bits or 1,048,576 binary bits. Next is one of the bigger bytes and that is Giga (gigabytes) which is equal to 1,000,000,000 decimal bits or 1,073,741,824 binary bits. After figuring out the numbers to these complex bits of information, the next step is to understand the speed of transferring data. This is simply downloading information and what speed is required to effectively...

Words: 1000 - Pages: 4

Free Essay

Sdaasdafcas

...be well organized with some suitable headings such as introduction that includes (a) your own preference/reason for choosing a particular application when others are also available, (b) anticipated results or findings and (c) how work/labor is divided among group members in case of a group work, (d) the main body that clearly shows a detailed process of realizing a particular practical application, and (e) conclusion that includes what you think you really have learned, if any, and what you think is the contributions/benefits of the application you explored. //** import java.util.*; public class BinarySearchTree //visibility modifier can be also private { public class TreeNode // an inner class of class BinarySearchTree, for binary trees { // 3 private instance variables //////////////////////////////////////////////////////// private int data; // visibility modifier can be also public or protected and // type can be also float, double, char, short, long or boolean private TreeNode leftLink; private TreeNode rightLink; // One constructor for TreeNode /////////////////////////////////////////////////////// public TreeNode(int newData, TreeNode newLeftLink, TreeNode newRightLink) { data = newData; leftLink = newLeftLink; rightLink = newRightLink; } } //End of TreeNode inner class // Declaration of class BinarySearchTree begins here....

Words: 543 - Pages: 3

Free Essay

Survey over Image Thresholding Techniques

...Journal of Electronic Imaging 13(1), 146 – 165 (January 2004). Survey over image thresholding techniques and quantitative performance evaluation Mehmet Sezgin ¨ ˙ Tubıtak Marmara Research Center Information Technologies Research Institute Gebze, Kocaeli Turkey E-mail: sezgin@btae.mam.gov.tr ¨ Bulent Sankur ˇ ¸ Bogazici University Electric-Electronic Engineering Department Bebek, ˙stanbul I Turkey Abstract. We conduct an exhaustive survey of image thresholding methods, categorize them, express their formulas under a uniform notation, and finally carry their performance comparison. The thresholding methods are categorized according to the information they are exploiting, such as histogram shape, measurement space clustering, entropy, object attributes, spatial correlation, and local gray-level surface. 40 selected thresholding methods from various categories are compared in the context of nondestructive testing applications as well as for document images. The comparison is based on the combined performance measures. We identify the thresholding algorithms that perform uniformly better over nondestructive testing and document image applications. © 2004 SPIE and IS&T. [DOI: 10.1117/1.1631316] 1 Introduction In many applications of image processing, the gray levels of pixels belonging to the object are substantially different from the gray levels of the pixels belonging to the background. Thresholding then becomes a simple but effective tool to separate objects from the background...

Words: 16889 - Pages: 68

Free Essay

It265 Db

...referred to as a node and the root is located on the top. The only way I can explain this, is by using a figure we all see every day. Look at a tree upside down, that is what we are talking about. The group that the B-Tree belongs too is called a self-balancing search tree. What this does is to automatically keeping the number of it levels in tacked. There is a few terms that we must know, key. A key is a value of data that is searched from an index. A rid is what is call or referred to as a record ID. The nodes are broken down in to two categories; those are referred to as internal index nodes and leaf nodes. The internal index nods stores each value of keys and page identifiers. The leaf node stores the actual keys. Question 2) Explain the details of a binary tree A binary tree is a data structure that was nodes that have two nodes called child nodes. These nodes are located on the left and right side. On a binary tree the parent nodes was two children nodes and that is the max for each parent. There are different types of binary trees and some of them are called; full binary tree, rooted binary tree and complete binary tree just to name a few. Question 3) What are real world examples of tree implementations One example that I can give is 3D games. There are many games out there and on many different systems. Not only are there games on the WII or X-Box but there are becoming more popular on media sites like facebook. How does it work...

Words: 590 - Pages: 3

Free Essay

Optimum Thresholding Using Fuzzy Techniques

...Dissertation Phase-I: Synopsis Topic: OPTIMUM THRESHOLDING USING FUZZY TECHNIQUES Guided by- Presented by- Mr.Puneet Manocha Anupama (Roll No.1600872) Assit. Professor IIIrd Semester, M.Tech (ICE) OBJECTIVE: * To review different research papers based on Fuzzy Thresholding. * To apply fuzzy thresholding technique to an image * To calculate optimum threshold using Gamma membership function. LITERATURE REVIEW: Introduction: Typical computer vision applications usually require an image segmentation-preprocessing algorithm as a first procedure. At the output of this stage, each object of the image, represented by a set of pixels, is isolated from the rest of the scene. The purpose of this step is that objects and background are separated into non-overlapping sets. There are various techniques of segmentation and among them threshold is much simpler than other segmentation techniques. Usually, this segmentation process is based on the image gray-level histogram. In that case, the aim is to find a critical value or threshold. Through this threshold, applied to the whole image, pixels whose gray levels exceed this critical value are assigned to one set and the rest to the other. For a well-defined image, its histogram has a deep valley between two peaks. Around these peaks the object and background...

Words: 2221 - Pages: 9

Free Essay

Something

...NAME: Sufyan Shahid SUBTREE MINER SUBTREE MINER: This project is about mining of frequent subtree in a parent tree. This type of algorithms are used in web mining, data mining and network mining. For Example: In Google when we search anything and imagine if all the data in Google data base is saved as tree, so, when we search, it gives all the subtree, its relative patterns and output it. In this program, there is a parent tree and input subtree, this program will search whether the input is in the parent tree and number of occurrence of subtree in parent tree. Let, 5,3,4,5,3,4,5,3,4,5,3,4,5,3,4 5,3,4 Are the elements of binary tree in level order are the elements of Binary tree in level order 5 5 3 4 3 4 5 4 3 5 3 4 5 4 3 5 3 4 G ...

Words: 301 - Pages: 2

Free Essay

Treap Data Structure

...Assignment: Binary Search Tree + Heap = Treap October 10, 2012 Binary search tree, as shown in figure 1, is a binary tree data structure which is used to hold key-value pairs and satisfies following properties; • The left subtree of any node contains only those nodes with keys less than the node’s key. • The right subtree of any node contains only those nodes with keys greater than the node’s key. key=10 val="AU" key=8 val="BN" key=15 val="TN" key=12 val="NZ" key=17 val="DL" key=19 val="IN" Figure 1: An example Binary Search Tree These ordering constraints help to find out a node with a given key in O(log n) average time. Insertion and deletion operations in BST (Binary search tree) must maintain these ordering constraints. prio: 8 val: "IN" prio: 15 val: "NZ" prio: 18 val: "AU" prio: 25 val: "TN" prio: 30 val: "BN" prio: 20 val: "AP" prio: 22 val: "RS" Figure 2: An example min-heap Heap is an another binary tree data structure, as shown in figure 2, which is useful in sorting (heapsort) and implementing a priority queue. A heap can be a min-heap or a max-heap based on the priority of a node with respect to the 1 priority of its left and right children. In case of min-heap each node has lesser priority than its children. In case of max-heap each node has higher priority than its children. In this assignment we are going to implement a binary tree data structure which is a combination of BST and heap. This data structure is called Treap...

Words: 1803 - Pages: 8