Gazzie. An obsessed music freak. 18 years of age.^_^. Long brown/black hair. Easily entertained. Skinny. Loud. Acclaimed Prince Gaz by Arwen! Member of the Unfortunate Family Tree and Secret Keeper of it as well. Lives in America, unfortunately. Owner of an iPod Touch. Is glomped everday! Born into this [world] on 12/19/1989 as it seems it be, Sagittarius. Member of [Slytherin].
|
 |
Computer Science Notes v10
59. Write a pseudocode algorithm to get three integers from the user and print them in numeric order.
Write "How many pairs of values are to be entered?" Read numberOfPairs Set numberRead to 0 While (numberRead < numberOfPairs) Write "Enter three values separated by a blank; press return" Read number1 Read number2 Read number3 If (number1 < number2 < number3) Print number1 + " " + number2 + " " + number3 Else Print number2 + " " + number1 + " " + number3 Else Print number3 + " " + number2 + " " + number1 Increment numberRead
Teacher did:
Declare num1, num2, num3 Write "Enter first integer" Read num1 Write "Enter second integer" Read num2 Write "Enter third integer" Read num3 Sort numbers Write numbers in sorted order
C++ int num1, num2, num3 cout <<"Enter first integer"<<end1; cin>>num1;
Java System.out.println("Enter first number"); num1=keyboard.nextInt();
Three parts of OOD (Object-Oriented Design) Encapsulation Inheritance Polymorphism
Are computer professionals licensed? What is the ACM and why is it opposed to licensing? What is the IEEE and what is its position on licensing? Should computer professionals be licensed?
Page 188 in the book (due Wednesday, Test Monday) AHH. X_X;;; XDD
Posted at 09:38 am by lemony
Permalink
| |
Wednesday, September 30, 2009 |
Computer Science Notes v.9
Psuedocode Functionality
Variables -Names of place to store values
Assignment - Storing the value of an expression into a variable.
Output
Input
Repetition
Selection -Making a choice to execute or skip a statement (or group of statements)
Selection -Choose to execute one statement (or group of statements) or another statement (or group of statements)
NumberRead number1 number2 3 55 70 55 70 2 1 1 2 33 33 33 33 Data 3 55 70 2 1 33 33 numberOfPairs 3
C++ (AHHHHHHHHHHHHHHHHHHHHH)
#include <iostream> using namespace std;
void main () { int numberread, number1, number2, numberofpairs;
cout << "How many pairs of values are to be read"; cin >> numberofpairs; numberread=0;
while(numberread < numberofpairs) { cout << "Enter two numbers separated by a blank; press return"; cin >> number1; cin >> number2; if (number1 < number2) cout << number1 << " " << number2; else cout << number2 << " " << number1; numberread = numberread + 1; } }
Top-Down Design
Top-Down Design -Problem-Solving technique in which the problem is divided into subproblems; the process is applied to each subproblem.
Modules -Self-contained collection of steps, that solve a proble or subproblem
Abstract Ste- -An algorithmic step containing unspecified details
Concrete Step -An algortithm step in which all details are specified.
Problem -Create a list that....etc
Posted at 09:34 am by lemony
Permalink
| |
Monday, September 28, 2009 |
Computer Science Notes v.8
Chapter 6 Problem solving and Algorithm Design
Problem solving -the act of finding a solution to a perplexing, distressing, vexing, or unsettled question.
How do you solve problems? 1) Understand the problem 2) devise a plan ...
Ask questions! What do I know about the problem? What is the information that I have to process in order to find..
Ask question! Never reinvent the wheel! Similar problems come up again and again in different guises.
A good programmer recognizes a task or subtask that has been solved before and plugs in the solution.
Divide and Conquer!
Break up a large problem into smaller units and solve each smaller problem. -Applies the concept of abstraction -The divide-and-conquer approach can be applied over and over again until each subtask is manageable.
Algorithm -A set of unambiguous instructions for solving a problem or subproblem in a finite amount of time using a finite amount of data.
Computer-Problem Solving Analysis and Specification Phase -Analyze -Specification
Algorithm Decvelopment Phase -Develop algorithm -Test algorithm
Implementation Phase -Code algorithm -Test algorithm
Maintenance Phase -Use -Maintain
Pseudocode -A mixture of English and formatting to make the steps in an algorithm explicit. -Algorithm to Convert base -10 number to other bases. [White the (the quotient is not zero). Divide the decimal number by the new base...]
Two methodologies used to develop computer solutions to a problem -Top-down design focuses on the tasks to be done -Object-orientated design focuses on the data involved
Psuedocode A way of expressing algorithms that uses a mixture of English phrases and indention to make the steps in the solution explicit.
Variables -Names of places to store values
Assignment -Storing the value of an expression into a variable
Output -Printing a value on an output device
Input -Getting values from the outside...
Repetition -Repeating a series of statements.
Selection -Making a choice to execute or skip a statement (or group of statements)
Posted at 09:54 am by lemony
Permalink
| |
Wednesday, September 16, 2009 |
Computer Science Notes v.7
Chapter 5
--Admiral Grace Murray Hopper A coil of wire nearly 1,000 feet long -Distance traveled by an electron along the wire in the space of a microsecond.
A short piece of wire -In the space of a nanosecond.
A bag containing grains of pepper -In the space of a picosecond.
dot pitch is the distance between the pixels on your screen. Smaller number is better screen resolution and better picture.
Memory A collection of cells, each with a unique physical address; both addresses and contents are in binary.
Processor has Arithmetic/Logic Unit
Performs basic arithmetic operations such as adding.
Performs logical operations such as AND, OR, and NOT.
Most modern ALU's have a small amount of special storage units called registers.
Control unit -The organizing force in the computer.
Instruction register (IR) -Contains the instruction that is being executed.
Program counter (PC) -Contains the address of the next instruction to be executed.
Central Processing Unit (CPU) -ALU and the control unit called the, or CPU.
Bus -A set of wires that connect all major sections.
The Fetch-Execute Cycle
Fetch the next instruction Decode the instruction Get data if needed Execute the instruction
RAM (Random Access Memory) and ROM (Read Only Memory)
Seek time -time it takes for read/write head...
Posted at 09:40 am by lemony
Permalink
| |
Monday, September 14, 2009 |
Computer Science Notes v.6
Chapter 4 cont...
A transistor has three terminals - A source - A base - An emitter, typically connected to a ground wire
If the electrical signal is grounded, it is allowed to flow through an alternative route to the ground (literally) where it can do no harm.
The easiest gates to create are the NOT, NAND, and NOR gates.
Combination circuit The input values explicitly determine the output
Sequential circuit The output is a function of the input values and the existing state of the circuit. We describe the circuit operations using: Boolean expressions, Logic diagrams, and Truth tables.
Combinational Circuits Gates are combined into circuits by using the output of one gate as the input for another.
Three inputs require eight rows to describe all possible input combinations. This same circuit using a Boolean expression is (AB + AC).
Consider the following Boolean expression A(B+C) "+ means or"
Circuit equivalence Two circuits that produce the same output for identical input
Boolean algebra allows us to apply provable mathematical principles to help design circuits.
A(B+C)=AB+BC (distributive law) so circuits must be equivalent.
<u>Properties of Boolean Algebra</u> Commutative AB=BA Associated (AB)C=A(BC) Distributive A(B+C)=(AB)+(AC) Identity A1=A Complement A(A')=0 DeMorgan's law (AB)'=A' OR B'
Adders
At the digital logic level, addition is performed in binary.
The result of adding two binary digits could produce a carry value
Recall that 1+1=10 in base two
Half adder A circuit that computers the sum of two bits and produces the correct carry bit.
Circuit diagram representing a half adder.
Boolean expressions sum = A (+) B carry = AB "(+) means exclusive or"
Full adder A circuit that takes the carry-in value into account.
Multiplexer A circuit that uses a few input control signals to determine which of several output data lines is routed to its output.
Circuits as Memory Digital circuits can be used to store information. The circuits form a dequential circuit....etcccccccc
Integrated circuit (also called a chip)
A piece of silicon on which multiple gates have been embedded.
Silicon pieces are mounted on a plastic ceramic package with pins along the edges that can be soldered onto circuit boards or inserted into appropriate sockets.
Integrated circuits (IC) are classified by the number of gates contained in them.
SSI Smal-Scale Integration 1 - 10 gates MSI Medium-Scale Integration 10 - 100 gates LSI Large Scale -100 - 100,000 VLSI Very-Large-Scale more than 100,000
CPU Chips The most important integrated circuit in any computer is the Central Preocessing Unit, or CPU....etc
Posted at 09:34 am by lemony
Permalink
| |
Wednesday, September 09, 2009 |
Computer Science Notes v.5
Chapter 4 Gates and Circuits
Gate- A device that performs a basic operation on electrical signals
Circuits - Gates combined to perform more complicated tasks
Boolean expressions Uses Boolean algebra, a mathematical notation for expressing two; calculated logic
Logic diagrams A graphical representation of a circuit; each gate has its own symbol
Truth tables A table showing all possible input value and the associated output values.
Six types of gates -NOT -AND -OR -XOR -NAND -NOR
Typically, logic diagrams are black and white with gates distinguished only by their shape. We use color for emphasis (and fun)
**fun...psssft yeah right.
A NOT gate accepts one input signal (0 or 1) and returns the opposite signal as output. Triangle small circle Boolean expression X = A'
Truth table A X 0 1 1 0
An AND gate accepts two input signals
If both are 1, the output is 1; otherwise, the output is 0 Boolean expression X= A x B A D (looking shape) X B
Truth table A B X 0 0 0 0 1 0 1 0 0 1 1 1
An OR gate accepts two input signals
If both are 0, the output is 0; otherwise, the output is 1
Boolean Expression X = A + B
A Fin looking shape X B
Truth Table A B X 0 0 0 0 1 1 1 0 1 1 1 1
An XOR gate accepts two input signals Exclusive OR
If both are the same, the output is; otherwise, the output is 1
Boolean Expression X A (+) B
A ) Fin shape X B
Truth Table A B X 0 0 0 0 1 1 1 0 1 1 1 0
Note the difference between the XOR gate and the OR gate; they differ only in one input situation.
The NAND gate accepts two input signals
If both are 1, the output is 0; otherwise, the output is 1
Boolean Expression X = (A x B)'
A Dsmall circle X B
Truth Table A B X 0 0 1 0 1 1 1 0 1 1 1 0
The NOR gate accepts two input signals
If both are 0, the output is 1; otherwise, the output is 0
Boolean Expression X = (A + B) '
A Fin shape Small Circle X B
Truth Table A B X 0 0 1 0 1 0 1 0 0 1 1 0
A NOT gate inverts its single input
AN AND gate produces 1 if both input values are 1
AN OR ate produces 0 if both input values are 0
An XOR gate prodcuces 0 if input values are the same
A NAND gate prodcuces 0 if both inputs are 1
A NOR gate produces a 1 if both inputs are 0
Gates with more inputs
Gates can be desgined to accept three or more input values
A three-iunput AND gate, for exampl, prodcuces and output of 1 only if all input values are 1
Boolean Expression X = A x B x C
A B D shape X C
Truth Table A B C X 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 etcccccc
Constructing Gates
Transitor A device that acts either as a wire that conducts electicity or as a resitor that blocks the flow of electricity, depending on the voltage level of an input signal
A transitor has no moving parts, yet acts like a switch
It is made of a semiconductor material, which is neither a particulary good conductor of electricity nor a particularly good insulator.
Posted at 09:57 am by lemony
Permalink
Computer Science Notes v.4
Huffman Coding 1011111001010 DRAEB
**teacher admits he used to be a nerd for stereo systems, used to read magazines about learning which was better with harmonic sounds, etc. lol. CD's store audio information digitally. On the surface of the CD are microscopic puts that represent binary digits. A low intensity laser is pointed a the disk. --__--__--_ is square wave Colour -Perception of the frequencies of light that reach the retinas of our eyes. Retinas have three types of colour photoreceptor cone cells that correspond to the colors of red, green, and blue. Colour is expressed as an RGB (red-gree-blue_ value--three numbers that indicate the relative contribution of each of these three primary colours. AN RGB calue of (255,255,0) maximizes the contribution of red and green, and minimizes the contribution of blue, which results in a bright yellow. **OMG* They are arguing over the colour for white & black! Wow. lol. Some say O_o;; it's black oh it's white! Get over it...... >_< Colours are in 8 bits...so you can have 16 million colours. 32bits is 42 billion colours GIF- 256 colours JPEG-TIFF - 16 million colours Colour depth -the amount of data that is used to represent a colour HiColour -1 16 bit colorur depth: five bits used for each number in an rgb value with the extra bit somethings used to represent transparency... A browser may support only a certain number of specfic colours, creating a palette from which to choose. Digitizing a picture -Representing it as a collection of indivudal dots called pixels. Resolutiuon -The number of pixels used to repesent a picture. Raster graphics -Strogae of data on a pixel-by-pixel basis Bitmap (BMP), GIF, JPEG, and PNG are raster-graphics. Bitmap format Contains teh pixel colour valuse of the image from left to right and from top to bottom. GIF format (indexed color) Each image is made up of only 256 colours. JPEG format Average colour hues over short distances. PNG format Like GIF but acheives greater compression with wider range fo colour depths. Vector graphcis A format that describes an image in terms of lines and geometric shapes. A vector graphic is a.... vector graphics can be resized mathematically and changes can be calculated... Representing Video Video codec COmpressor/DECompressor Methods used to shrink the size of a movie to allow it to be played on. Temproal compression A technique based on differences btetween consective frames: if most of an image in two frams hasn't changed, why should we waste space to duplicate all of the simmilar information? Spatial compression A technique.... **AWESOME we're going over the study guide now. lol Josh helped me so much last night trying to figure a lot of this mess out. *HECK YES. I'm getting these numbers right with converting hexadecimal to binary!!! :D :D :D :D WOOOO HOOO!!! :D :D :D hahahaha
Posted at 09:35 am by lemony
Permalink
| |
Wednesday, August 26, 2009 |
Computer Science Notes v.3
Chapter Three - Data Representation
data compression 0 reduction in the amount of space needed to store a piece of data
compression ratio - the size of the compressed data divided by the size of the original data
a data compression tecniques can be -lossless, which means the data can be retrieved without any loss of the original information
-lossy, which means some information may be lost in the process of compaction
analog & digital information
Computers are finite! How do we represent an infinite world?
We represent enough of the world to satisfy our computational needs and our senses of sight and sound.
Information can be represented in one of two ways: analog or digital
Analog data -A continuous representation, analogous to the actual information it represents
Digital data -A discrete representation, breaking the information up into separate elements.
Thermometer is an analog device.
Computers cannot work well with analog data, so we digitize the data.
Digitize -Breaking data into pieces and representing those pieces separately. How do we use binary to represent digitized data?
Electronic Signals Important facts about electronic signals -An analog signal continually fluctuates in voltage up and down -A digital signal has only a high or low state, corresponding to the two binary digits. -All electronic signals (both analog and digital) degrade as they moved down a line -The voltage of the signal flcutuates tdue to envrinomental factors.
Periodically, a digital signal is reclocked to regain its original shape.
Binary Representations
One bit can be either 0 or 1
One bit can repesent two things (Why?) 0 1 2 3
Two bits can represent four things (Why?) 00 01 10 11
Chances of winning Cash 3 Lottery is 1,000. Because you have 000 & 999 and is represented by the 10^umpth power.
2^n power will get you the number in bytes. 2^1=2 2^2=4 2^3=8 2^4=16 2^5=32 2^6=64 2^7=128 2^8=256
How many things can three bits represent?
How many things can four bits represent?
How many things can five bits represent?
When you increase the number of bits it doubles.
Representing Negative Values
Signed-magnitude number representation
The sign represents the ordering, and the digitis represent the magnitude of the number.
Using two decimal digits, let 1 through 49 represent 1 through 49 let 50 through 99 repesent -50 through -1
To perform addition, add the numbers and discard any carry.
A-B=A+(-B) Add the negative of the second to the first.
Formula to computer the negative represesntaiton of a number
Negative(I) =10^k - I, where k is the number of digits
The presesntation is called the ten's complement.
Negative(5)=100-50=50 Negative(49)=100-49=51 Negative(35)=100-35=65 Negative(1)=100-1=99
Two's Complement (Veritcal line is easier to read)
00000000
-128-127
Negative(128)=256-128=128 Negative(127)=256-127=129
Addition and subtraction are the same as in 10's complement arithmetic.
-127 10000001 + 1 00000001 ------ -126 10000010
Real numbers**
A number with a whole part and a fractional part 104.32, 0.999999, 357.0, and 3.14159
Positions to the right of the decimal point are the teneths position: 10^-1, 10^-2, 10^-3
Same ryles apply in binary as in decimal. Decimal point is actually the radix point. Positions to the right of the radix point binary are 2^-1 (one half) 2^-2 (one quarter), 2^-3 (one eight)
Representing text
There are finite number of caracters to represent, so list them all and assign each a binary string.
01000001=65=A 01000010=66=B 01000011=67=C 01000100=68=D
32 is the difference between capital and lower case letters on this string.
01100001=97=a 01100010=98=b
Unicode uses 16bits 2^16=65,536 (for foreign languages like Chinese...etc)
1111111111111111
ASCII stnads form American Standard Code for Information Interchange.
ASCII originally used seven bits to represent each character, allowing for 128 bits.
Text Compression
Assigning 16 bits to each character in a document uses too much files space.
We need ways to store and transmit text effeicently.
Text compression techniques. -keyword encoding -run-length encoding -Huffman encoding
Keyword Encoding
Replace frequently used words with a single character.
Run-length encoding.
A signle character may bre repeated over and over again in a long squence.
Replace a repeated sequence with -a flag character -repeated character -number....
Huffman Encoding
Huffman codes use variable-length bit strings to repesent each character.
More frequently used letters have shorter strings to represent them.
Morse code ETAOINS *_ dit and dah
Huffman
Posted at 09:33 am by lemony
Permalink
Computer Science Notes v.2
2^n n is number of bits
5bits is 2^5=32
Hexadecimal means base 16
10 - A 11 - B 12 - C 13 - D 14 - E 15 - F
Convert a binary number to hexadecimal 1. Group your bits into groups of four 2. Covert each group to a Hexadecimal value
16^1= 16 16^0= 1 16x10 = 160 1x10= 10......160+10=170 10101010 = AA
8421 8421 1010 1010 A A
1000 1011 0111 8 11=B 7
Converting hexadecimal to binary
7E9 0111 1110 1001
135 convert to binary 135-128=7
128 64 32 16 8 4 2 1 1 0 0 0 0 1 1 1
Convert 345 to decimal 345-256=...
256 128 64 32 16 8 4 2 1 1 0 1 0 1 1 0 0 1
convert 101011001
0001 0101 1001 1 5 9 = 159
1+1= 0 carry the 1 so it looks like 10 9+1=10
111111 1010111 +1001011 ------------- 10100010
1 1 1 1110011 + 11001 ----------- 0101000
10001100 is the flippin answer... >_<
Great subtracting while fighting to stay awake... arghhhh caffeine gave up on me...
12 0202 1010111 - 111011 ------------ 0011100
**teacher and vest kid are discussing calculus....wtc....hahaha I wanna burst out into laughter...oh.how I want to...LOL! sooooo boring here and the a/c broke because of rain over the weekend.
**another discussion with vest kid and teacher...talking about encrypting email because of the Patriot Act. Vest kid says hey get a hotmail...lol
COBOL & BUG =made by this old lady from about 50 years ago
**teacher made a startrek reference...what am I getting into?
Posted at 09:36 am by lemony
Permalink
Just a few thoughts that I was thinking as I went to go get some food after leaving the house from getting back to church and stuff haha.
This evening was so nice, I'm not sure about the rest of the day. But when I was out and about it was around 7ish where the sun was getting ready to set beyond the horizon. The air was a nice chilly breeze in the mid 70's or something like that.
It was really cool to ride down the road with the windows down and it not be hot, but just right. It was comfortable to wear blue jeans and a polo and smell the smells of fall. That smell of fresh food being cooked like at the fair. The colour isn't really here yet in the foliage nor the rest of the season but it will be really nice to see it catch up.
Too bad that this cold front is about to leave though. Well other than that on my mind things are going a lot better with my mum. I'm back at her house mainly for school reasons and plus when I wrote her a letter it really broke away at a lot of stuff inside her. So she's changed a lot since then and well so have I.
I've changed my major for the fourth time to Computer Science. That right there is going to be a challenge to do but fun nonetheless :]. The classes I'm taking are Intro to Computer Science, Speech, College Algebra, Comp II, American Government, and World Civilization I, for a total of 17 hours this semester. Yeah, it's going to be interesting but I'll be glad to get some of these classes out of the way so I can leave this place faster haha to a better school. I'm still not sure if I should just work on transferring or just decide to finish up with my associates. I dunno so far.
I've been catching up on a lot of missed hours of playing piano. :] I've always gotten caught up on playing Sims 3. I think I'm on the fourth or fifth generation in my little legacy family going on. It's been tough but actually a lot of fun. I'm actually not using that many mods either, which is a surprise. I just have the essentials, like the skill mod, all fruit/vegetable & fish in store mod, and ghost control mod.
I went to a really cool birthday party last night with friends for Amanda T. I actually went swimming.... -_- Hey, it was a four foot deep pool and it was at night. So it was cool and the water was so warm, it was really nice. I didn't know that moving around in the pool could be such a work out though!
I learned how to run the soundboard at church tonight by Rachel M.'s mum. It was an experience and I hope that I can learn it more and more so I can do it one day, eventually haha. Here I go again being the youngest person on a team/activity thing at church. This is crazy but I love it so much fun. Handbell choir starts back up September 1, can't wait. :] Club rush is this Tuesday and I'm supposed to be helping with 4-H. I still have no idea what we're going to do lol.
Ok, so that's just a general update. I wanted to write something that sounded somewhat inspirational or something. But I lost track of that idea when I got back home and started playing piano for about an hour. Life is getting better, faith is getting stronger, things still aren't perfect but neither am I. I'm just living day by day and pray for a reoccurring glance at life.
Posted at 10:34 pm by lemony
Permalink
|