Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 111 – Nov. 5 Sorting –Selection and Bubble √ –insertion: place next element in correct place by shifting over other ones to make space –Merge: Repeatedly.

Similar presentations


Presentation on theme: "CS 111 – Nov. 5 Sorting –Selection and Bubble √ –insertion: place next element in correct place by shifting over other ones to make space –Merge: Repeatedly."— Presentation transcript:

1 CS 111 – Nov. 5 Sorting –Selection and Bubble √ –insertion: place next element in correct place by shifting over other ones to make space –Merge: Repeatedly split list in half until 1-2 elements each. Then merge adjacent lists by collating them. Computer languages 3 kinds of software errors Commitment –For next week, please read sections 6.2 (review); 9.1, 9.2

2 Language evolution Machine language Assembly language –Like machine language, also unique to each manufacturer High-level language –FORTRAN, COBOL –Pascal, Algol, Ada –C, C++, C# –Java, Javascript, Python –many more

3 Example How would we calculate: 1 2 + 2 2 + 3 2 + … + 20 2 ? Let’s create our own solution, and see what the “code” looks like in different types of languages: –Machine language  –Assembly language  –High-level language

4 Machine language 00003000:00000014 00004000:200c0001 00004004:20080000 00004008:3c0a0000 0000400c:354a3000 00004010:8d4a0000 00004014:018a4822 00004018:1d200005 0000401c:018c0018 00004020:00005812 00004024:010b4020 00004028:218c0001 0000402c:08001005 00004030:2008000a 00004034:0000000c  help me!

5 Assembly language numValue:.word 20 __start: addi $12, $0, 1 addi $8, $0, 0 lui $10, 0 ori $10, $10, 0x3000 lw $10, 0($10) while: sub $9, $12, $10 bgtz $3, end mult $12, $12 mflo $11 add $8, $8, $11 addi $12, $12, 1 j while end: addi $8, $0, 10 syscall

6 HLL (Pascal) var sum : integer; count : integer; begin sum := 0; for count := 1 to 20 do sum := sum + count * count; writeln(sum); end.

7 Bugs Any mistake made in a computer program Term ‘bug’ coined by Grace Hopper, ca. 1950 3 kinds of bugs –Syntax errors –Run-time errors –Logical errors Beyond bugs, program can be just slow! –Ex. Ineffective ways of finding the divisors of some number.

8


Download ppt "CS 111 – Nov. 5 Sorting –Selection and Bubble √ –insertion: place next element in correct place by shifting over other ones to make space –Merge: Repeatedly."

Similar presentations


Ads by Google