In which order will this computer sort the strings 23

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ules are observed: 1. Letters are considered in alphabetic order (A < B < C < ... <Z) 2. Digits are considered in numeric order (0 < 1 < 2 < ... <9). Example 4.11. Suppose a computer uses EBCDIC as its internal representation of characters. In which order will this computer sort the strings 23, Al, 1A? Solution: In EBCDIC, numeric characters are treated to be greater than alphabetic characters. Hence, in the said computer, the numeric characters will be placed after the alphabetic characters and the given string will be treated as: Al <1A<23 Therefore, the sorted sequence will be: Al, 1A, 23. Example 4.12 Suppose a computer uses ASCII for its internal representation of characters. In which order will this computer sort the strings 23, Al, 1A? Solution: In ASCII, nuirieric characters are treated to be less than alphabetic characters. Hence, in the said computer, the numeric characters will be placed before the alphabetic characters and the given string will be treated as: 23<1A<A1 Therefore, the sorted sequence will be: 23, 1 A, Al. Points To Remember 1. Binary coding schemes are used in computers to represent data internally. In binary coding, every symbol that appears in the data is represented by a group of bits. The group of bits used to represent a symbol is called a byte. Most modern computers use 8 bits to represent a symbol. Hence the term byte is commonly used to mean a group of 8 bits. 2. The commonly used computer codes for internal representation of data are BCD, EBCDIC and ASCII. 3. BCD {Binary Coded Decimal) is a 6-bit code, which can represent 64 different characters. Because BCD is a 6-bit code, it can be easily divided into two 3-bit groups. Each of these 3-bit groups can be represented by 1 octal digit. Thus octal number system is used as shortcut notation for memory dump by computers that use BCD code for internal representation of characters. 4. EBCDIC {Extended Binary-Coded Decimal Interchange Code) is an 8-bit code, which can represent 256 different characters. Because EBCDIC is an 8-b...
View Full Document

This document was uploaded on 04/07/2014.

Ask a homework question - tutors are online