SlideShare a Scribd company logo
1 of 29
Download to read offline
BALOGUN JEREMIAH ADEMOLA
ASSISTANT LECTURER,
DEPARTMENT OF COMPUTER SCIENCE AND MATHEMATICS
MOUNTAIN TOP UNIVERSITY, OGUN STATE, NIGERIA
β–ͺ Definition of Computer
β–ͺ History and Overview of Computing and Computers
β–ͺ Evolution of Ideas and Machines from Mechanical Computer to Multimedia Computer
β–ͺ Introduction to computing system
β–ͺ Basic elements of a computer system hardware
β–ͺ Block diagram, data/instruction flow, control flow
β–ͺ Software types, packages and applications
β–ͺ Characteristics of computer
β–ͺ Problem solving using flowcharts and algorithms
β–ͺ Data representation in computer system
β–ͺ Communications and networks
β–ͺ World wide web, network access, network architectures, data communications. Safety and security
β–ͺ File management in Windows and basic word processors, spreadsheets, presentation, graphics
and other applications
β–ͺ Introduction to programming:
β–ͺ Statements, symbolic names, arrays, expressions and control statements
2
3
β–ͺ Problem Solving is the sequential process of analysing information related to a
given solution and generating appropriate response options.
β–ͺ Examples of tasks include:
β–ͺ If you are watching a news channel on your TV and you want to change it to a sports channel, you
need to do something.
β–ͺ A student is ready to go to school but yet he/she has not picked up those books and copies which
are required as per timetable.
β–ͺ If someone asks to you, what is time now?
β–ͺ Some students in a class plan to go on picnic and decide to share the expenses among them.
β–ͺ There are six (6) steps that should be followed in problem solving:
β–ͺ Understand the problem
β–ͺ Formulate the model
β–ͺ Develop an algorithm
β–ͺ Write a program
β–ͺ Test the program
β–ͺ Evaluate the solution
4
β–ͺUnderstanding the Problem
β–ͺThe first step to solving any problem is to make sure that you
understand the problem that you are trying to solve.
β–ͺYou need to know:
β–ͺ What input data/information is available ?
β–ͺ What does it represent ?
β–ͺ What format is it in ?
β–ͺ Is anything missing ?
β–ͺ Do I have everything that I need ?
β–ͺ What output information am I trying to produce ?
β–ͺ What do I want the result to look like … text, a picture, a graph … ?
β–ͺ What am I going to have to compute ?
5
β–ͺFormulate a Model
β–ͺ Now we need to understand the processing part of the problem.
β–ͺ Many problems break down into smaller problems that require some kind of
simple mathematical computations in order to process the data.
β–ͺ If there is no such β€œformula”, we need to develop one.
β–ͺ Often, however, the problem breaks down into simple computations that we well
understand.
β–ͺ Sometimes, we can look up certain formulas in a book or online if we get stuck.
β–ͺ In order to come up with a model, we need to fully understand the information
available to us.
6
β–ͺDevelop and Algorithm
β–ͺ An algorithm is a precise sequence of instructions for solving a problem.
β–ͺ To develop an algorithm, we need to represent the instructions in some way that is
understandable to a person who is trying to figure out the steps involved.
β–ͺ Two commonly used representations for an algorithm is by using:
β–ͺ pseudo code; or
β–ͺ flow charts.
β–ͺ Pseudocode is a simple and concise sequence of English-like instructions to solve
the problem unlike Flowcharts which are graphical.
β–ͺ Pseudocode is often used as a way of describing a computer program to someone who
doesn’t understand how to program a computer.
β–ͺ When learning to program, it is important to write pseudocode because it helps you
clearly understand the problem that you are trying to solve.
7
8
9
β–ͺConsider the pseudo-code of the broken lamp shown earlier.
β–ͺVarious parts of the pseudo-code could be explained as follows:
β–ͺ Sequence – listing instructions step by step in order
β–ͺ Condition – making decision and doing one thing or something else depending on the
outcome of the decision
10
β–ͺ Repetition – repeating something a fixed number of times or until some conditions
occurs
β–ͺ Storage – storing information for use in instructions further down the list
β–ͺ Jumping – being able to jump to a specific step when needed
11
β–ͺWrite the Program
β–ͺ Writing a program is often called writing code or implementing an algorithm.
β–ͺ The code (or source code) is actually the program itself.
β–ͺ In the figure below, the code looks quite similar in structure to the pseudocode,
however, the processing code is less readable and seems somewhat more
mathematical.
β–ͺ At this stage, the program is compiled by the computer.
β–ͺ Compilation is the process of converting a program into instructions that can be
understood by the computer. 12
β–ͺTest the Program
β–ͺ Running a program is the process of telling the computer to evaluate the
compiled instructions.
β–ͺ When you run your program, if all is well, you should see the correct output.
β–ͺ It is possible however, that your program works correctly for some set of data input
but not for all.
β–ͺ If the output of your program is incorrect, it is possible that you did not convert your
algorithm properly into a proper program.
β–ͺ It is also possible that you did not produce a proper algorithm back in step 3 that
handles all situations that could arise.
β–ͺ Maybe you performed some instructions out of sequence.
β–ͺ Whatever happened, such problems with your program are known as bugs.
β–ͺ Bugs are problems/errors within a program that causes it to stop working or
produce incorrect or undesirable results.
β–ͺ As a result of this, the reasons for these bugs must be found and corrected. 13
β–ͺEvaluate the Solution
β–ͺ Once your program produces a result that seems correct, you need to re-consider the
original problem and make sure that the answer is formatted into a proper solution to the
problem.
β–ͺ It is often the case that you realize that your program solution does not solve the problem the
way that you wanted it to.
β–ͺ You may realize that more steps are involved.
β–ͺ It is also possible that when you examine your results, you realize that you need
additional data to fully solve the problem.
β–ͺ Or, perhaps you need to adjust the results to solve the problem more efficiently.
β–ͺ It is important to remember that the computer will only do what you told it to do.
β–ͺ It is up to you to interpret the results in a meaningful way and determine whether or not it solves
the original problem.
β–ͺ It may be necessary to re-do some of the steps again, perhaps going as far back as step 1 again,
if data was missing 14
15
β–ͺ Data representation is a major part of the software-hardware interface.
β–ͺ As a result of this, data need to be represented in a convenient way that simplifies
β–ͺ The common operations, such as: addition, subtraction, comparison etc.
β–ͺ Hardware implementation thus making them faster cheaper, and more reliable.
β–ͺ The Bit is short for Binary digit – the smallest amount of meaningful information
stored on a computer.
β–ͺ The advantage includes:
β–ͺ Too little information per bit (each bit stores 2 possible states)
β–ͺ In order to store more information, one needs more bits.
β–ͺ The disadvantage includes:
β–ͺ It is easy to do computation with bits
β–ͺ They are more reliable
β–ͺ Used to construct simpler digital circuits. 16
β–ͺ All number are represented using a polynomial standard representation which is a
sum of the product of each digit with the power of its base representation.
β–ͺ Consider an n digit number with the most significant digit on the left and the least
significant digit on the right
β–ͺ Given a base representation b for each digit π‘Žπ‘–, then:
(π‘Žπ‘› Γ— π‘π‘›βˆ’1) + (π‘Žπ‘›βˆ’1 Γ— π‘π‘›βˆ’2) + β‹― + (π‘Ž2 Γ— 𝑏1)+(π‘Ž1 Γ— 𝑏0)
β–ͺ where 0 ≀ 𝑖 ≀ 𝑛 βˆ’ 1
β–ͺ Decimal Representations
β–ͺ If a number is in base 10, then the number 56432 can be represented as:
(5Γ— 104) + (6 Γ— 103) + (4 Γ— 102) + (3 Γ— 101)+(2 Γ— 100)
β–ͺ Binary Representations
β–ͺ If a number is in base 2, then the number 101012 can be represented as:
(1Γ— 24
) + (0 Γ— 23
) + (1 Γ— 22
) + (0 Γ— 22
)+(1 Γ— 20
)
17
β–ͺ The general idea behind positional numbering systems is that a numeric value is
represented through increasing powers of a radix (or base number).
β–ͺ The popular number systems to be considered are presented as follows:
β–ͺ There are two important groups of number base conversions:
β–ͺ Converting decimal numbers to base-r numbers
β–ͺ Converting base-r numbers to decimal numbers
18
Number System Radix Allowable Digits
Binary 2 0, 1
Octal 8 0, 1, 2, 3, 4, 5, 6, 7
Decimal 10 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Hexadecimal 16 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
β–ͺ Convert 10410 to base 3 using
the division-remainder method
β–ͺ 10410= 102123
19
β–ͺ Convert 14710 to base 2 using
the division-remainder method
β–ͺ 14710 = 100100112
β–ͺ Other bases can be converted to base 10 using the standard polynomial
expressions shown earlier.
β–ͺ Given a base representation b for each digit π‘Žπ‘–, then:
(π‘Žπ‘› Γ— π‘π‘›βˆ’1
) + (π‘Žπ‘›βˆ’1 Γ— π‘π‘›βˆ’2
) + β‹― + (π‘Ž2 Γ— 𝑏1
)+(π‘Ž1 Γ— 𝑏0
)
β–ͺ where 0 ≀ 𝑖 ≀ 𝑛 βˆ’ 1
β–ͺ For example,
β–ͺ 𝟏𝟎𝟎𝟏𝟏𝟐 = (1Γ— 24) + (0 Γ— 23) + (0 Γ— 22) + (1 Γ— 22)+(1 Γ— 20) = 16+0+0+4+1
β–ͺ πŸπŸ”πŸ‘πŸ’πŸ– = (2Γ— 83
) + (6 Γ— 82
) + (3 Γ— 81
) + (4 Γ— 80
) = 512+384+24+4
β–ͺ π‘¨π‘¬πŸ”πŸ‘π‘ͺπŸπŸ” = (10Γ— 164) + (15 Γ— 163) + (6 Γ— 162) + (3 Γ— 162)+(C Γ— 160)
20
β–ͺ Other fractional bases can be converted to base 10 using the standard
polynomial expressions.
β–ͺ Consider, a set of digits π‘Žπ‘– occurring after the decimal point of a fraction expressed
in a given base, b; the fraction can be converted to decimal fraction according to:
(π‘Ž1 Γ— π‘βˆ’1) + (π‘Ž2 Γ— π‘βˆ’2) + β‹― + (π‘Žπ‘›βˆ’1 Γ— π‘βˆ’(π‘›βˆ’1))+(π‘Žπ‘› Γ— π‘βˆ’π‘›)
β–ͺ Where n is the number of digits on the right hand side of the decimal point
β–ͺ For example,
β–ͺ 𝟎. 𝟏𝟏𝟎𝟏𝟐 = (1Γ— 2βˆ’1) + (1 Γ— 2βˆ’2) + (0 Γ— 2βˆ’3) +(1 Γ— 2βˆ’1) = 0.5+0.25+0+0.0625
β–ͺ 𝟎. πŸ’πŸπŸ“πŸ– = (4Γ— 8βˆ’1) + (2 Γ— 8βˆ’2) + (5 Γ— 8βˆ’3) = 0.5+0.03125+0.009765625
β–ͺ 𝟎. π‘¬πŸπ‘¨π‘ͺπŸπŸ” = (15 Γ— 16βˆ’1) + (2 Γ— 16βˆ’2) + (10 Γ— 16βˆ’3) +(𝐢 Γ— 16βˆ’4)
21
β–ͺ Putting the conversion of the whole part and the fractional part together, it is
now possible to convert any mixed fraction of a given base into a base 10
number.
β–ͺ For example:
β–ͺ 𝟏𝟎𝟏𝟏. 𝟎𝟏𝟐 = (1 Γ— 23) + (0 Γ— 22) + (1 Γ— 21) + (1 Γ— 20) + (0 Γ— 2βˆ’1) + (1 Γ— 2βˆ’2) =
8 + 0 + 2 + 1 + 0 + 0.25 = 11.25
β–ͺ πŸ”πŸ“πŸ‘. πŸπŸ‘πŸ– = (6 Γ— 82) + (5 Γ— 81) + (3 Γ— 80) + (2 Γ— 8βˆ’1) + (3 Γ— 8βˆ’2) = 384 + 40 +
0 + 0.25 + 0.046875 = 424.296875
β–ͺ πŸπŸ—. π‘¬πŸ’πŸπŸ” = (1 Γ— 162) + (9 Γ— 161) + (15 Γ— 16βˆ’1) + (4 Γ— 16βˆ’2) = 256 + 144 +
0.9375 + 0.015625 = 400.953125
22
β–ͺ In order to convert decimal (base 10) fractions into other bases
a. The fractional part is multiplied by the required base, b
b. The integer part of the result is recorded and removed from the result
c. Repeat steps (a) and (b)
d. The conversion of the decimal fraction to other bases is a collection of the
recorded integer part arranged in order of record.
β–ͺ For example,
β–ͺ Convert (0.513)10 to octal (base 8)
β–ͺ 0.513 x 8 = 4.104
β–ͺ 0.104 x 8 = 0.832
β–ͺ 0.832 x 8 = 6.656
β–ͺ 0.656 x 8 = 5.248
β–ͺ 0.248 x 8 = 1.984
β–ͺ 0.984 x 8 = 7.872
∴ (𝟎. πŸ“πŸπŸ‘)𝟏𝟎= (𝟎. πŸ’πŸŽπŸ”πŸ“πŸπŸ• … )πŸ–
23
β–ͺ Strings unlike numbers are sequences of characters (alphabets and special
symbols).
β–ͺ e.g. player, #saveLara, McLaren, steven123, etc..
β–ͺ Strings are human-readable characters and must be converted to computer-
understandable bit patterns.
β–ͺ The conversion is achieved using some form of character encoding scheme.
β–ͺ Examples of character encoding scheme include:
β–ͺ Binary Coded Decimal (BCD)
β–ͺ Extended Binary-Coded Decimal Interchange Code (EBCDIC)
β–ͺ American Standard Code for Information Interchange (ASCII)
β–ͺ Unicode
24
β–ͺ Binary-Coded Decimal (BCD) is a numeric coding system used primarily in
IBM mainframe and midrange systems in the 1950s and 1960s.
β–ͺ BCD is very common in electronics, particularly those that display numerical
data, such as alarm clocks and calculators.
β–ͺ BCD encodes each digit of a decimal number into a 4-bit binary form.
β–ͺ When stored in an 8-bit byte, the upper nibble is called zone and the lower
part is called the digit.
25
β–ͺ Extended Binary-Coded Decimal Interchange Code (EBCIDIC)
β–ͺ In 1964, BCD was extended to an 8-bit code, Extended Binary-Coded Decimal
β–ͺ Interchange Code (EBCDIC).
β–ͺ EBCDIC was one of the first widely-used computer codes that supported upper
and lowercase alphabetic characters, in addition to special characters, such as
punctuation and control characters.
β–ͺ EBCDIC and BCD are still in use by IBM mainframes today.
β–ͺ American Standard Code for Information Interchange (ASCII)
β–ͺ ASCII is based on a 7-bit representation scheme
β–ͺ It can represent the characters A – Z, a – z, 0 – 9, and control characters.
β–ͺ 128 unique characters are represented using the ASCII representation
β–ͺ ASCII is basically only for Roman, unaccented characters, although many people
have created their own variations of ASCII with different characters.
26
27
28
β–ͺ Both EBCDIC and ASCII were built around the
Latin alphabet.
β–ͺ In 1991, a new international information exchange
code called Unicode was created.
β–ͺ Unicode is a 16-bit alphabet that is downward
compatible with ASCII and Latin-1 character set.
β–ͺ Because the base coding of Unicode is 16 bits, it
has the capacity to encode the majority of
characters used in every language of the world.
β–ͺ Unicode is currently the default character set of
the Java programming language.
β–ͺ The Unicode code-space is divided into six parts.
β–ͺ The first part is for Western alphabet codes,
including English, Greek, and Russian.
β–ͺ The lowest-numbered Unicode characters
comprise the ASCII code.
β–ͺ The highest-numbered Unicode characters
provide for user-defined codes.
29

