PROBLEM SOLVING TECHNIQUES
|
|
- Robert Caldwell
- 5 years ago
- Views:
Transcription
1 PROBLEM SOLVING TECHNIQUES UNIT I PROGRAMMING TECHNIQUES 1.1 Steps Involved in Computer Programming What is Program? A program is a set of instructions written by a programmer. The program contains detailed instructions and complete procedures for performing the relevant tasks. What is Programming? Programming involves creativity, analytical thinking, knowledge in the language in which coding or the programming is done. Steps Involved in Programming 1. Identify the problem 2. Analyzing the Problem 3. Algorithm design 4. Pseudocode conversion 5. Flowchart 6. Coding 7. Debugging 8. Testing 9. Final output 10. Documentation 1.2 Computer programming: Identify the problem Every program aims at solving the problem for which it has been developed. For example An online banking program solves the problem of transferring money, tracking the transactions, etc., filing your taxes. A word processor solves the problem of document creation. Even a game solves the problem of keeping people entertained. The only way to achieve the goal is to aim in finding the problem involved in achieving it. A program is considered as useful only when it solves the problem. This is the first step to approach any solution.
2 1. Analyzing the Problem Once the problem is being identified and target solution is being outlined. Analysis on the problem has to be carried out. Define whether the problem is a continuation of the existing solution or it is a new problem that has been identified. If the problem arises from an existing solution then its quiet easy for us to start our designing from that point. If its a new problem then we need to look in for the base of the problem and then move further for coding. 2. Algorithm Design In this stage the stepwise procedure involved in arriving at the problem solution is identified and documented in simple English language. It is called as a strategy. These contents are said to be understandable by any person who knows simple English. Example1: Adding two subject marks for one student Algorithm: Step 1. Read the two subject marks that have to be added Step 2. Add the two subject marks and save it inside a variable. Step 3. Write the total. Example2: Adding ten subject marks for one student. Algorithm: Step 1. Initialize a sum variable as zero and subject variable as ten. Step 2. While the number of subjects not equal to zero repeatedly do Step 2.a. Read the corresponding subject mark that has to be added. Step 2.b Compute the current sum by adding along with the previous sum value. Step 3. Write the sum. Example3: Adding ten subject marks for fifty students. Algorithm: Step 1. Initialize a sum variable as zero, subject variable as ten and student variable as fifty. Step 2. While number of students is not equal to zero repeatedly do
3 Step 2.a. While the number of subjects not equal to zero repeatedly do Step 2.a.1. Read the corresponding subject mark that has to be added. value. Step 2.a.2. Compute the current sum by adding along with the previous sum Step 2.b. Write the sum for each student. 3. Pseudocode conversion As the stepwise procedure has been outlined they are easily converted into pseudocode. This helps in the coding the solution in the appropriate programming language. Example1: Adding two subject marks for one student Pseudocode: Var mark1, mark2, sum; read(m1); read(m2); sum=m1+m2; write(sum); Example2: Adding ten subject marks for one student. Pseudocode: Var mark, sum; sum=0; subject=10; While(subject!=0) read(mark); sum = sum +mark; subject --; write(sum)
4 Example 3 : Adding ten subject marks for fifty students. Pseudocode: Var mark, sum, student; sum=0; student=50; subject=10; while(student!=0) While(subject!=0) read(mark); sum = sum +mark; subject --; write(sum) student --; 1.3 FLOW CHART The flowchart is an diagrammatic representation of the work flow. This consists of various shapes for representing the various activities at each step which are connected with an arrow. Therefore this gives a clear picture the procedure involved in reaching the target. Types of flow chart System Flowchart the processing of entire system is shown by the system flow chart. It provides details about the input/output devices, the media being used and the flow of data in the system. Program flowchart the overall steps involved in the program execution including I/O, processing, loops and branching. This provides more illuatated look over the entire system excution compared with the system flowchart.
5 Flowchart Symbols Each symbol in the flow chart represents different activities done in the program. These are the various symbols involved in the flow chart. Each sybols specify the activity inside it and they are connected by the flow lines.
6 Example1 : Adding two suject marks for one student Flow chart: Example2 : Adding ten suject marks for one student. Flow chart:
7 Example3 : Adding ten suject marks for fifty students. Flow Chart: CODING: After the target and the steps has been identified. The coding phase can start. The various factors that should be considered while coding are Identify the users of the computer program Determine the basic system configuration for executing the computer program List the programming skill Select the programming language suitable from the list.
8 Identify the users of the computer program If the user of the program is suppose to be the programmer itself. The programmer can frame the program as he or she want it to be. If the user is a person who is no way connected to the programmer. Then the programmer must know the exact expectation of the user. Determine the basic system configuration for executing the computer program The system configuration includes hardware configuration and software configuration. The hardware configuration includes the RAM size, hard disk size, Processor and the various other devices which are used for the program execution. The software configuration includes the type of Operating System, Editor used, Software used for execution,etc., The language in which the program can be written should be listed. List the programming skill When designing any program, list out the programming skill available for your team. Some programming languages may not be suitable for the system configuration, some may not be suitable for getting the expected output. All these factors must be considered and eliminate the program which is not suitable from the list. Select the programming language suitable from the list Out of all the programming languages listed the selection can be made on the number of lines of code. Some programming languages have certain predefined functions for the some activities. Minimal number lines in the codes helps to understand, maintain and debug the code easily. There are various other criteria that can also be added while selecting the programming language. This is either based on the programmer who is going to code the program or the user who are going to use the program. Debugging After the coding is of executable form. It is run several times manually inorder to remove the errors that has been occurred while typing the code. The program execution done manually is called dry run. This process is continued until the code become error less.
9 Testing The testing of the codes are done after the completion of the entire coding. There are three types of data that has to be considered while testing the codes they are usual, unusual and invalid data. These type of datas are given to check the behaviour of the code. If it results in an unexpected way then the code has to be corrected accordingly. This phase aims in providing the best output with any type of input given to the system. Final Output This is the last stage in which the programmer has to show the full efficiency of the program. The exact output expected by the user should be provided. Documentation This is similar to a manual that is been generated for any electronic product.this type of manual is also necessary for the software that is being coded too. This helps the user and the programmer to know about the product and helps in long term maintance. The procedure of usin There are two types of documentation User Manual provides the overall information about how to operate the program and what are the do s and dont s in the program. The steps that has to be carried out when a problem has occured is given in detail. Technical Manual contains the technical information about the program. This is used to get technical details of the program, when the system is not working properly or requires modifications. This is used for long term maintanace of the system. 1.4 THE EFFICIENCY OF ALGORITHMS Efficiency is naturally tied in with the design, implementation, and analysis of algorithms. It is considered based on the usage of the resources. The common measures used to find the efficiency are Time Complexity : It is the amount of cpu time required by a program to execute. Time complexity is the sum of the following components: Compile time The time taken for the compilation of the program.
10 Runtime or Execution time - The time taken for the execution of the program. The optimized code will take less time to get executed. Time complexity T(P) = c + Tp c Compile time Tp Run time or execution time Space Complexity It is the amount of memory required to execute a program. Space complexity is the sum of the following components: Instruction space: algorithm code,data space: input & output data. Due to the high cost of the computing resources it is always desirable to design algorithms that are very economical in the use of CPU time and memory. To design an efficient algorithm the following points to be considered. Redundant computations Referencing array elements Inefficiency due to late termination Early detection of desired output conditions Trading storage for efficiency gains Redundant computations To improve the efficiency of algorithm redundant calculations should be avoided. The effects of redundant computations are most serious when they are embedded within a loop that must be executed many times. Recalculating expression that remains constant throughout the loop is the most common mistake. x=0; for (i=0;i<n;i++) x=x+2 y=(a*a+c)*x+b*b*x write( the value of y=,y) In the above example the expressions (a*a*a+c) and (b*b) remains constant throughout the loop. So this unnecessary multiplications and additions can be removed out of the loop. a=a*a+c; b=b*b;
11 x=0; for(i=0;i<n;i++) x=x+2; y=a*x+b*x; write( the value of y=,y); Referencing array elements Arrays are processed by iterative constructs. Redundant computations can also easily creep into array processing if care is not exercised. For example, consider the two versions of an algorithm for finding maximum and its position in an array. Version 1 p=1 for(i=2;i<n;i++) if(a[i]>a[p] then p=i max=a[p] Version 2 p=1 max=a[1] for(i=2;i<n;i++) if(a[i]>a[p] max=a[i] p=i The version2 implementation would normally be preferred because of the conditional test a[i]>max. It is more efficient because to use the variable max only one memory reference instruction is required, whereas a[p] requires two memory references and an additional operation to locate the correct value for use in the test. Also max variable makes it clearer what task is to be accomplished. Inefficiency due to late termination Next inefficiency is more tests are done than are required to solve the problem. For example, in an alphabetical ordered list of names we are searching a name using linear search. All the names are examined in the inefficient implementation. We are looking for the
12 name flip, then as soon as the name flop encountered an efficient algorithm concludes flip is not in the list. Early detection of desired output conditions We must include additional conditions to detect the conditions for early termination. For example, a bubble sort might be used to sort a set of data that is almost in sorted order. The algorithm will have the data in sorted order long before the loop termination condition is met. It is desirable to terminate the sort as soon as it is established that the data is already sorted. To do this check whether there have been any exchanges in the current pass of the inner loop. If there have been no exchanges in the current pass the data must be sorted and so early termination can be applied. Trading storage for efficiency gains Computing has meant calculating results and then storing those results for later use. Storing large volumes of rarely used data waste spaces, making it a very expensive strategy. In the tradeoff, what usually happens is we recomputed or save some intermediate results and avoid having to do a lot of unnecessary testing and computation later on. Summary: Factors which are decided efficiency of algorithm Eliminate redundant calculations of the expression inside the loop. Remove temporary assignments. Include additional conditions to detect the conditions for early termination Tradeoff unnecessary storage 1.5 ANALYSIS OF ALGORITHM Algorithm Step-by-step procedure for solving a problem. problem solving method for Implementation. well-defined procedure that takes set of values as input and produces set of values as output. Example : the sorting problem Input: sequence A of n numbers a 1, a 2,... a n.
13 Output: reordering of A in increasing value. Good Algorithms possess the following qualities and capabilities: 1. They are simple but powerful and general solutions. 2. They can be easily understood by others, that is, the implementation is clear and concise without being "tricky". 3. They can be easily modified if necessary. 4. They are correct for clearly defined situations. 5. They are able to be understood on a number of levels. 6. They are economical in the use of computer time, computer storage and peripherals. 7. They are documented well enough to be used by others who do not have a detailed knowledge of their inner workings. 8. They are not depent on being run on a particular computer. 9. They are able to be used as a subprocedure for other problems. 10. The solution is pleasing and satisfying to its designer-a product that the designer feels proud to have created. Computational complexity With increasing n the relative difference in the cost of a computation is enormous for these two extremes. Table: Computational cost as a function of problem size for a range of computational complexities log 2 n n n log 2 n n 2 n 3 2 n > >> >> , >> Algorithm analysis : determine the time/space required by an algorithm Goals:
14 minimize time minimize space Pseudo-code is a structured description of an algorithm, not as formal as a programming language. Example: find the maximum element of an array. Algorithm Max(A,n) Input: an array A sorting n integers. Output: maximum element in A 1. max=a[1] 2. for i=0 to n do 3. if max<a[i] then max=a[i] Primitive operations arithmetic operations (+,_,*,/) comparisons indexing,etc. The order notation A standard notation has been developed to represent functions which bound the computing time for algorithms. It is an order notation and its usually referred to as the O- notation. An algorithm in which the dominant mechanism is executed cn 2 times for c,a constant, and n the problem size, is said to have an order n 2 complexity which is written as O(n 2). A function g(n) is O(f(n)) provided there is a constant c for which the relationship g(n)< cf(n) holds for all values of n that are finite and positive. Worst case vs. average case Usually measure worst case complexity. crucial importance in some applications. often algorithms will better worst case performance have worse average case performance in practice. 1.6 STEP-COUNT METHOD The operation-count method omits accounting for the time spent on all but the chosen operation The step-count method count for all the time spent in all parts of the program
15 A program step is loosely defined to be a syntactically or semantically meaningful segment of a program for which the execution time is indepent of the instance characteristics. 100 adds, 100 subtracts, 1000 multiples can be counted as one step. However, n adds cannot be counted as one step. steps/execution (s/e) for (int i = 1; i < n; i++) 1 { 0 // insert a[i] into a[0:i-1] 0 int t = a[i]; 1 int j; 0 for (j = i - 1; j >= 0 && t < a[j]; j--) 1 a[j + 1] = a[j]; 1 a[j + 1] = t; 1 } 0 s/e frequency for (int i = 1; i < n; i++) 1 n-1 { 0 0 // insert a[i] into a[0:i-1] 0 0 int t = a[i]; 1 n-1 int j; 0 0 for (j = i - 1; j >= 0 && t < a[j]; j--) 1 (n-1)n/2 a[j + 1] = a[j]; 1 (n-1)n/2 a[j + 1] = t; 1 n-1 } 0 n-1 Total step counts = (n-1)+0+0+(n-1)+0+(n-1)n/2+(n-1)n/2 + (n-1) + (n-1) = n 2 + 3n 4
16 1.7 OPERATION COUNT One way to estimate the time complexity of a program or method is to select one or more operations, such as add, multiply, and compare, and to determine how many of each is done. The success of this method deps on our ability to identify the operations that contribute most to the time complexity. Pick an instance characteristic n, n = the number of elements in case of insertion sort. Determine count as a function of this instance characteristic. for (int i = 1; i < n; i++) for (j = i - 1; j >= 0 && t < a[j]; j--) a[j + 1] = a[j]; How many comparisons are made? The number of compares deps on a[]s and t as well as on n. Worst case count = maximum count Best case count = minimum count Average count Worst Case Operation Count for (j = i - 1; j >= 0 && t < a[j]; j--) a[j + 1] = a[j]; a = [1,2,3,4] and t = 0 a = [1,2,3,4,,i] and t = 0 4 compares i compares for (int i = 1; i < n; i++) for (j = i - 1; j >= 0 && t < a[j]; j--) a[j + 1] = a[j]; total compares = (n-1) = (n-1)n/2
17 QUESTIONS FOR PRACTICE 1. Draw a flowchart to implement area of triangle. 2. Write an algorithm to count the numbers greater than 25 in a list of numbers. 3. Write an algorithm to find the minimum number in a list of elements. 4. Write an algorithm and draw the flowchart to find the sum of first n numbers. 5. Write an algorithm and draw its flowchart to convert Farenheit temperature to Celsius.
DESIGN AND ANALYSIS OF ALGORITHMS. Unit 1 Chapter 4 ITERATIVE ALGORITHM DESIGN ISSUES
DESIGN AND ANALYSIS OF ALGORITHMS Unit 1 Chapter 4 ITERATIVE ALGORITHM DESIGN ISSUES http://milanvachhani.blogspot.in USE OF LOOPS As we break down algorithm into sub-algorithms, sooner or later we shall
More informationUnit 1 Chapter 4 ITERATIVE ALGORITHM DESIGN ISSUES
DESIGN AND ANALYSIS OF ALGORITHMS Unit 1 Chapter 4 ITERATIVE ALGORITHM DESIGN ISSUES http://milanvachhani.blogspot.in USE OF LOOPS As we break down algorithm into sub-algorithms, sooner or later we shall
More informationUnit 1: Introduction to Algorithms
1 Unit 1: Introduction Unit 1: Introduction to Algorithms Steps involved in Problem Solving Problem solving by the computer involves the following steps 1. Problem definition 2. Analysis 3. Design 4. Coding
More informationChapter 6 INTRODUCTION TO DATA STRUCTURES AND ALGORITHMS
Chapter 6 INTRODUCTION TO DATA STRUCTURES AND ALGORITHMS 1 Reference books: The C Programming Language by Brian W. Kernighan and Dennis M. Ritchie Programming in C (3rd Edition) by Stephen G. Kochan. Data
More informationINTRODUCTION TO ALGORITHMS
UNIT- Introduction: Algorithm: The word algorithm came from the name of a Persian mathematician Abu Jafar Mohammed Ibn Musa Al Khowarizmi (ninth century) An algorithm is simply s set of rules used to perform
More informationProblem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur
Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Lecture - 04 Introduction to Programming Language Concepts
More informationOutline. Program development cycle. Algorithms development and representation. Examples.
Outline Program development cycle. Algorithms development and representation. Examples. 1 Program Development Cycle Program development cycle steps: Problem definition. Problem analysis (understanding).
More informationLECTURE 9 Data Structures: A systematic way of organizing and accessing data. --No single data structure works well for ALL purposes.
LECTURE 9 Data Structures: A systematic way of organizing and accessing data. --No single data structure works well for ALL purposes. Input Algorithm Output An algorithm is a step-by-step procedure for
More informationOutline and Reading. Analysis of Algorithms 1
Outline and Reading Algorithms Running time ( 3.1) Pseudo-code ( 3.2) Counting primitive operations ( 3.4) Asymptotic notation ( 3.4.1) Asymptotic analysis ( 3.4.2) Case study ( 3.4.3) Analysis of Algorithms
More information(Refer Slide Time: 1:27)
Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi Lecture 1 Introduction to Data Structures and Algorithms Welcome to data
More informationC++ Programming Language Lecture 2 Problem Analysis and Solution Representation
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department Program Development Cycle Program development
More informationPROGRAM EFFICIENCY & COMPLEXITY ANALYSIS
Lecture 03-04 PROGRAM EFFICIENCY & COMPLEXITY ANALYSIS By: Dr. Zahoor Jan 1 ALGORITHM DEFINITION A finite set of statements that guarantees an optimal solution in finite interval of time 2 GOOD ALGORITHMS?
More informationComputational thinking, problem-solving and programming:
Computational thinking, problem-solving and programming: Connecting computational thinking and program design IB Computer Science Content developed by Dartford Grammar School Computer Science Department
More informationDATA STRUCTURES AND ALGORITHMS. Asymptotic analysis of the algorithms
DATA STRUCTURES AND ALGORITHMS Asymptotic analysis of the algorithms Summary of the previous lecture Algorithm definition Representation of the algorithms: Flowchart, Pseudocode Description Types of the
More informationConstructing Algorithms and Pseudocoding This document was originally developed by Professor John P. Russo
Constructing Algorithms and Pseudocoding This document was originally developed by Professor John P. Russo Purpose: # Describe the method for constructing algorithms. # Describe an informal language for
More informationLecture 2: Analyzing Algorithms: The 2-d Maxima Problem
Lecture 2: Analyzing Algorithms: The 2-d Maxima Problem (Thursday, Jan 29, 1998) Read: Chapter 1 in CLR. Analyzing Algorithms: In order to design good algorithms, we must first agree the criteria for measuring
More informationWhat Is An Algorithm? Algorithms are the ideas behind computer programs. An algorithm is the thing which stays the same whether
What Is An Algorithm? Algorithms are the ideas behind computer programs An algorithm is the thing which stays the same whether the program is in Pascal running on a Cray innew York or is in BASIC running
More informationAP Computer Science A Syllabus
AP Computer Science A Syllabus Course Overview The focus of this class is structured logic with an emphasis on developing simple, elegant algorithms and thinking in an object-oriented manner. The Java
More informationComputing and compilers
Computing and compilers Comp Sci 1570 to Outline 1 2 3 4 5 Evaluate the difference between hardware and software Find out about the various types of software Get a high level understanding of how program
More informationOutline. Computer Science 331. Three Classical Algorithms. The Sorting Problem. Classical Sorting Algorithms. Mike Jacobson. Description Analysis
Outline Computer Science 331 Classical Sorting Algorithms Mike Jacobson Department of Computer Science University of Calgary Lecture #22 1 Introduction 2 3 4 5 Comparisons Mike Jacobson (University of
More informationPointers (continued), arrays and strings
Pointers (continued), arrays and strings 1 Last week We have seen pointers, e.g. of type char *p with the operators * and & These are tricky to understand, unless you draw pictures 2 Pointer arithmetic
More informationIn examining performance Interested in several things Exact times if computable Bounded times if exact not computable Can be measured
System Performance Analysis Introduction Performance Means many things to many people Important in any design Critical in real time systems 1 ns can mean the difference between system Doing job expected
More informationLecture 26. Introduction to Trees. Trees
Lecture 26 Introduction to Trees Trees Trees are the name given to a versatile group of data structures. They can be used to implement a number of abstract interfaces including the List, but those applications
More informationUNIT-3 PROBLEM SOLVING AND OFFICE AUTOMATION
UNIT-3 PROBLEM SOLVING AND OFFICE AUTOMATION 1. PLANNING THE COMPUTER To solve a problem using computer, three phases are necessary. They are i. Identifying the purpose i. Identifying the purpose ii. Developing
More informationPointers (continued), arrays and strings
Pointers (continued), arrays and strings 1 Last week We have seen pointers, e.g. of type char *p with the operators * and & These are tricky to understand, unless you draw pictures 2 Pointer arithmetic
More informationFundamentals of Programming (Python) Getting Started with Programming
Fundamentals of Programming (Python) Getting Started with Programming Ali Taheri Sharif University of Technology Some slides have been adapted from Python Programming: An Introduction to Computer Science
More informationCS 137 Part 7. Big-Oh Notation, Linear Searching and Basic Sorting Algorithms. November 10th, 2017
CS 137 Part 7 Big-Oh Notation, Linear Searching and Basic Sorting Algorithms November 10th, 2017 Big-Oh Notation Up to this point, we ve been writing code without any consideration for optimization. There
More informationChapter 3: The Efficiency of Algorithms Invitation to Computer Science,
Chapter 3: The Efficiency of Algorithms Invitation to Computer Science, Objectives In this chapter, you will learn about Attributes of algorithms Measuring efficiency Analysis of algorithms When things
More informationAlgorithm. Lecture3: Algorithm Analysis. Empirical Analysis. Algorithm Performance
Algorithm (03F) Lecture3: Algorithm Analysis A step by step procedure to solve a problem Start from an initial state and input Proceed through a finite number of successive states Stop when reaching a
More informationFUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING UNIT III. 2 Marks PROBLEM SOLVING AND OFFICE AUTOMATION
FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING UNIT III 2 Marks PROBLEM SOLVING AND OFFICE AUTOMATION Planning the Computer Program Purpose Algorithm Flow Charts Pseudocode -Application Software Packages-
More informationChapter Two: Program Design Process and Logic
Chapter Two: Program Design Process and Logic 2.1 Chapter objectives Describe the steps involved in the programming process Understand how to use flowchart symbols and pseudocode statements Use a sentinel,
More informationPrinciples of Algorithm Analysis. Biostatistics 615/815
Principles of Algorithm Analysis Biostatistics 615/815 Lecture 3 Snapshot of Incoming Class 25 Programming Languages 20 15 10 5 0 R C/C++ MatLab SAS Java Other Can you describe the QuickSort Algorithm?
More informationCS 6402 DESIGN AND ANALYSIS OF ALGORITHMS QUESTION BANK
CS 6402 DESIGN AND ANALYSIS OF ALGORITHMS QUESTION BANK Page 1 UNIT I INTRODUCTION 2 marks 1. Why is the need of studying algorithms? From a practical standpoint, a standard set of algorithms from different
More informationClassic Data Structures Introduction UNIT I
ALGORITHM SPECIFICATION An algorithm is a finite set of instructions that, if followed, accomplishes a particular task. All algorithms must satisfy the following criteria: Input. An algorithm has zero
More informationScientific Computing. Algorithm Analysis
ECE257 Numerical Methods and Scientific Computing Algorithm Analysis Today s s class: Introduction to algorithm analysis Growth of functions Introduction What is an algorithm? A sequence of computation
More informationComputer Algorithms. Introduction to Algorithm
Computer Algorithms Introduction to Algorithm CISC 4080 Yanjun Li 1 What is Algorithm? An Algorithm is a sequence of well-defined computational steps that transform the input into the output. These steps
More informationData Structures Lecture 8
Fall 2017 Fang Yu Software Security Lab. Dept. Management Information Systems, National Chengchi University Data Structures Lecture 8 Recap What should you have learned? Basic java programming skills Object-oriented
More informationOrganisation. Assessment
Week 1 s s Getting Started 1 3 4 5 - - Lecturer Dr Lectures Tuesday 1-13 Fulton House Lecture room Tuesday 15-16 Fulton House Lecture room Thursday 11-1 Fulton House Lecture room Friday 10-11 Glyndwr C
More informationObject-oriented programming. and data-structures CS/ENGRD 2110 SUMMER 2018
Object-oriented programming 1 and data-structures CS/ENGRD 2110 SUMMER 2018 Lecture 8: Sorting http://courses.cs.cornell.edu/cs2110/2018su Lecture 7 Recap 2 Introduced a formal notation for analysing the
More informationEC121 Mathematical Techniques A Revision Notes
EC Mathematical Techniques A Revision Notes EC Mathematical Techniques A Revision Notes Mathematical Techniques A begins with two weeks of intensive revision of basic arithmetic and algebra, to the level
More informationData Structures and Algorithms. Part 2
1 Data Structures and Algorithms Part 2 Werner Nutt 2 Acknowledgments The course follows the book Introduction to Algorithms, by Cormen, Leiserson, Rivest and Stein, MIT Press [CLRST]. Many examples displayed
More informationLecturers: Sanjam Garg and Prasad Raghavendra March 20, Midterm 2 Solutions
U.C. Berkeley CS70 : Algorithms Midterm 2 Solutions Lecturers: Sanjam Garg and Prasad aghavra March 20, 207 Midterm 2 Solutions. (0 points) True/False Clearly put your answers in the answer box in front
More informationChapter 8 Algorithms 1
Chapter 8 Algorithms 1 Objectives After studying this chapter, the student should be able to: Define an algorithm and relate it to problem solving. Define three construct and describe their use in algorithms.
More informationAlgorithm must complete after a finite number of instructions have been executed. Each step must be clearly defined, having only one interpretation.
Algorithms 1 algorithm: a finite set of instructions that specify a sequence of operations to be carried out in order to solve a specific problem or class of problems An algorithm must possess the following
More informationAlgorithm Analysis. College of Computing & Information Technology King Abdulaziz University. CPCS-204 Data Structures I
Algorithm Analysis College of Computing & Information Technology King Abdulaziz University CPCS-204 Data Structures I Order Analysis Judging the Efficiency/Speed of an Algorithm Thus far, we ve looked
More informationChapter Fourteen Bonus Lessons: Algorithms and Efficiency
: Algorithms and Efficiency The following lessons take a deeper look at Chapter 14 topics regarding algorithms, efficiency, and Big O measurements. They can be completed by AP students after Chapter 14.
More informationEKT 120/4 Computer Programming KOLEJ UNIVERSITI KEJURUTERAAN UTARA MALAYSIA
EKT 120/4 Computer Programming KOLEJ UNIVERSITI KEJURUTERAAN UTARA MALAYSIA AZUWIR MOHD NOR ROOM: Pusat Pengajian CABIN C PHONE: (04) 979 8249 Email: azuwir@kukum.edu.my Office hours: make appoinment or
More informationIntroduction to Computers
Introduction to Computers 1 1 Introduction to Computers 1.1 INTRODUCTION A computer is a device capable of performing computations and making logical decisions at speeds of millions and even billions of
More informationCompuScholar, Inc. Alignment to Nevada "Computer Science" Course Standards
CompuScholar, Inc. Alignment to Nevada "Computer Science" Course Standards Nevada Course Details: Course Name: Computer Science Primary Cluster: Information and Media Technologies Standards Course Code(s):
More informationAnalysis of Algorithms
Analysis of Algorithms Data Structures and Algorithms Acknowledgement: These slides are adapted from slides provided with Data Structures and Algorithms in C++ Goodrich, Tamassia and Mount (Wiley, 2004)
More informationBoca Raton Community High School AP Computer Science A - Syllabus 2009/10
Boca Raton Community High School AP Computer Science A - Syllabus 2009/10 Instructor: Ronald C. Persin Course Resources Java Software Solutions for AP Computer Science, A. J. Lewis, W. Loftus, and C. Cocking,
More informationUNDERSTANDING PROBLEMS AND HOW TO SOLVE THEM BY USING COMPUTERS
UNDERSTANDING PROBLEMS AND HOW TO SOLVE THEM BY USING COMPUTERS INTRODUCTION TO PROBLEM SOLVING Introduction to Problem Solving Understanding problems Data processing Writing an algorithm CONTINUE.. Tool
More informationBLM1011 Bilgisayar Bilimlerine Giriş I
BLM1011 Bilgisayar Bilimlerine Giriş I by Z. Cihan TAYŞİ Outline Fundamental concepts A little history, definition, design & analyzing Complexity Flow charts Elements, connections Algorithms Variable concept,
More informationSorting: Given a list A with n elements possessing a total order, return a list with the same elements in non-decreasing order.
Sorting The sorting problem is defined as follows: Sorting: Given a list A with n elements possessing a total order, return a list with the same elements in non-decreasing order. Remember that total order
More informationCS2 Algorithms and Data Structures Note 1
CS2 Algorithms and Data Structures Note 1 Analysing Algorithms This thread of the course is concerned with the design and analysis of good algorithms and data structures. Intuitively speaking, an algorithm
More informationبسم اهلل الرمحن الرحيم
بسم اهلل الرمحن الرحيم Fundamentals of Programming C Session # 3 By: Saeed Haratian Spring 2016 Outlines Equality and Relational Operators A Simple C Program: Relations Keywords Algorithm Flow Chart Pseudo
More informationCurriculum Map Grade(s): Subject: AP Computer Science
Curriculum Map Grade(s): 11-12 Subject: AP Computer Science (Semester 1 - Weeks 1-18) Unit / Weeks Content Skills Assessments Standards Lesson 1 - Background Chapter 1 of Textbook (Weeks 1-3) - 1.1 History
More informationNational 5 Computing Science Software Design & Development
National 5 Computing Science Software Design & Development 1 Stages of Development 2 Analysis 3 Design 4 Implementation 5 Testing 6 Documentation 7 Evaluation 8 Maintenance 9 Data Types & Structures 10
More informationChapter 3: The Efficiency of Algorithms. Invitation to Computer Science, C++ Version, Third Edition
Chapter 3: The Efficiency of Algorithms Invitation to Computer Science, C++ Version, Third Edition Objectives In this chapter, you will learn about: Attributes of algorithms Measuring efficiency Analysis
More informationFundamentals of Operating Systems (COMP355/L) A Student's Manual for Practice Exercises
Fundamentals of Operating Systems (COMP355/L) A Student's Manual for Practice Exercises Text Book: Operating System Concepts 9 th Edition Silberschatz, Galvin and Gagne 2013 1 Practice Exercises #1 Chapter
More informationFlow Chart. The diagrammatic representation shows a solution to a given problem.
low Charts low Chart A flowchart is a type of diagram that represents an algorithm or process, showing the steps as various symbols, and their order by connecting them with arrows. he diagrammatic representation
More informationCSI32 Object-Oriented Programming
Outline Department of Mathematics and Computer Science Bronx Community College February 2, 2015 Outline Outline 1 Chapter 1 Cornerstones of Computing Textbook Object-Oriented Programming in Python Goldwasser
More informationAlgorithm Discovery and Design. Why are Algorithms Important? Representing Algorithms. Chapter 2 Topics: What language to use?
Algorithm Discovery and Design Chapter 2 Topics: Representing Algorithms Algorithmic Problem Solving CMPUT101 Introduction to Computing (c) Yngvi Bjornsson & Jia You 1 Why are Algorithms Important? If
More informationChapter 3: The Efficiency of Algorithms
Chapter 3: The Efficiency of Algorithms Invitation to Computer Science, Java Version, Third Edition Objectives In this chapter, you will learn about Attributes of algorithms Measuring efficiency Analysis
More informationCOMPUTING Syllabus Version 1.0
ECDL MODULE COMPUTING Syllabus Version 1.0 Purpose This document details the syllabus for the Computing module. The syllabus describes, through learning outcomes, the knowledge and skills that a candidate
More informationLecture Notes for Chapter 2: Getting Started
Instant download and all chapters Instructor's Manual Introduction To Algorithms 2nd Edition Thomas H. Cormen, Clara Lee, Erica Lin https://testbankdata.com/download/instructors-manual-introduction-algorithms-2ndedition-thomas-h-cormen-clara-lee-erica-lin/
More information05-15/17 Discussion Notes
05-15/17 Discussion Notes PIC 10B Spring 2018 1 Recursion as a topic Understand the simple programs discussed in class (sum of integers and palindrome). Understand the Tower of Hanoi example from class.
More informationHacking in C. Pointers. Radboud University, Nijmegen, The Netherlands. Spring 2019
Hacking in C Pointers Radboud University, Nijmegen, The Netherlands Spring 2019 Allocation of multiple variables Consider the program main(){ char x; int i; short s; char y;... } What will the layout of
More informationIB Computer Science Topic.4: Problem-solving and programming. Designed by: Professor. A. Lawson Sources: Online Materials, thanks for all
Topic.4: Problem-solving and programming Designed by: Professor. A. Lawson Sources: Online Materials, thanks for all 1 Topic 4 - Overview Thinking procedurally 4.1.1 Identify the procedure appropriate
More informationJava Software Solutions for AP Computer Science 3rd Edition, Lewis et al. 2011
A Correlation of AP Computer Science 3rd Edition, Lewis et al. 2011 To the INTRODUCTION This document demonstrates how AP (Advanced Placement) Computer Science, 3rd Edition 2011, Lewis et al. meets the
More informationRun Times. Efficiency Issues. Run Times cont d. More on O( ) notation
Comp2711 S1 2006 Correctness Oheads 1 Efficiency Issues Comp2711 S1 2006 Correctness Oheads 2 Run Times An implementation may be correct with respect to the Specification Pre- and Post-condition, but nevertheless
More informationUNIT II Requirements Analysis and Specification & Software Design
UNIT II Requirements Analysis and Specification & Software Design Requirements Analysis and Specification Many projects fail: because they start implementing the system: without determining whether they
More informationUsing only 1, 2 and 3, and the rules of the 3-number challenge, show how we could use addition only or multiplication only to arrive at 6.
The Numbers Game Exercise 1 The 3-number Challenge Write each positive integer as a combination of the digits 1, 2, and 3: each used at most once, combined via the operations of addition and multiplication
More informationPseudo Code and Flow Charts. Chapter 1 Lesson 2
Pseudo Code and Flow Charts Chapter 1 Lesson 2 Pseudocode Using Pseudocode Statements and Flowchart Symbols English-like representation of the logical steps it takes to solve a problem Flowchart Pictorial
More informationCHAPTER 1: INTEGERS. Image from CHAPTER 1 CONTENTS
CHAPTER 1: INTEGERS Image from www.misterteacher.com CHAPTER 1 CONTENTS 1.1 Introduction to Integers 1. Absolute Value 1. Addition of Integers 1.4 Subtraction of Integers 1.5 Multiplication and Division
More informationLecture 2: Getting Started
Lecture 2: Getting Started Insertion Sort Our first algorithm is Insertion Sort Solves the sorting problem Input: A sequence of n numbers a 1, a 2,..., a n. Output: A permutation (reordering) a 1, a 2,...,
More informationAsymptotic Analysis of Algorithms
Asymptotic Analysis of Algorithms EECS2030 B: Advanced Object Oriented Programming Fall 2018 CHEN-WEI WANG Algorithm and Data Structure A data structure is: A systematic way to store and organize data
More informationSorting & Growth of Functions
Sorting & Growth of Functions CSci 588: Data Structures, Algorithms and Software Design Introduction to Algorithms, Cormen et al., Chapter 3 All material not from online sources or text copyright Travis
More informationAlgorithms and Flowcharts
UNIT 2 Chapter 1 Algorithms and Flowcharts After studying this lesson, the students will be able to understand the need of Algorithm and Flowcharts; solve problems by using algorithms and flowcharts; get
More informationData Structures and Algorithms
Asymptotic Analysis Data Structures and Algorithms Algorithm: Outline, the essence of a computational procedure, step-by-step instructions Program: an implementation of an algorithm in some programming
More informationComputer Science Foundation Exam
Computer Science Foundation Exam August 6, 017 Section I A DATA STRUCTURES SOLUTIONS NO books, notes, or calculators may be used, and you must work entirely on your own. Question # Max Pts Category Passing
More informationcsci 210: Data Structures Program Analysis
csci 210: Data Structures Program Analysis Summary Summary analysis of algorithms asymptotic analysis and notation big-o big-omega big-theta commonly used functions discrete math refresher Analysis of
More informationProblem Solving Footer Text 10/30/2015 1
Problem Solving Footer Text 10/30/2015 1 Learning Outcome List five (5) steps in problem solving Identify input, process and output from a given problem. 8.2.2 Define algorithm. Solve a given problem using
More informationChapter 1: Building Blocks of Programming
Chapter 1: Building Blocks of Programming (Completion Time: 4 weeks) Topics: Pseudocode An introductions into express computational ideas in a language that can be translated to code. Used correctly, thinking
More informationDraw a diagram of an empty circular queue and describe it to the reader.
1020_1030_testquestions.text Wed Sep 10 10:40:46 2014 1 1983/84 COSC1020/30 Tests >>> The following was given to students. >>> Students can have a good idea of test questions by examining and trying the
More informationMachine-Independent Optimizations
Chapter 9 Machine-Independent Optimizations High-level language constructs can introduce substantial run-time overhead if we naively translate each construct independently into machine code. This chapter
More informationIntroduction to Algorithms
Introduction to Algorithms An algorithm is any well-defined computational procedure that takes some value or set of values as input, and produces some value or set of values as output. 1 Why study algorithms?
More informationSorting is a problem for which we can prove a non-trivial lower bound.
Sorting The sorting problem is defined as follows: Sorting: Given a list a with n elements possessing a total order, return a list with the same elements in non-decreasing order. Remember that total order
More informationChapter 3. More Flow of Control. Copyright 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Chapter 3 More Flow of Control Overview 3.1 Using Boolean Expressions 3.2 Multiway Branches 3.3 More about C++ Loop Statements 3.4 Designing Loops Slide 3-3 Flow Of Control Flow of control refers to the
More informationENCM 369 Winter 2019 Lab 6 for the Week of February 25
page of ENCM 369 Winter 29 Lab 6 for the Week of February 25 Steve Norman Department of Electrical & Computer Engineering University of Calgary February 29 Lab instructions and other documents for ENCM
More information8 Algorithms 8.1. Foundations of Computer Science Cengage Learning
8 Algorithms 8.1 Foundations of Computer Science Cengage Learning 8.2 Objectives After studying this chapter, the student should be able to: Define an algorithm and relate it to problem solving. Define
More informationFACULTY OF SCIENCE ACADEMY OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING ADVANCED DATA STRUCTURES AND ALGORITHMS EXAM EXAMINATION JUNE 2014
FACULTY OF SCIENCE ACADEMY OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING MODULE CSC3A10 ADVANCED DATA STRUCTURES AND ALGORITHMS CAMPUS APK EXAM EXAMINATION JUNE 2014 DATE 2014-06-03 SESSION 12:30 15:30
More information17/05/2018. Outline. Outline. Divide and Conquer. Control Abstraction for Divide &Conquer. Outline. Module 2: Divide and Conquer
Module 2: Divide and Conquer Divide and Conquer Control Abstraction for Divide &Conquer 1 Recurrence equation for Divide and Conquer: If the size of problem p is n and the sizes of the k sub problems are
More informationComputer System and programming in C
Approaches to Problem Solving Concept of algorithm and flow charts ALGORITHMS AND FLOWCHARTS A typical programming task can be divided into two phases: Problem solving phase produce an ordered sequence
More informationWhy Study Assembly Language?
Why Study Assembly Language? This depends on the decade in which you studied assembly language. 1940 s You cannot study assembly language. It does not exist yet. 1950 s You study assembly language because,
More informationGetting Started with Python
Fundamentals of Programming (Python) Getting Started with Python Sina Sajadmanesh Sharif University of Technology Some slides have been adapted from Python Programming: An Introduction to Computer Science
More informationAlgorithm efficiency can be measured in terms of: Time Space Other resources such as processors, network packets, etc.
Algorithms Analysis Algorithm efficiency can be measured in terms of: Time Space Other resources such as processors, network packets, etc. Algorithms analysis tends to focus on time: Techniques for measuring
More informationHow do we compare algorithms meaningfully? (i.e.) the same algorithm will 1) run at different speeds 2) require different amounts of space
How do we compare algorithms meaningfully? (i.e.) the same algorithm will 1) run at different speeds 2) require different amounts of space when run on different computers! for (i = n-1; i > 0; i--) { maxposition
More informationSTUDENT OUTLINE. Lesson 8: Structured Programming, Control Structures, if-else Statements, Pseudocode
STUDENT OUTLINE Lesson 8: Structured Programming, Control Structures, if- Statements, Pseudocode INTRODUCTION: This lesson is the first of four covering the standard control structures of a high-level
More informationData Structures and Algorithms Key to Homework 1
Data Structures and Algorithms Key to Homework 1 January 31, 2005 15 Define an ADT for a set of integers (remember that a set may not contain duplicates) Your ADT should consist of the functions that can
More information