# Register now to access 7 million high quality study materials (What's Course Hero?) Course Hero is the premier provider of high quality online educational resources. With millions of study documents, online tutors, digital flashcards and free courseware, Course Hero is helping students learn more efficiently and effectively. Whether you're interested in exploring new subjects or mastering key topics for your next exam, Course Hero has the tools you need to achieve your goals.

3 Pages

### lec01_2008_4

Course: COMP 3600, Fall 2009
School: Allan Hancock College
Rating:

Word Count: 758

#### Document Preview

0. Chapter Introduction 0.1 The Definition of Algorithms (cont.) For a given problem, there are many algorithms for it, e.g., there are a number of algorithms for the sorting problem. 1. insertion sort Algorithms Algorithm Analysis Algorithm Design 2. bubble sort 3. mergesort 4. quicksort 5. shellsort 6. heapsort 7. bucket sort COMP3600/6466: Lecture 1 2008 2 COMP3600/6466: Lecture 1 2008 4...

Register Now

#### Unformatted Document Excerpt

Coursehero >> California >> Allan Hancock College >> COMP 3600

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
0. Chapter Introduction 0.1 The Definition of Algorithms (cont.) For a given problem, there are many algorithms for it, e.g., there are a number of algorithms for the sorting problem. 1. insertion sort Algorithms Algorithm Analysis Algorithm Design 2. bubble sort 3. mergesort 4. quicksort 5. shellsort 6. heapsort 7. bucket sort COMP3600/6466: Lecture 1 2008 2 COMP3600/6466: Lecture 1 2008 4 Algorithms 0.1 What is an Algorithm? An algorithm is any well-defined computational procedure that takes some value or a set of values as input, and produces some value or a set of values as output. Example one: Sort n integers in increasing order. Input: a sequence of n numbers, a1, a2, . . . , an Output: a permutation (rearrangement) of the numbers as a , a , . . . , a , such that 1 2 n a1 a2 an. Example two: Given an integer N , determine whether it is a prime number. Input: N Output: YES if N is a prime number, otherwise, NO. Example three: Given an integer N , Print out prime numbers no greater than N . Input: N Output: a sequence of prime numbers, and no number is larger than N . Question: Given 8 identical coins, there is a fake coin, which may be either heavier or lighter. Assume that there is a balancing-scale available, to identify that fake coin, how many rounds of comparisons are needed? how many rounds of comparisons are required, if the number of coins is not 8 but n instead? COMP3600/6466: Lecture 1 2008 1 COMP3600/6466: Lecture 1 2008 3 0.2 Algorithm Analysis (continued) Insertion Sorting Important concepts used in the analysis of algorithms: 0.2 Algorithm Analysis (continued) Input size: If the input to an algorithm is "5413133", is the input size 1, 7, 23 or 5413133? Running time (worst-case and average-case): The running time of an algorithm on a particular input is the number of primitive operations or steps executed. However there is more than one idea about what a primitive operation is. Order of growth: To simplify the analysis of algorithms, we are interested in the growth rate of the running time, i.e., we only consider the leading term of a time formula. e.g., the leading term is n2 in the expression n2 + 100n + 50000. Algorithm Insertion(A) 0 n length[A] 1 for j 2 to n do 2 key A[ j] 3 /* Insert A[ j] into sorted sequence A[1 . . . j - 1] */ 4 i j-1 5 while i > 0 and A[i] > key do 6 A[i + 1] A[i] 7 i i-1 8 A[i + 1] key E.g., analyze insertion sort algorithm: time and space. See page 24. COMP3600/6466: Lecture 1 2008 6 COMP3600/6466: Lecture 1 2008 8 0.2 Algorithm Analysis Analysis of an algorithm is predict to the resources that the algorithm requires. Resources are measured in relation to a model of computation, which is a mathematical abstraction of a computer on which the algorithm is implemented. In the following several popular computational models are listed. 0.2 Algorithm Analysis (continued) Most analysis of algorithms of the type we will encounter in this course is done using the following assumptions. RAM (random access machine) model with unlimited memory. Operations such as arithmetic with small integers, boolean operations, fetching and storing small quantities, take unit time. RAM: time and space (traditional serial computers) PRAM: parallel time, number of processors, and read-and-write restrictions (SIMD type of parallel computers) Worst case performance is emphasised, but average and amortised performance is also important. Many other conventions exist (example: bit complexity) but we will not encounter them very much. Message Passing Model: communication cost (number of messages), and computational cost (usually the cost for local computation is ignored) (Distributed computing, peer-to-peer networking, MIMD type of machine) Turing Machine: time and space (abstract theoretical machine) COMP3600/6466: Lecture 1 2008 5 COMP3600/6466: Lecture 1 2008 7 Divide-and-Conquer (D&C) Paradigm Given a problem A , if the D&C strategy is applicable, the problem is then solved using the strategy. The detailed steps are as follows. 1. Divide A into a number of subproblems with the same size roughly. 2. Conquer the subproblems by solving them recursively. For small enough subproblems, solve them directly without dividing them further. 3. Combine the solutions of the subproblems into the solution for the original problem. Cormen, p33 COMP3600/6466: Lecture 1 2008 10 COMP3600/6466: Lecture 1 2008 12 0.3 Algorithms Design For a given problem, there are many ways to design algorithms for it, (e.g. Insertion sort is an incremental approach). The following is a list of several popular design approaches. Divide-and-Conquer (D&C) Paradigm (cont.) Divide-and-Conquer (D&C) Greedy Approach Dynamic Programming Linear Programming Branch-and-Bound Pruning COMP3600/6466: Lecture 1 2008 9 An Example of D&C Strategy: Consider the merge-sort algorithm. Divide: divide the n-element sequence into two subsequences of n/2 elements each (or as close as possible if n is odd) Conquer: sort the two subsequences recursively using the merge sort Combine: merge the two sorted subsequences into a sorted sequence COMP3600/6466: Lecture 1 2008 11
Textbooks related to the document above:
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Allan Hancock College - COMP - 3320
The Australian National UniversityFaculty of Engineering and Information TechnologyDepartment of Computer ScienceCOMP3320/6464/Honours 2008 Course AdministrationPreambleThis document gives a brief description of the administrative arrangement
Allan Hancock College - COMP - 3320
COMP3320/COMP6464: Post Risc, the Intel Family and beyond! Alistair RendellSee: High Performance Computing, Dowd and Severance, Appendix A Structured Computer Organization, Andrew S. Tanenbaum, Edition 4COMP3320 Lecture 9-0 Copyright c 2008 The Au
Allan Hancock College - COMP - 3320
THE AUSTRALIAN NATIONAL UNIVERSITY First Semester Examination June 2006 COMP3320/COMP6464/Honours High Performance Scientific Computing Study Period: 15 minutes Time Allowed: 3 hours Permitted Materials: Calculator Exam questions total 70 marks. COM
East Los Angeles College - MATH - 1725
Percentage absent in each lecture40 Percentage absent in lecture 0 10 20 30510 Lecture number1520
East Los Angeles College - MATH - 2715
MATH2715 lecture topics1. Modelling earthquakes. Poisson process; method of moments for exponential distribution; moments about zero. 2. More moments. Moments about the mean; skewness and kurtosis. 3. Assessing goodness of fit. Cumulative distributi
Allan Hancock College - COMP - 3320
COMP3320/COMP6464: Hardware Performance Counters Alistair Rendell See various articles linked to lecture note web siteCOMP3320 Lecture 7-0 Copyright c 2008 The Australian National University7.1Why Weve seen that modern machines are complex -
East Los Angeles College - MATH - 3733
7 Lecture: Central Limit Theorem Another Proof1. Theorem Let X1 , X2 , . . . are IIDRV's with EX1 = 0, var(X1 ) = 2 (0, ), Sn = n Xk . Then, k=1 Sn / n 2 = N (0, 1)2. Proof (not compulsory): Hint-1. It suces to show convergence(1) Eg(Sn /
Allan Hancock College - COMP - 3320
Python Short Course Lecture 5: Extending PythonRichard P. Muller Materials and Process Simulation Center Spring, 2000Extending Python Python is great for rapid application development Little overhead in creating classes, functions, etc. Can be
Allan Hancock College - COMP - 3320
COMP3320/COMP6464: High Performance Microprocessors Alistair RendellSee: High Performance Computing, Dowd and Severance, Chapter 2 Structured Computer Organization, Tanenbaum, Chapter 8 in Ed 3 Great Microprocessors of the Past and Present, http:/ww
Allan Hancock College - COMP - 3320
Dynamics Simulations COMP3320/6464Dynamics (N-Body Problem)How do we calculate future positions?Esun- earth = GM sun M earth rsun-earthEsun -venus = GM sun M venus rsun - venusEvenus -earth = GM venus M earth rvenus- earth1Interact
Allan Hancock College - COMP - 3320
COMP3320/COMP6464: The UltraSPARC Family Alistair Rendell8.2The UltraSPARC: MicroarchitectureMemory interface unitSee: High Performance Computing, Dowd and Severance, Appendix A Structured Computer Organization, Andrew S. Tanenbaum, Edition 4
Allan Hancock College - COMP - 3320
#include &lt;stdio.h&gt;#define REAL floatint main(void){ REAL x,y,z,h; printf (&quot; Step Numerical Analytical Absolute Error\n&quot;); h = (REAL) 0.1; x = (REAL) 1.23456789; while (h &gt; 1.0e-15){ y = (x+h)*(x+h)*(x+h
Allan Hancock College - COMP - 3320
&lt;h1&gt;Things you should know by now #1!&lt;/h3&gt;&lt;h2&gt;General Background&lt;/h2&gt;&lt;li&gt;Describe two areas where HPC is important, include in your answerjustification for why HPC is required.&lt;li&gt;What is Moore's law&lt;h2&gt;Performance Measurement etc&lt;/h2&gt;&lt;li&gt;Diff
Allan Hancock College - COMP - 3320
Chapter 2Message-Passing ComputingSlides for Parallel Programming Techniques &amp; Applications Using Networked Workstations &amp; Parallel Computers 2nd Edition, by B. Wilkinson &amp; M. Allen, 2004 Pearson Education Inc. All rights reserved.2.1Message
Allan Hancock College - COMP - 3320
NUMERICAL COMPUTINGJAVA AND NUMERICAL COMPUTINGJava represents both a challenge and an opportunity to practitioners of numerical computing. This article analyzes the current state of Java in numerical computing and identies some directions for the
Allan Hancock College - COMP - 3320
UltraSPARC III Cu ProcessorThe UltraSPARC III Processor Moves to Copper TechnologyAn Overview of theVersion 1.1 June 2002 A White PaperThis document provides a brief overview of the important new technology in the UltraSPARC III processor gen
Allan Hancock College - COMP - 3320
COMP3320/COMP6464: Shared Memory Computers Alistair RendellSee: High Performance Computing, Dowd and Severance, Chapter 1013.2The Parallel Challenge&quot;Our challenge is to find techniques that make a program that takes an hour to complete using o
Allan Hancock College - LAW - 5110
PAEDIATRIC FORENSIC MEDICINE A/Professor David WellsThis lecture will build on information that you have received in earlier years of the course; most specifically a tutorial during your Paediatrics term in fifth year. At the end of this programme i
Allan Hancock College - COMP - 2100
Defect Types 10 Documentation 20 Syntax 30 Build, Package 40 Assignment 50 Interface60 Checking 70 Data 80 Function 90 System 100 EnvironmentAssignment Kit #81Table 12.2 Defect Recording LogStudent InstructorDate Description: Number Type In
Allan Hancock College - COMP - 2300
THE AUSTRALIAN NATIONAL UNIVERSITY Mid Semester Examination, April 2008 COMP2300 / COMP6300 (Introduction to Computer Systems ) Writing Period: 1 hour duration Study Period: 0 minutes duration Permitted Materials: One A4 page with notes on both sides
Allan Hancock College - COMP - 1100
Top-down Design II Ask yourself, Is the problem at hand: Sequential? Conditional? Iterative? If it is, then use Compound statement if or switch Loop construct But the choice is not always clear. Continued from last lecture where we did Inse
Allan Hancock College - COMP - 2400
- cae August 2006- drop The Video Store databasedrop table Video;drop table ActsIn;drop table Movie;drop table Studio;drop table MovieExec;drop table Director;drop table Actor;drop table Customer;- create The Video Store databasecreate
Allan Hancock College - COMP - 2400
SQL&gt; start course.sqlSQL&gt; - AV Peterson 05-07-2005SQL&gt; SQL&gt; - Course( CourseCode, CourseName, Points, Dept )SQL&gt; SQL&gt; CREATE TABLE Course 2 ( 3 CourseCode VARCHAR(8), 4 CourseName VARCHAR(80), 5 Points NUMBER(2), 6 Dept
Allan Hancock College - COMP - 2400
SQL&gt; @q1SQL&gt; - cae Oct 2006SQL&gt; SQL&gt; - How many directors have died since 1984?SQL&gt; SQL&gt; - FIRST ATTEMPTSQL&gt; SQL&gt; select DirectorId, count(DirectorId) as DirectorDied 2 from Director 3 where YearDied =&gt; 1984;where YearDied =&gt; 1984
Allan Hancock College - COMP - 2400
SQL&gt; start q18a.sqlSQL&gt; - A V Peterson 26-07-2005SQL&gt; - Q18a What is the average Mark in COMP1100?SQL&gt; - using sum/countSQL&gt; SQL&gt; SELECT SUM(Mark) / COUNT(*) 2 FROM Enrolment 3 WHERE CourseCode = 'COMP1100' 4 /SUM(MARK)/COUNT(*)
Allan Hancock College - COMP - 2400
SQL&gt; - cae August 2006SQL&gt; SQL&gt; set pagesize 250SQL&gt; set linesize 132SQL&gt; SQL&gt; ttitle &quot;TVS Videos with LOVE in the Title which are Available for Sale&quot;SQL&gt; SQL&gt; select v.videoid, m.movietitle 2 from tvs.video v, tvs.movie m 3 where v.s
Allan Hancock College - COMP - 2400
SQL&gt; - Q28a Average mark rounded to 1 decimal placeSQL&gt; SQL&gt; SELECT ROUND(AVG(Mark), 1) AS Average 2 FROM Enrolment 3 / AVERAGE -
Allan Hancock College - COMP - 2031
Test 0: 0 1 2 3 4 5 6 7 Test 1: 2 3 5 5 9 Test 2: 2 3 Test 3: 0
Allan Hancock College - COMP - 2031
COMP2031 &amp; ENGN2003: Assignment 1Name: [Your First_name LAST_NAME, e.g., Jim GRUNDY]Student#: [Your student number, e.g., 99999999]Lab Group: [Your laboratory class, one of: mon12, tue09, tue13, tue15, tue17, wed11, wed17, thu12, thu15,
Allan Hancock College - COMP - 2300
COMP2300/6300-2009-CourseAdminThe Australian National University College of Engineering &amp; Computer Science1Department of Computer Science COMP2300/6300-2009-CourseAdmin Course Administration1 PreambleThis document gives a brief description of
Allan Hancock College - COMP - 2300
PeANUt Module Overviewq a simple microprocessor simulator for teaching purposes q main topics: s s s sPeANUt architecture, machine and assembly language programming branches and conditions, loops, input/output, traps, macros procedures and functi
Allan Hancock College - COMP - 2300
Module 2: The C programming languageLecture 1The C programming language What is C and why we learn it History of C Running the Hello World program Generating output! Language components: Data types, literals, identiers, variables References
Allan Hancock College - COMP - 2300
THE AUSTRALIAN NATIONAL UNIVERSITY Mid Semester Examination, April 2007 COMP2300 (Introduction to Computer Systems ) Writing Period: 1 hour duration Study Period: 0 minutes duration Permitted Materials: One A4 page with notes on both sides. NO calcul
Allan Hancock College - COMP - 2300
PeANUt Module Overviewq a simple microprocessor simulator for teaching purposes q main topics: s s s sPeANUt architecture, machine language and assembler programming branches and conditions, loops, input/output, traps, macros procedures and functi
Allan Hancock College - COMP - 2300
Operating System Issuesq ref: [Tanembaum, sect 1.2, (6.1) &amp; 6.4] [OH&amp;Bryant, sect 8.2] q operating system (O/S) functions q a brief history of operating systems q key concepts: s process management x scheduling, process state, multiprocessing s sto
Allan Hancock College - COMP - 2300
Operating System IssuesA Brief History of Operating Systems (1)q Zeroth Generation (1940's) s no real O/S: users hand-coded all functions in machine language s programs loaded via a bootstrap program s I/O facilitated by subroutine libraries q Fir
Allan Hancock College - COMP - 2300
Welcome to COMP2300 Introduction to Computer SystemsCourse Scheduleq lectures: three one hour lectures per week, ve modules: s s s s s sDigital building blocks (4) C language (4) PeANUt or Assembly Level Machine Organisation (9) Memory Systems a
Allan Hancock College - COMP - 2300
Course Review and Exam Discussionq review Q4(a) from 2006 exam (maybe a few others) q nal examination: s details s topics q review of major underlying themes q outlook for computer systems q other issues: s 14:0014:15: CEDAM Surveys x please take an
Allan Hancock College - COMP - 2300
Allan Hancock College - COMP - 2300
Allan Hancock College - COMP - 2300
THE AUSTRALIAN NATIONAL UNIVERSITY First Semester Examination June 2000 COMP2300 Introduction to Computer Systems ENGN2213 Computer Organisation Study Period: 15 minutes Time Allowed: 3 hours Permitted Materials: One A4 page with notes on both sides
Allan Hancock College - COMP - 2300
PeANUt Assembly Language: a Better Way to Initialize the PeANUtq ref: [PeANUt Spec, sect 4] q today: s s s smotivation addressing modes revisited assembly language format translating C into PeANUtq over next 4 lectures: s a second pass of PeANUt
Allan Hancock College - COMP - 2300
15-213The course that gives CMU its Zip!Machine-Level Programming I: Introduction Sept. 10, 2002TopicsAssembly Programmers Execution Model Accessing Information Registers Memoryclass05.pptArithmetic operationsIA32 ProcessorsTotally
Allan Hancock College - COMP - 2300
15-213&quot;The course that gives CMU its Zip!&quot;Machine-Level Programming V: Miscellaneous Topics Sept. 24, 2002Topics Linux Memory Layout Understanding Pointers Buffer Overflow Floating Point Code1class09.ppt15-213, F'02FFLinux Memory L
Allan Hancock College - COMP - 2300
From Physical Memory To Virtual Memory: Understanding the Memory HierarchyAlistair RendellComputer Systems: A Programmers Perspective Randal E Bryant and David OHallaron Structured Computer Organization Andrew Tanenbaum1Memory Chips: SRAM Rem
Allan Hancock College - COMP - 2300
Operating Systems: Memory ManagementAlistair Rendell(minor updates by Peter Strazdins)Computer Systems: A Programmers Perspective Randal E Bryant and David O'Hallaron Structured Computer Organization Andrew Tanenbaum1Memory Management: Objec
Allan Hancock College - COMP - 2300
Assembly Level Machine OrganisationLecture 6More PeANUt assembly language Loops in assembly code Arrays in assembly Evaluating complex expressions Reference: Specification of the PeANUt computer (Section 4) Additional reading: Section 3.8 i
Allan Hancock College - COMP - 2300
Module N: NetworksLecture 1Computing systems and communications Introduction Computer-Communication revolution Communications model Communications tasks Communications architecture Reference: Data and computer communications, William Stall
Allan Hancock College - COMP - 2300
Instruction Set Architecture and the SPARC: Referencesq iwaki.anu.edu.au: an UltraSPARC IIICu system s system configuration info from the commands prtconf and fpversion q Structured Computer Organization, Andrew S. Tanenbaum, Edition 3 q SPARC Arch
Allan Hancock College - COMP - 2300
Background: why use computer simulation?q or, why not just run and time the application on the computer itself? q advantages of simulating applications: s can have full visibility: actual H/W may not count all events of interest s the simulated comp
Allan Hancock College - COMP - 2300
Assembly Level Machine OrganisationLecture 8Procedure calls and address parameters in PeANUt Procedure calls With local variables With return values (non-void functions) Address parameters Ability to modify data Indirect memory reference vi
Allan Hancock College - COMP - 2300
Assembly Level Machine OrganisationLecture 5PeANUt assembly language Motivation Addressing modes revisited Assembly language format Translating C into PeANUt Reference: Specication of the PeANUt computer (Section 4)1COMP2300, 2006Asse
Allan Hancock College - COMP - 2300
Assembly Level Machine OrganisationLecture 3Home work and unsupervised lab this week Home work 2 is now online on COMP2300 Web site Part 1 on paper (estimated one hour work) Part 2 in labs (normal lab times, but no tutor available) (experiment
Allan Hancock College - COMP - 2300
Operating System ConceptsLecture 1Operating system issues Operating system (O/S) functions A brief history of operating systems Processes and Process Management References: Tanenbaum, chapters 1.2, (6.1) and 6.4 Specification of the PeANUt
Allan Hancock College - COMP - 2300
Module N: NetworksLecture 2Network Routing and the Internet Network switching Network routing Local area networks (LANs) Inter-networking Redundancy Internet protocols and addressing References: Bryant and O'Hallaron, Sect 12.1 12.3 (Da
Allan Hancock College - COMP - 2300
Module 1: Digital Building BlocksLecture 4Computer History 1642: Pascal built add/subtract machine 1672: Leibniz built add/sub/mul/div machine 1822: Babbage built a difference machine with punch card output. Later he designs a general purpose
Allan Hancock College - COMP - 2300
COMP2300 Encoding and TransmissionFrom Computer Organization and Architecture, Linda Null and Julia Lobur, ISBN 0 7637 0444 XCodes for Data Transmission and Recording Digital switches, such as memories, are either on or off with nothing in betwee
Allan Hancock College - C - 2300
#include &lt;stdio.h&gt;#include &lt;string.h&gt;int main(){ char fname[]=&quot;KKKKKKKKKKKKKKKKKKKK&quot;; char sname[]=&quot;LLLLLLLLLLLLLLLLLLLL&quot;; char fullname[40]; int i=-1,j=-1; printf(&quot;Enter your Full Name\n&quot;); do {i+; scanf(&quot;%c&quot;,&amp;fname[i]); }wh
Allan Hancock College - COMP - 2300
#include &lt;stdio.h&gt;#include &lt;string.h&gt;int main(){ char fname[]=&quot;KKKKKKKKKKKKKKKKKKKK&quot;; char sname[]=&quot;LLLLLLLLLLLLLLLLLLLL&quot;; char fullname[40]; int i=-1,j=-1; printf(&quot;Enter your Full Name\n&quot;); do {i+; scanf(&quot;%c&quot;,&amp;fname[i]); }wh
East Los Angeles College - GEOG - 5071
Geog5071M GIS and Urban Planning Unit 6 PracticalGIS and Education1 Background and InformationThe practical task associated with this unit will consider the provision of secondary schools in Leeds relative to the geographies of demand for these ed
Allan Hancock College - C - 2300
#include&lt;stdio.h&gt;int main(void) { int array1[]={1,2,3,4}; int array2[]={-1,-2,-3,-4}; int i; printf(&quot;\nInitial Values of Array1 and Array2\n&quot;); for(i=0; i&lt;4; i+){ printf(&quot;Element %d Array1 = %4d Array2 = %4d\n&quot;, i,array1[i], array2