More Related Content

What's hot

20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental Principles20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental PrinciplesIntro C# Book
Β 
Abstract Base Class and Polymorphism in C++
Abstract Base Class and Polymorphism in C++Abstract Base Class and Polymorphism in C++
Abstract Base Class and Polymorphism in C++Liju Thomas
Β 
Pure virtual function and abstract class
Pure virtual function and abstract classPure virtual function and abstract class
Pure virtual function and abstract classAmit Trivedi
Β 
Class and object in C++
Class and object in C++Class and object in C++
Class and object in C++rprajat007
Β 
The Evolution of Java
The Evolution of JavaThe Evolution of Java
The Evolution of JavaFu Cheng
Β 
Data structure and algorithm All in One
Data structure and algorithm All in OneData structure and algorithm All in One
Data structure and algorithm All in Onejehan1987
Β 
Programming in C Presentation upto FILE
Programming in C Presentation upto FILEProgramming in C Presentation upto FILE
Programming in C Presentation upto FILEDipta Saha
Β 
Inheritance In Java
Inheritance In JavaInheritance In Java
Inheritance In JavaManish Sahu
Β 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in javaTech_MX
Β 
Inline function
Inline functionInline function
Inline functionTech_MX
Β 
OOP Assignment 03.pdf
OOP Assignment 03.pdfOOP Assignment 03.pdf
OOP Assignment 03.pdfARSLANMEHMOOD47
Β 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introductionjyoti_lakhani
Β 
Learn C
Learn CLearn C
Learn Ckantila
Β 
operator overloading & type conversion in cpp
operator overloading & type conversion in cppoperator overloading & type conversion in cpp
operator overloading & type conversion in cppgourav kottawar
Β 
Java Data Types
Java Data TypesJava Data Types
Java Data TypesSpotle.ai
Β 
Constructor and Destructor in c++
Constructor  and Destructor in c++Constructor  and Destructor in c++
Constructor and Destructor in c++aleenaguen
Β 
Enumeration in Java Explained | Java Tutorial | Edureka
Enumeration in Java Explained | Java Tutorial | EdurekaEnumeration in Java Explained | Java Tutorial | Edureka
Enumeration in Java Explained | Java Tutorial | EdurekaEdureka!
Β 

