New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

Data Organization

by: Trent Dare

Data Organization CS 241L

Trent Dare
GPA 3.76

Douglas Wokoun

Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Douglas Wokoun
Class Notes
25 ?




Popular in Course

Popular in ComputerScienence

This 88 page Class Notes was uploaded by Trent Dare on Wednesday September 23, 2015. The Class Notes belongs to CS 241L at University of New Mexico taught by Douglas Wokoun in Fall. Since its upload, it has received 16 views. For similar materials see /class/212197/cs-241l-university-of-new-mexico in ComputerScienence at University of New Mexico.


Reviews for Data Organization


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 09/23/15
l M1 v In l39l lt1 The University of New Mexico LOS ALAMOS fmm I l 7 7 7 ConfrolFlonI Eunc rionsand7 r LQCTUI Q 439 Program S rruc rure 393 G is a s rruc rured programming language which means rha r con rrol ow The pa rh of ac rive execu rion Through a program is medla red by code blocks The idea of a code block is rha r i r39s a modular scope of program design rha r Has a single de ned en rry poin r 39 Has i rs own quotlocalquot variables 39 Has few or one exi r poin r This makes i r easier io analyze rhe con rrol ow of a program by breaking i r down To small unders randable pieces Blocks A block is a sequence of zero or more program s ra remen rs enclosed in a pair of curly braces 39 39 and 39 39 l A block rhen becomes a compound s ra remen r and can be placed anywhere a simple s rafemenf would go Variables rha r are only used by s ra remen rs inside a block can and should be declared inside The block This makes The variables invisible ou rside rhe scope of rhe block rhereby preven ring name clashes and reducing complexi ry Blocks are The basis of several ow con rrol s rruc rures rha r permi r branching and looping Blocks co nT GompuTers are used To manipulaTe large amounTs of daTa which means ThaT They perform repeTiTive operaTions Looping consTrucTs direcT The compuTer To perform an operaTion or seT of operaTions a cerTain number of Times Branching consTrucTs direcT The compuTer To alTernaTe operaTions or seTs of operaTions depending on The daTa being processed lf Else The ifelse branching sTrucTure direcTs program ow To one of Two alTernaTive sTaTemenTs based on The boolean value of an expression IfThe expression evaluaTes True nonzero The rsT sTaTemenT is execuTed or The rsT block is enTered lfThe expression evaluaTes To zero The second sTaTemenT or block is execuTed lf Else co M The else block is opTional and can be omiTTed In This case The program will do noThing if The expression evaluaTes To false If Else ioont The syntax of if else is if expression statementl else statementZ The parenthesis are required The indenting is by convention and ignored by the compiler If Else cont Examples of if else True if n 0 if y 1 if n x b 6 else b 5 c 1 True if b 4 True if y is odd I if b 4 if c 5 t 12 else b If Else cont With nes red if else else always associates with the closest previous if unless overridden by braces regardless of indenting quotr YOqtype 7 gtthefxnanerseeszi gt YbUIneant if y 1 if y 1 if y 1 if x 1 t 12 if x 1 if x 1 else t 12 t 12 t 6 else t 6 else t 6 lf Else co nT JusT as oTher binary consTrucTs can be exTended To be nary Through chaining The ifelse sTrucTure can be combined To choose among several alTernaTives Through repeaTed binary division If Else icont The rst if else instance divides between case one and quoteverything else Within the everything else section subsequent divisions occur if y 1 x 0 else if y x2 else if y x 3 else x 5 Each expression in the chain gets evaluated until one evaluates true then the associated block executes Switch A more ef cient and clearer way of expressing long chains of ifelse res rs on The same variable is The switch cons rruc r The switch block has an inirinsic mul riway branch capabili ry Switch cont The switch block takes the following form switch expression case valuelz statement case value2 statement case valuen statement default statement The default section is optional Swi rch cont The switch sTaTemenT evaluaTes The value of The expression and jumps direchy To The case ThaT has The same value If none of The cases maTch any default case presenT is execuTed A poTenTially confusing aspecT ofThe switch sTaTemenT39s branching behavior is ThaT execuTion of each case quotfalls Through To The nexT case unless you use a break sTaTemenT To exiT The switch sTaTemenT Switch cont This code will print the following for men switch case case case case case case case case case case case case mon JANUARY FEBRUARY MARCH APRIL MAY JUNE JULY AUGUST SEPTEMBER OCTOBER NOVEMBER DECEMBER printfquotJanuarynquot printfquotFebruarynquot printfquotMarchnquot printfquotAprilnquot printfquotMaynquot printfquotJunenquot printfquotJulynquot printfquotAugustnquot printfquotSeptembernquot printfquotOctobernquot printfquotNovembernquot printfquotDecembernquot August ESeptember iOctober ENovember EDecember AUGUS T Switch loont And this code 1 men case JANUARY month case FEBRUARY month case MARCH month case APRIL month case MAY month case JUNE month case JULY month case AUGUST month case SEPTEMBER month quotSeptemberquot case OCTOBER month quotOctoberquot case NOVEMBER month quotNovemberquot case DECEMBER month quotDecemberquot quotJanuaryquot quotFebruaryquot quotMarchquot quotAprilquot quotMayquot quotJunequot ll Julyquot quotAugustquot printfquotsnquot month will always print December regardless of the value of mon because month is repeatedly assigned overwritten until it receives the final value of quotDecemberquot Switch cont The way to correct this is to use the break statement switch case case case case case case case case case case case case mon JANUARY FEBRUARY AUGUST SEPTEMBER OCTOBER NOVEMBER DECEMBER month month month month month month month month month month month month printfquotsnquot month quotJanuaryquot break quotFebruaryquot break quotMarchquot break quotAprilquot break quotMayquot break quotJunequot break quotJulyquot break quotAugustquot break quotSeptemberquot break quotOctoberquot break quotNovemberquot break quotDecemberquot break Not strictly needed butcan prevent errors if new cases are added later break allows an escape from a block without reaching the bottom Switch icont The quotfall through behavior is useful in some cases switch mon case JANUARY case MARCH case MAY case JULY case AUGUST case OCTOBER case DECEMBER case APRIL case JUNE case SEPTEMBER case NOVEMBER case FEBRUARY days 31 break days 30 break days 28 break We can group cases with the same implementation together and avoid repeating it il7 lLglllk ll lllllll il llll4llllll llll lllll lllllll ll Else If Versus SwiTch When dealing wiTh a large number of maTch Terms The switch synTax is a loT cleaner and more eflicienT ElseIf has The advanTage ThaT H can TesT againsT ranges eg x gt 5 and againsT variables x s 11 Cases wiThin a switch sTaTemenT are limiTed To inTeger consTanTs or expression ThaT can be reduced To inTeger consTanTs aT compile Time Else If Versus Switch The behaviors of else if and switch have their roots in the OPU s assembly language where the only flow control mechanisms are forms of goto r l JumE to first else COMPARE 1y g cggog NOTEQUAL 5 x 0 z JUMP 11w else if Y COMPARE 2y x 2 BRANCH ON NOT EQUAL 9 else if y 39 MOVE 2x x 3 JUMP 14 lum to last else COMPARE 4y BRANCH ON NOT EQUAL 13 x 5 MOVE 3x JUMP 14 MOVE 5x else Else If Versus Switch In many cases switch can avoid snaking through a chain of comparisons by using a jump fable switch mon index 0 exit case JANUARY case MARCH I 10595757557575 case MAY COMPARE 12mon case JULY BRANCH ON GREATER THAN 10 case AUGUST JUMP ARRAYmon case OCTOBER case DECEMBER MOVE 31rdays 39 Handle out Of days 31 break I JUMP 10 bounds values case APRIL MOVE 30days case JUNE JUMP 10 case SEPTEMBER MOVE 23days Use jump table case NOVEMBER days 30 break case FEBRUARY days 28 break Else If Performance FacTors WriTing a fasT elseif chain is much like playing a good game of 20 quesTions The aim is The shorTesT average number of quotquesTionsquot asked per deliniTive decision made If one parTicular condiTional TesT can idenTifv The correcT case 807 ofThe Time iT should be The rsT one performed Also if one ofThe condiTional TesTs is much fasTer Than The oThers perhaps because The oThers inVOlve funcTion calls ThaT do a loT of compuTaTionl iT should be done lirsT perhaps avoiding The quotexpensivequot compuTaTion enTirelv While Loop The mosT basic form of looping sTrocTure is The while loop which repeaTedly execuTes a block of code so long as a condiTion is meT false If The condiTion is noT iniTiallv meT The block may never execuTe The block can execuTe zero Times one Time or many Times The syntax of while is while expression statement Once again the parenthesis are required and the indenting is by convention and ignored by the compiler The statement can be a single statement ended with a semicolon or a block of statements surrounded by braces While Loop cont Examples of while while y gt 1 printfquotdquot y while 0 Never true never executes printf quotNever quot while 1 Alnfinite loop never finishes printfquotNo exitquot Semicolon is null statement infinite loop while y gt 1 printfquotdquot yquot39IltNot part of loop despite indentation While Loop icont Let39s look at this for a moment while y gt 1 printf quotdquot y i The while line should not ordinarily end with a semicolon a statement or block follows immediately Typing a semicolon creates a null statement terminating the while block A properly formed loop includes a statement that at some point changes a term in the loop condition so that it evaluates to false One exception to this is loops that use break to exit which should be used rarely i Li Li i i i ifi ifi i i iji i i i i i Li i i7i iii ijizii i i iji ii ilxi iili LU i i I70 Loop A modi ed form of the while loop is The do loop which differs by always execu ring i rs block a r leas r once false Vo Loop cont The syntax of do is do statement while expression Putting a semicolon after do or leaving off the semicolon after the conditional expression are syntax errors For Loop A for loop is a more sophisticated form of a while loop The syntax lfor init cqpt incr Often used to increment Often used to initialize tgment loop counter L is equivalent to 1 init while co39h t statement incrp 39 39L loop counter Test loop counter for whether to continue For Loop cont Examples 0f for Watch for offbyone errors here for i 0 i lt 10 i Loops 10 times printing numbers from 0 to 9 printf quotdquot i Exits without reentering block at i 10 for i 9 i gt 0 iquot printfquotdquot I i Same result but backwards for Infinite loop Null continuation expression printf quotNo exitquot evaluates as true for i 0 i lt 10 i 2 Loops6times printing numbers 0 2 printfquotd is evennquot i 46810 for x for y 0 0 For Loop cont printfquotnquot printfquotdd quot x y ygt I u I x lt 10 y lt 10 u I Loops inside loops are common x I 0 9 9 9 For Loop lcont Tbe sequencing operator l39 39 l can be used to put multiple expressions into a positio that normally holds only one The loop below removes space from char sl 1 while copying l l l O char 2 1 for i 0 j 0 s1i 39039 i if sli 39 39 2j s1i 2j 39039 Add null terminator Two loop counters need to be initialized for this loop Break and ConTinue Two keywords allow early exiTs from loops The break keyword exiTs a loop immediaTely IT cannoT be used To exiT mulTiple nesTed loops The continue keyword jumps To The nexT iTeraTion of a loop skipping The resT ofThe sTaTemenTs in The block The loop will exiT only if H is on iTs lasT iTeraTion continue jumps immediaTely To The loop condiTional gigse 35 intro n 96 10 39039 ltC0nvert rightmost digit while n 10 gt 0 ltShift decimal digits right 39f s39 n lt 0 l Saig w r JAdd mmus Signlfapproprlate Sm 39 quot39 a reverse s Exercise 35 Write the function itob int n char s int b that converts the integer 11 into a base b character representation in the string 5 void itoaint n char s int i si n if signg n lt 0 What has to be changed to convert this n function from base 10 to base n n i 0 10 Which parts ofthe algorithm are 5 i n 8 10 0 specific to base 10 while n 10 gt 0 if sign lt 0 si 39 39 si 39039 reverses Exercise 35 Write the function itob int n char s int b that converts the integer 11 into a base b character representation in the string 5 void itobint n char s int b char digits quot012345678BABCDEFGHIJKLMNOPQRSTUVWXYZquot int i sign if sign n lt 0 n n i0 do si digitsn b reverses Fquot Chapter 4 Func rions exis r To clarify program s rruc rure and remove redundancy Since The basic func rions of rhe compu rer are so simplis ric i r becomes prac rical To build more sophis rica red func rions ou r offhese primi rives Then keep Them for fur rher use lden rifying candida res for func rions can be done up fron r when designing a program or They can be discovered in blocks of iden rical code Fu nc rions co n r Func rions are pa r rerned afier ma rhema rical func rions wi rh a name some number of inpu rs a descrip rion of compu ra rion and an ou rpu r in im In Inquot oul function in compu ring rhe inpu rs are called quotargumen rsquot or quotparame rersquot The ou rpu r is called The quotreiurn valuequot Fu nc rions lco M A few differences exis r wi rh compu rer func rions They are responsible for acfually performing The compu ra rions no r jusf describing rhem They musf manage rhe s rorage of femporary variables They can affecf las ring changes To The compu rer by changing variables ou rside The scope of The func rion Some func rions exis r only for fhis purpose and so have no refurn value Functions cont Functions have at minimum the following form name statements So that the computer knows how to interpret the bits going into and out of a function the arguments are listed in sequence and the data types of the arguments and return type are specified Functions cont Examples of function declarations Entry point to a program arguments int mainint argc char argv recelve command line arguments int main void Alternate entry point to a program int fdoub1e d int t void g void Function that takes no arguments and returns no value Function that takes unknown arguments and returns an int h 0 The use of these quotImplat declarations IS not recommended Variable Lifespan As a program runs iT consumes memory Some ofThis memory consumpTion is Temporary for inTermediaTe resulTs eTc Some is permanenT holding The sofTware iTself eTc When a program needs Temporary memory iT requesTs H from The operaTing sysTem which is responsible for resource sharing beTween programs When The program is done wiTh H H gives iT back To The OS for quotrecyclingquot To oTher programs Managing memory use is a major responsibiliTy for big programs Variable Lifespan co M G has rhree differen r ways of managing The memory used by variables Sia ric space for variables is allocated when a program s rar rs and held un ril i r exi rs Au roma ric space for variables is alloca red when a func rion en rers and released when if exi rs 39 Vynamic space for variables is alloca red and released upon explici r program request We39ll ralk abou r dynamic memory managemen r afier in rroducing poin rers la rer Variable Lifespan lco nT Variables declared ouTside The scope of a funcTion are considered quotexTernalquot variables and live for The enTire lengTh of The program They can be accessed from any funcTion The amounT of memory allocaTed is xed aT compile Time sTaTic allocaTion They are pre iniTialized wiTh zero values Variables declared from wiThin a funcTion are considered quotinTernalquot variables and exisT while ThaT funcTion is running auTomaTic allocaTion They are noT visible from ouTside The funcTion They are noT pre iniTialized and conTain quotgarbagequot unTil assigned an iniTial value variable Lifespan lcont Internal variables can be made permanent by adding the static speci er to the variable declaration The visibility of the variable does not change but it s value will persist across multiple calls to its enclosing function static allocation void fvoid lnitialized 0an once static int x 4 printfquotdnquot x This function prints the next number each time it is called When a feature is declared it becomes available for use by statements that follow in the source file void g void Error undefined void g void Error undefined printfquotdnquot x printfquotdnquot x int x 4 prlntf 6dn x int x 4 External variable 39 im Iicitl static void hvoid printfquotdnquot x Scope cont A variable exists only within the block where if is declared void g void void g void int x 4 int x 4 printfquotdnquot x printfquotdnquot x grintfquotdnquot x 1 Different variable intx5 r gt V printf quotdnquot x Error undefine Scope cont A local variable can hide a variable from an outer block void g void intx4 printf quotdnquot x lt1 Prints 4 i intx 5 printf quotdnquot X lt Prints 5 i printf quotdnquot x lt2 Prints 4 I Bu r donquott do this deliberately it39s confusing The form on the right side of the previous page is OK Scope lcont When a function is declared it becomes available for use by functions after it in tbe c source le void g void f Problem f not known yet 1 7 V void f void f g ltOK g already declared The main function is conventionally placed at the bottom of the file so it can call other functions Scope icont One way to solve this problem is to create a forward declaration of the function to warn the compiler it39s coming void f ltquotDeclarationquot no method body void g void f ltKnows f 39s arguments and return type 1 void f void quotDefinitionquot Scope lco nT One reason for This behavior is ThaT G is a quotonepass compiler IT reads and processes The le once learning abouT each symbol iT39s name kind funcTion or variable daTa Type eTc as H scans The le lineby line The compiler doesn39T know how To use a symbol unTil H has seen iTs declaraTion 0Ther languages use a quotTwopassquot compiler which prescans The source code learning The symbols before beginning The main compilaTion pass ThaT does acTual code generaTion G geTs around some ofThe limiTaTions of iTs onepass design by including a quotpreprocessoK The Preprocessor The preprocessor is whaT processes The define macro subsTiTuTions discussed earlier The preprocessor is also used To handle forward declaraTions of funcTions Commonly funcTion declaraTions are moved inTo separaTe les called header 11 les The conTenTs ofThese les is injecTed inTo The source c les using The include direcTive When The compiler encounTers include iT pauses processing ofThe currenT le and processes The header le rsT before conTinuing wiTh The original le The Preprocessor cont Altering the previous example to use a header le results in include quotsomethinghquot void fvoid void gvoid somethingh f r39 Double quotation marks void fvoid 90 somethingc The Preprocessor lco nT Macro de niTions funcTion declaraTions consTanT declaraTions eTc are ofTen moved inTo header les so They can be included from wiThin several source les Larger 0 programs are ofTen spliT among mulTiple 0 les for clariTv and simpliciTY Each le learns abouT funcTions de ned in oTher les Through common header les conTaining The relevanT declaraTio ns Each is Then compiled separaTelv and quotlinkedquot TogeTher wiTh The oThers To build a program The Preprocessor cont Many 0 library functions are declared in standard header les and are accessed using include include ltstdiohgt File 0 and printf include ltstringhgt String copying comparing concatenation include ltmath hgt Mathematical functions include ltstdlib hgt Type conversion amp memory management functions Use angle brackets to get standard library headers 39J 4 a V7 w M Y 4139 ny E g w In l39l lt1 The University of New Mexico LOS ALAMOS fmm Lecfure 1 Structure of 00m u ring Systems D 4 I Gompu rers acqmre s rore process and franswu r large numbers of dga There are six impor ran r concep rs in the above sen rence 5 quotLarge numbers of daTa If you are working wiTh small quanTiTies of daTa TradiTio nal meThods of compuTaTion will su ice GompuTers were developed for siTuaTions These meThods cannoT be applied To To produce The needed resulTs in a reasonable Time compuTers musT operaTe aT a high raTe of speed This is measured in Two ways How quickly an individual resulT is produced laTency 39 How many resulTs can be produced over a susTained period of Time ThroughpuTl 6What are quotdata A datum singular of data l is a piece of information The smallest discrete unit of information is called a bit binary digit A bit distinguishes between two possible states What states those are depends on the quotproblem domain being considered The question quotPo you want the blue pill or the red pill requests one bit of information 6 State 1 State 2 Binary Vigits Other possible interpretations of a bit are State 1 State 2 left right on off true false 0 1 positive negative Binary Vigits cont Since it is such a small quantity of information a bit isn t very useful but bits can be grouped to increase information bearing capacity Combination 1 Combination 2 Combination 3 Combination 4 Bit1 State1 State1 State 2 State 2 Bit 2 l State 1 State 2 State 1 State 2 WT 39 If bit 1 can vary independently of bit 2 the total number of possible combinations is the product of the number of pgssiblze states of bit 1 times the number of possible states 0 bit Binary Vigits cont With 3 bits the number of possible combinations is 2 2 2 8 In general for n hits the number of possible combinations is 2 To determine the number of bits needed to represent a piece of information consider the total number of possibilities lor conditions that need to be represented Days of the Week Sun Mon Tue Wed Thr Fri Sat 1 2 3 4 5 6 7 W Binary Vigits loont To represent a set of n possibilities the number of bits required is logy1 The l and l brackets are the ceiling operator The value of lxl is quotthe smallest integer not less than x Meaning round any fraction up to the next higher integer Binary Vigi rs cont To represen r The seven days of rhe week we would need log27 1 bits 2807 bi rs 3 bi rs 3 bi rs is capable of represen ring 23 8 s ra res so we verify suf cien r s ra res wi rh one quotsparequot nary Vigits cont 10g2x can also be calculated loglox logloz on a calculator that does not support binary logarithms A plot of y logzx looks like tlois Binary Vigifs cont A plot of y 10g2x 1 shows how many bits are required to represent x number of states Binary Vigits cont The most straightforward use of bits is to represent integers In computing the alternate states of a bit are often thought of as representing 0 and 1 Larger numbers are represented using groups of bits Bit 1 Bit 2 Value L 0 Binary Vigits cont With enough bits arbitrarily large integer values can be represented This counting system is called base 2 base 1 0 decimal arithmetic except 0000 there are only two digits instead of ten 33 Where decimal arithmetic has a rollover 33 or carry after the digit 9 binary rolls over after the digit 1 The result is a binary number almost always has more digits than its decimal equivalent Base 2 arithmetic is very similar to Bits Value WhWNdO OON U1hWNHO dddddd Number Bases Vecimal ariThmeTic has a seT of 10 symbols 01234 5 678 9 To express largermagniTudes mulTiple digiTs are combined using digiT posiTion To signify parT ofThe value 3 6 9 3 Above The 3 digiT in The rsT posiTion has a differenT meaning Than The 3 digiT in The IasT posiTion by virTue of iTs order wiThin The number Number Bases lco nT Each posiTion in a decimal number carries wiTh H a signi cance Hundreds Place Units Place Thousands Place Tens Place Two facTors make up The magniTude of a digiT iTs value and iTs posiTion The 3 in The rsT posiTion signi es Three Thousand because H is mulTiplied by The value of The posiTion Number Bases co n r Each posi rion in a decimal number implies a mul riplier x100 x1 x1000 x10 80 rha r rhe number 369310 means 3 x Thousand 6 x hundred 9 x ren 3 x one Number Bases co n r Generalizing rhe pa r rern of rhe mul ripliers a bi r x1 02 x1 00 x103 x101 This s rar rs ro reveal wha r is going on wi rh posi rional numbering The exponen r is equivalen r To The posi rion number s rar ring from zero Goun ring s rar ring from zero is common in compu rer science because if works be r rer for many fhings Number Bases co M The pai rern con rivwes pas r any decimal poin r x1 02 x1 00 x1 0392 369314 x1 03 x1 01 x1 0391 The decimal poin r exis rs To mark where ihe 100 mul riplier is The recurring 10 in The mul ripliers ma rches The number of digi rssymbols in decimal Number Bases co M The same pa r rern works for non decimal number bases xb2 xb0 x b392 n3 n2 n1 no quot1 2 xb3 xb1 xbquot The value of each posi rion is given as a func rion of rhe number base b also called radix and The dis rance from The radix poin r wha r i r39s called when you migh r be in a number base o rher rhan decimal ii Li iw i i i i ifi i Lg Lvi i ii i i i i i i i xi i i i i ii i i iji ii i i ii i Li i 1it Number Bases co M Adap ring rhe pa r rern for base 2 binary x22 x20 x24 101101 x23 x21 x24 Subs ri ru ring 2 for The number base gives each posi rion a mul riplier value differen r from The conven rio nal one used To do ma rh by hand 11 gives fhe mul riplier value used by compu rers Number Bases co M x22 x20 x24 x23 x21 x24 The value of 1011 012 is lxeFOX4F1XZ1XlF0x4lx 1125m Number Bases ioont Converting a number to binary involves subtracting out successive powers of two The binary representation of 27 510 is 275 16 0 24 23 21 20 2391 amnwwacomuamhwwacLb d ddddd Exercises WhaT comes offer 1011 Conver39T To decimal 10012 011112 10101112 Conver39T To binary 310 8510 107510 I l 2 OompuTers STore llaTa GompuTers sTore all daTa as binary numbers because This form is The mosT naTural when working wiTh elecTronic circuiTs The Two sTaTe naTure of binary numbers maTches The behavior of elecTrical swiTches openclosed and memory cells chargeduncharged The disadvanTage of binary is ThaT iT39s iniTially less familiar To people Programmers ofTen work wiTh binary numbers when dealing wiTh The more fundamenTal deTails of compuTing Hexadecimal Numbers Since binary numbers tend to have lots of digits it s often more convenient to use the hexadecimal base 16 form which condenses 4 binary digits into a single hexidecimal digit according to the pattern at right Hexidecivnal has sixteen digits with the last six digits being drawn from the alphabet Decimal Hexadecimal ll 00V U1 WNHO dd t WN O xx 01h l 39HmU UU O IU1BWNHO Hexadecimal Numbers cont An example hexadecimal number 0x1A4C The pre x 0x zero x is used to mark hexadecimal numbers l r s Interpretation m decimal Is 1 x 4096 10 x 256 4 x 16 12 x 1 4096 2560 64 12 6732 10 Decimal Hexadecimal 00V U1 WNHO xxxxxx mBQJN O 39HmU UU O IU1BWNHO m LComputers Acquire Vata Text is a type of data that people often want to store in computers Before it can be stored it must be converted into the binary numeric format This is done by breaking text down into individual cbaracters letters numbers punctuation marks to which a numbering scheme can be app ed Characterl Value 3 0x41 Ox6D 0x24 W To ensure rha r rex r encoded in ro binary on one compu rer can be correc rly inferpre red on o rher compufers s randard quotencodingsquot are used like The American Siandard Code for Informa rion ln rerchange ASCII shown below 0x20 quotamp39 0x2F 0x30 e0123456789ltgt a0x3F 0x40 ABCDEFGHIJKLMNOvr0x4F Ox50PQRSTUVWX Zquot 0x5F 0x60 abcdefghijklmnoo r0x6F 0x70 opqrstuvwxyz 0x7F 1951mm ions of text are then represented as a s rring of hexadecimal numeric character codes I487765776c6c6f2c120j7576fl72j6c164j21 H e o W o r d Turning Things Into Iata Other kinds of information require more conversion to be turned into numbers Sound is the time varying compression and rarefaction of gas molecules in the air Turning Things Into Vata cont These puses in the air can be measured and graphed time if 2 But there are still no distinct data points to capture Turning Things Into Iata ioont We can quantize the information by picking a resolution 00 NODP I I I I I 7 I I 6 I 5 gt I 43 U g I 73 L 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 At each chosen time interval the instantaneous value of the plot is sampled and digitized


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

Janice Dongeun University of Washington

"I used the money I made selling my notes & study guides to pay for spring break in Olympia, Washington...which was Sweet!"

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"


"Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.