What's hot (20)

20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental Principles20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental Principles
Β 
Abstract Base Class and Polymorphism in C++
Abstract Base Class and Polymorphism in C++Abstract Base Class and Polymorphism in C++
Abstract Base Class and Polymorphism in C++
Β 
History of java'
History of java'History of java'
History of java'
Β 
Pure virtual function and abstract class
Pure virtual function and abstract classPure virtual function and abstract class
Pure virtual function and abstract class
Β 
Class and object in C++
Class and object in C++Class and object in C++
Class and object in C++
Β 
The Evolution of Java
The Evolution of JavaThe Evolution of Java
The Evolution of Java
Β 
Data structure and algorithm All in One
Data structure and algorithm All in OneData structure and algorithm All in One
Data structure and algorithm All in One
Β 
Console i/o for c++
Console i/o for c++Console i/o for c++
Console i/o for c++
Β 
Programming in C Presentation upto FILE
Programming in C Presentation upto FILEProgramming in C Presentation upto FILE
Programming in C Presentation upto FILE
Β 
Inheritance In Java
Inheritance In JavaInheritance In Java
Inheritance In Java
Β 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
Β 
Inline function
Inline functionInline function
Inline function
Β 
OOP Assignment 03.pdf
OOP Assignment 03.pdfOOP Assignment 03.pdf
OOP Assignment 03.pdf
Β 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introduction
Β 
Learn C
Learn CLearn C
Learn C
Β 
operator overloading & type conversion in cpp
operator overloading & type conversion in cppoperator overloading & type conversion in cpp
operator overloading & type conversion in cpp
Β 
Java Data Types
Java Data TypesJava Data Types
Java Data Types
Β 
Constructor and Destructor in c++
Constructor  and Destructor in c++Constructor  and Destructor in c++
Constructor and Destructor in c++
Β 
Tokens in C++
Tokens in C++Tokens in C++
Tokens in C++
Β 
Enumeration in Java Explained | Java Tutorial | Edureka
Enumeration in Java Explained | Java Tutorial | EdurekaEnumeration in Java Explained | Java Tutorial | Edureka
Enumeration in Java Explained | Java Tutorial | Edureka
Β 

Similar to CSC 101-CSC 111 - Introduction to Computer Science - Lecture 4.pdf

Lecture1
Lecture1Lecture1
Lecture1Andrew Raj
Β 
Computer Programming Computer Programming
Computer Programming Computer ProgrammingComputer Programming Computer Programming
Computer Programming Computer Programmingarifhasan88
Β 
Lec-ProblemSolving.pptx
Lec-ProblemSolving.pptxLec-ProblemSolving.pptx
Lec-ProblemSolving.pptxmiansaad18
Β 
Csc 130 class 2 problem analysis and flow charts(2)
Csc 130 class 2   problem analysis and flow charts(2)Csc 130 class 2   problem analysis and flow charts(2)
Csc 130 class 2 problem analysis and flow charts(2)Puneet narula
Β 
Thinking in data structures
Thinking in data structuresThinking in data structures
Thinking in data structuresTushar B Kute
Β 
lec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.pptlec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.pptSourabhPal46
Β 
lec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.pptlec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.pptMard Geer
Β 
Practical deep learning for computer vision
Practical deep learning for computer visionPractical deep learning for computer vision
Practical deep learning for computer visionEran Shlomo
Β 
CC-112-Lec.1.ppsx
CC-112-Lec.1.ppsxCC-112-Lec.1.ppsx
CC-112-Lec.1.ppsxAamir Shahzad
Β 
Cse115 lecture02overviewofprogramming
Cse115 lecture02overviewofprogrammingCse115 lecture02overviewofprogramming
Cse115 lecture02overviewofprogrammingMd. Ashikur Rahman
Β 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer scienceumardanjumamaiwada
Β 
L1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdfL1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdfMMRF2
Β 
Algorithm.pdf
Algorithm.pdfAlgorithm.pdf
Algorithm.pdfMIT,Imphal
Β 
What SQL should actually be...
What SQL should actually be...What SQL should actually be...
What SQL should actually be...Open Academy
Β 
Data structures & problem solving unit 1 ppt
Data structures & problem solving unit 1 pptData structures & problem solving unit 1 ppt
Data structures & problem solving unit 1 pptaviban
Β 
Proble, Solving & Automation
Proble, Solving & AutomationProble, Solving & Automation
Proble, Solving & AutomationJanani Satheshkumar
Β 

Similar to CSC 101-CSC 111 - Introduction to Computer Science - Lecture 4.pdf (20)

Lecture1
Lecture1Lecture1
Lecture1
Β 
Computer Programming Computer Programming
Computer Programming Computer ProgrammingComputer Programming Computer Programming
Computer Programming Computer Programming
Β 
Lec-ProblemSolving.pptx
Lec-ProblemSolving.pptxLec-ProblemSolving.pptx
Lec-ProblemSolving.pptx
Β 
Csc 130 class 2 problem analysis and flow charts(2)
Csc 130 class 2   problem analysis and flow charts(2)Csc 130 class 2   problem analysis and flow charts(2)
Csc 130 class 2 problem analysis and flow charts(2)
Β 
Thinking in data structures
Thinking in data structuresThinking in data structures
Thinking in data structures
Β 
lec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.pptlec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.ppt
Β 
lec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.pptlec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.ppt
Β 
Practical deep learning for computer vision
Practical deep learning for computer visionPractical deep learning for computer vision
Practical deep learning for computer vision
Β 
Unit no_1.pptx
Unit no_1.pptxUnit no_1.pptx
Unit no_1.pptx
Β 
CC-112-Lec.1.ppsx
CC-112-Lec.1.ppsxCC-112-Lec.1.ppsx
CC-112-Lec.1.ppsx
Β 
Cse115 lecture02overviewofprogramming
Cse115 lecture02overviewofprogrammingCse115 lecture02overviewofprogramming
Cse115 lecture02overviewofprogramming
Β 
FDS Unit I_PPT.pptx
FDS Unit I_PPT.pptxFDS Unit I_PPT.pptx
FDS Unit I_PPT.pptx
Β 
lecture 5
 lecture 5 lecture 5
lecture 5
Β 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer science
Β 
L1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdfL1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdf
Β 
Algorithm.pdf
Algorithm.pdfAlgorithm.pdf
Algorithm.pdf
Β 
What SQL should actually be...
What SQL should actually be...What SQL should actually be...
What SQL should actually be...
Β 
Data structures & problem solving unit 1 ppt
Data structures & problem solving unit 1 pptData structures & problem solving unit 1 ppt
Data structures & problem solving unit 1 ppt
Β 
Proble, Solving & Automation
Proble, Solving & AutomationProble, Solving & Automation
Proble, Solving & Automation
Β 
UNIT- 3-FOC.ppt
UNIT- 3-FOC.pptUNIT- 3-FOC.ppt
UNIT- 3-FOC.ppt
Β 

Recently uploaded

PKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPramod Kumar Srivastava
Β 
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptdokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptSonatrach
Β 
High Class Call Girls Noida Sector 39 Aarushi πŸ”8264348440πŸ” Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi πŸ”8264348440πŸ” Independent Escort...High Class Call Girls Noida Sector 39 Aarushi πŸ”8264348440πŸ” Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi πŸ”8264348440πŸ” Independent Escort...soniya singh
Β 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998YohFuh
Β 
B2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxB2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxStephen266013
Β 
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...Pooja Nehwal
Β 
Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystSamantha Rae Coolbeth
Β 
Delhi Call Girls CP 9711199171 β˜Žβœ”πŸ‘Œβœ” Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 β˜Žβœ”πŸ‘Œβœ” Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 β˜Žβœ”πŸ‘Œβœ” Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 β˜Žβœ”πŸ‘Œβœ” Whatsapp Hard And Sexy Vip Callshivangimorya083
Β 
꧁❀ Greater Noida Call Girls Delhi ❀꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❀ Greater Noida Call Girls Delhi ❀꧂ 9711199171 ☎️ Hard And Sexy Vip Call꧁❀ Greater Noida Call Girls Delhi ❀꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❀ Greater Noida Call Girls Delhi ❀꧂ 9711199171 ☎️ Hard And Sexy Vip Callshivangimorya083
Β 
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiLow Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiSuhani Kapoor
Β 
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...Florian Roscheck
Β 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfLars Albertsson
Β 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationshipsccctableauusergroup
Β 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...Suhani Kapoor
Β 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
Β 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSAishani27
Β 
Digi Khata Problem along complete plan.pptx
Digi Khata Problem along complete plan.pptxDigi Khata Problem along complete plan.pptx
Digi Khata Problem along complete plan.pptxTanveerAhmed817946
Β 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptxAnupama Kate
Β 

Recently uploaded (20)

PKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
Β 
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptdokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
Β 
High Class Call Girls Noida Sector 39 Aarushi πŸ”8264348440πŸ” Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi πŸ”8264348440πŸ” Independent Escort...High Class Call Girls Noida Sector 39 Aarushi πŸ”8264348440πŸ” Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi πŸ”8264348440πŸ” Independent Escort...
Β 
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
Β 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998
Β 
B2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxB2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docx
Β 
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
Β 
E-Commerce Order PredictionShraddha Kamble.pptx
E-Commerce Order PredictionShraddha Kamble.pptxE-Commerce Order PredictionShraddha Kamble.pptx
E-Commerce Order PredictionShraddha Kamble.pptx
Β 
Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data Analyst
Β 
Delhi Call Girls CP 9711199171 β˜Žβœ”πŸ‘Œβœ” Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 β˜Žβœ”πŸ‘Œβœ” Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 β˜Žβœ”πŸ‘Œβœ” Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 β˜Žβœ”πŸ‘Œβœ” Whatsapp Hard And Sexy Vip Call
Β 
꧁❀ Greater Noida Call Girls Delhi ❀꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❀ Greater Noida Call Girls Delhi ❀꧂ 9711199171 ☎️ Hard And Sexy Vip Call꧁❀ Greater Noida Call Girls Delhi ❀꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❀ Greater Noida Call Girls Delhi ❀꧂ 9711199171 ☎️ Hard And Sexy Vip Call
Β 
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiLow Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Β 
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
Β 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdf
Β 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships
Β 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
Β 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
Β 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICS
Β 
Digi Khata Problem along complete plan.pptx
Digi Khata Problem along complete plan.pptxDigi Khata Problem along complete plan.pptx
Digi Khata Problem along complete plan.pptx
Β 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx
Β 

CSC 101-CSC 111 - Introduction to Computer Science - Lecture 4.pdf

  • 1. BALOGUN JEREMIAH ADEMOLA ASSISTANT LECTURER, DEPARTMENT OF COMPUTER SCIENCE AND MATHEMATICS MOUNTAIN TOP UNIVERSITY, OGUN STATE, NIGERIA
  • 2. β–ͺ Definition of Computer β–ͺ History and Overview of Computing and Computers β–ͺ Evolution of Ideas and Machines from Mechanical Computer to Multimedia Computer β–ͺ Introduction to computing system β–ͺ Basic elements of a computer system hardware β–ͺ Block diagram, data/instruction flow, control flow β–ͺ Software types, packages and applications β–ͺ Characteristics of computer β–ͺ Problem solving using flowcharts and algorithms β–ͺ Data representation in computer system β–ͺ Communications and networks β–ͺ World wide web, network access, network architectures, data communications. Safety and security β–ͺ File management in Windows and basic word processors, spreadsheets, presentation, graphics and other applications β–ͺ Introduction to programming: β–ͺ Statements, symbolic names, arrays, expressions and control statements 2
  • 3. 3
  • 4. β–ͺ Problem Solving is the sequential process of analysing information related to a given solution and generating appropriate response options. β–ͺ Examples of tasks include: β–ͺ If you are watching a news channel on your TV and you want to change it to a sports channel, you need to do something. β–ͺ A student is ready to go to school but yet he/she has not picked up those books and copies which are required as per timetable. β–ͺ If someone asks to you, what is time now? β–ͺ Some students in a class plan to go on picnic and decide to share the expenses among them. β–ͺ There are six (6) steps that should be followed in problem solving: β–ͺ Understand the problem β–ͺ Formulate the model β–ͺ Develop an algorithm β–ͺ Write a program β–ͺ Test the program β–ͺ Evaluate the solution 4
  • 5. β–ͺUnderstanding the Problem β–ͺThe first step to solving any problem is to make sure that you understand the problem that you are trying to solve. β–ͺYou need to know: β–ͺ What input data/information is available ? β–ͺ What does it represent ? β–ͺ What format is it in ? β–ͺ Is anything missing ? β–ͺ Do I have everything that I need ? β–ͺ What output information am I trying to produce ? β–ͺ What do I want the result to look like … text, a picture, a graph … ? β–ͺ What am I going to have to compute ? 5
  • 6. β–ͺFormulate a Model β–ͺ Now we need to understand the processing part of the problem. β–ͺ Many problems break down into smaller problems that require some kind of simple mathematical computations in order to process the data. β–ͺ If there is no such β€œformula”, we need to develop one. β–ͺ Often, however, the problem breaks down into simple computations that we well understand. β–ͺ Sometimes, we can look up certain formulas in a book or online if we get stuck. β–ͺ In order to come up with a model, we need to fully understand the information available to us. 6
  • 7. β–ͺDevelop and Algorithm β–ͺ An algorithm is a precise sequence of instructions for solving a problem. β–ͺ To develop an algorithm, we need to represent the instructions in some way that is understandable to a person who is trying to figure out the steps involved. β–ͺ Two commonly used representations for an algorithm is by using: β–ͺ pseudo code; or β–ͺ flow charts. β–ͺ Pseudocode is a simple and concise sequence of English-like instructions to solve the problem unlike Flowcharts which are graphical. β–ͺ Pseudocode is often used as a way of describing a computer program to someone who doesn’t understand how to program a computer. β–ͺ When learning to program, it is important to write pseudocode because it helps you clearly understand the problem that you are trying to solve. 7
  • 8. 8
  • 9. 9
  • 10. β–ͺConsider the pseudo-code of the broken lamp shown earlier. β–ͺVarious parts of the pseudo-code could be explained as follows: β–ͺ Sequence – listing instructions step by step in order β–ͺ Condition – making decision and doing one thing or something else depending on the outcome of the decision 10
  • 11. β–ͺ Repetition – repeating something a fixed number of times or until some conditions occurs β–ͺ Storage – storing information for use in instructions further down the list β–ͺ Jumping – being able to jump to a specific step when needed 11
  • 12. β–ͺWrite the Program β–ͺ Writing a program is often called writing code or implementing an algorithm. β–ͺ The code (or source code) is actually the program itself. β–ͺ In the figure below, the code looks quite similar in structure to the pseudocode, however, the processing code is less readable and seems somewhat more mathematical. β–ͺ At this stage, the program is compiled by the computer. β–ͺ Compilation is the process of converting a program into instructions that can be understood by the computer. 12
  • 13. β–ͺTest the Program β–ͺ Running a program is the process of telling the computer to evaluate the compiled instructions. β–ͺ When you run your program, if all is well, you should see the correct output. β–ͺ It is possible however, that your program works correctly for some set of data input but not for all. β–ͺ If the output of your program is incorrect, it is possible that you did not convert your algorithm properly into a proper program. β–ͺ It is also possible that you did not produce a proper algorithm back in step 3 that handles all situations that could arise. β–ͺ Maybe you performed some instructions out of sequence. β–ͺ Whatever happened, such problems with your program are known as bugs. β–ͺ Bugs are problems/errors within a program that causes it to stop working or produce incorrect or undesirable results. β–ͺ As a result of this, the reasons for these bugs must be found and corrected. 13
  • 14. β–ͺEvaluate the Solution β–ͺ Once your program produces a result that seems correct, you need to re-consider the original problem and make sure that the answer is formatted into a proper solution to the problem. β–ͺ It is often the case that you realize that your program solution does not solve the problem the way that you wanted it to. β–ͺ You may realize that more steps are involved. β–ͺ It is also possible that when you examine your results, you realize that you need additional data to fully solve the problem. β–ͺ Or, perhaps you need to adjust the results to solve the problem more efficiently. β–ͺ It is important to remember that the computer will only do what you told it to do. β–ͺ It is up to you to interpret the results in a meaningful way and determine whether or not it solves the original problem. β–ͺ It may be necessary to re-do some of the steps again, perhaps going as far back as step 1 again, if data was missing 14
  • 15. 15
  • 16. β–ͺ Data representation is a major part of the software-hardware interface. β–ͺ As a result of this, data need to be represented in a convenient way that simplifies β–ͺ The common operations, such as: addition, subtraction, comparison etc. β–ͺ Hardware implementation thus making them faster cheaper, and more reliable. β–ͺ The Bit is short for Binary digit – the smallest amount of meaningful information stored on a computer. β–ͺ The advantage includes: β–ͺ Too little information per bit (each bit stores 2 possible states) β–ͺ In order to store more information, one needs more bits. β–ͺ The disadvantage includes: β–ͺ It is easy to do computation with bits β–ͺ They are more reliable β–ͺ Used to construct simpler digital circuits. 16
  • 17. β–ͺ All number are represented using a polynomial standard representation which is a sum of the product of each digit with the power of its base representation. β–ͺ Consider an n digit number with the most significant digit on the left and the least significant digit on the right β–ͺ Given a base representation b for each digit π‘Žπ‘–, then: (π‘Žπ‘› Γ— π‘π‘›βˆ’1) + (π‘Žπ‘›βˆ’1 Γ— π‘π‘›βˆ’2) + β‹― + (π‘Ž2 Γ— 𝑏1)+(π‘Ž1 Γ— 𝑏0) β–ͺ where 0 ≀ 𝑖 ≀ 𝑛 βˆ’ 1 β–ͺ Decimal Representations β–ͺ If a number is in base 10, then the number 56432 can be represented as: (5Γ— 104) + (6 Γ— 103) + (4 Γ— 102) + (3 Γ— 101)+(2 Γ— 100) β–ͺ Binary Representations β–ͺ If a number is in base 2, then the number 101012 can be represented as: (1Γ— 24 ) + (0 Γ— 23 ) + (1 Γ— 22 ) + (0 Γ— 22 )+(1 Γ— 20 ) 17
  • 18. β–ͺ The general idea behind positional numbering systems is that a numeric value is represented through increasing powers of a radix (or base number). β–ͺ The popular number systems to be considered are presented as follows: β–ͺ There are two important groups of number base conversions: β–ͺ Converting decimal numbers to base-r numbers β–ͺ Converting base-r numbers to decimal numbers 18 Number System Radix Allowable Digits Binary 2 0, 1 Octal 8 0, 1, 2, 3, 4, 5, 6, 7 Decimal 10 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Hexadecimal 16 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
  • 19. β–ͺ Convert 10410 to base 3 using the division-remainder method β–ͺ 10410= 102123 19 β–ͺ Convert 14710 to base 2 using the division-remainder method β–ͺ 14710 = 100100112
  • 20. β–ͺ Other bases can be converted to base 10 using the standard polynomial expressions shown earlier. β–ͺ Given a base representation b for each digit π‘Žπ‘–, then: (π‘Žπ‘› Γ— π‘π‘›βˆ’1 ) + (π‘Žπ‘›βˆ’1 Γ— π‘π‘›βˆ’2 ) + β‹― + (π‘Ž2 Γ— 𝑏1 )+(π‘Ž1 Γ— 𝑏0 ) β–ͺ where 0 ≀ 𝑖 ≀ 𝑛 βˆ’ 1 β–ͺ For example, β–ͺ 𝟏𝟎𝟎𝟏𝟏𝟐 = (1Γ— 24) + (0 Γ— 23) + (0 Γ— 22) + (1 Γ— 22)+(1 Γ— 20) = 16+0+0+4+1 β–ͺ πŸπŸ”πŸ‘πŸ’πŸ– = (2Γ— 83 ) + (6 Γ— 82 ) + (3 Γ— 81 ) + (4 Γ— 80 ) = 512+384+24+4 β–ͺ π‘¨π‘¬πŸ”πŸ‘π‘ͺπŸπŸ” = (10Γ— 164) + (15 Γ— 163) + (6 Γ— 162) + (3 Γ— 162)+(C Γ— 160) 20
  • 21. β–ͺ Other fractional bases can be converted to base 10 using the standard polynomial expressions. β–ͺ Consider, a set of digits π‘Žπ‘– occurring after the decimal point of a fraction expressed in a given base, b; the fraction can be converted to decimal fraction according to: (π‘Ž1 Γ— π‘βˆ’1) + (π‘Ž2 Γ— π‘βˆ’2) + β‹― + (π‘Žπ‘›βˆ’1 Γ— π‘βˆ’(π‘›βˆ’1))+(π‘Žπ‘› Γ— π‘βˆ’π‘›) β–ͺ Where n is the number of digits on the right hand side of the decimal point β–ͺ For example, β–ͺ 𝟎. 𝟏𝟏𝟎𝟏𝟐 = (1Γ— 2βˆ’1) + (1 Γ— 2βˆ’2) + (0 Γ— 2βˆ’3) +(1 Γ— 2βˆ’1) = 0.5+0.25+0+0.0625 β–ͺ 𝟎. πŸ’πŸπŸ“πŸ– = (4Γ— 8βˆ’1) + (2 Γ— 8βˆ’2) + (5 Γ— 8βˆ’3) = 0.5+0.03125+0.009765625 β–ͺ 𝟎. π‘¬πŸπ‘¨π‘ͺπŸπŸ” = (15 Γ— 16βˆ’1) + (2 Γ— 16βˆ’2) + (10 Γ— 16βˆ’3) +(𝐢 Γ— 16βˆ’4) 21
  • 22. β–ͺ Putting the conversion of the whole part and the fractional part together, it is now possible to convert any mixed fraction of a given base into a base 10 number. β–ͺ For example: β–ͺ 𝟏𝟎𝟏𝟏. 𝟎𝟏𝟐 = (1 Γ— 23) + (0 Γ— 22) + (1 Γ— 21) + (1 Γ— 20) + (0 Γ— 2βˆ’1) + (1 Γ— 2βˆ’2) = 8 + 0 + 2 + 1 + 0 + 0.25 = 11.25 β–ͺ πŸ”πŸ“πŸ‘. πŸπŸ‘πŸ– = (6 Γ— 82) + (5 Γ— 81) + (3 Γ— 80) + (2 Γ— 8βˆ’1) + (3 Γ— 8βˆ’2) = 384 + 40 + 0 + 0.25 + 0.046875 = 424.296875 β–ͺ πŸπŸ—. π‘¬πŸ’πŸπŸ” = (1 Γ— 162) + (9 Γ— 161) + (15 Γ— 16βˆ’1) + (4 Γ— 16βˆ’2) = 256 + 144 + 0.9375 + 0.015625 = 400.953125 22
  • 23. β–ͺ In order to convert decimal (base 10) fractions into other bases a. The fractional part is multiplied by the required base, b b. The integer part of the result is recorded and removed from the result c. Repeat steps (a) and (b) d. The conversion of the decimal fraction to other bases is a collection of the recorded integer part arranged in order of record. β–ͺ For example, β–ͺ Convert (0.513)10 to octal (base 8) β–ͺ 0.513 x 8 = 4.104 β–ͺ 0.104 x 8 = 0.832 β–ͺ 0.832 x 8 = 6.656 β–ͺ 0.656 x 8 = 5.248 β–ͺ 0.248 x 8 = 1.984 β–ͺ 0.984 x 8 = 7.872 ∴ (𝟎. πŸ“πŸπŸ‘)𝟏𝟎= (𝟎. πŸ’πŸŽπŸ”πŸ“πŸπŸ• … )πŸ– 23
  • 24. β–ͺ Strings unlike numbers are sequences of characters (alphabets and special symbols). β–ͺ e.g. player, #saveLara, McLaren, steven123, etc.. β–ͺ Strings are human-readable characters and must be converted to computer- understandable bit patterns. β–ͺ The conversion is achieved using some form of character encoding scheme. β–ͺ Examples of character encoding scheme include: β–ͺ Binary Coded Decimal (BCD) β–ͺ Extended Binary-Coded Decimal Interchange Code (EBCDIC) β–ͺ American Standard Code for Information Interchange (ASCII) β–ͺ Unicode 24
  • 25. β–ͺ Binary-Coded Decimal (BCD) is a numeric coding system used primarily in IBM mainframe and midrange systems in the 1950s and 1960s. β–ͺ BCD is very common in electronics, particularly those that display numerical data, such as alarm clocks and calculators. β–ͺ BCD encodes each digit of a decimal number into a 4-bit binary form. β–ͺ When stored in an 8-bit byte, the upper nibble is called zone and the lower part is called the digit. 25
  • 26. β–ͺ Extended Binary-Coded Decimal Interchange Code (EBCIDIC) β–ͺ In 1964, BCD was extended to an 8-bit code, Extended Binary-Coded Decimal β–ͺ Interchange Code (EBCDIC). β–ͺ EBCDIC was one of the first widely-used computer codes that supported upper and lowercase alphabetic characters, in addition to special characters, such as punctuation and control characters. β–ͺ EBCDIC and BCD are still in use by IBM mainframes today. β–ͺ American Standard Code for Information Interchange (ASCII) β–ͺ ASCII is based on a 7-bit representation scheme β–ͺ It can represent the characters A – Z, a – z, 0 – 9, and control characters. β–ͺ 128 unique characters are represented using the ASCII representation β–ͺ ASCII is basically only for Roman, unaccented characters, although many people have created their own variations of ASCII with different characters. 26
  • 27. 27
  • 28. 28
  • 29. β–ͺ Both EBCDIC and ASCII were built around the Latin alphabet. β–ͺ In 1991, a new international information exchange code called Unicode was created. β–ͺ Unicode is a 16-bit alphabet that is downward compatible with ASCII and Latin-1 character set. β–ͺ Because the base coding of Unicode is 16 bits, it has the capacity to encode the majority of characters used in every language of the world. β–ͺ Unicode is currently the default character set of the Java programming language. β–ͺ The Unicode code-space is divided into six parts. β–ͺ The first part is for Western alphabet codes, including English, Greek, and Russian. β–ͺ The lowest-numbered Unicode characters comprise the ASCII code. β–ͺ The highest-numbered Unicode characters provide for user-defined codes. 29