PROBLEM SOLVING TECHNIQUES SECTION - A. 1. Answer any ten of the following

Size: px
Start display at page:

Download "PROBLEM SOLVING TECHNIQUES SECTION - A. 1. Answer any ten of the following"

Transcription

1 PROBLEM SOLVING TECHNIQUES SECTION - A 1. Answer any ten of the following a. Define an algorithm. An algorithm is a finite set of instructions that if followed, accomplishes a particular task. b. Define a program. A program is a set of instructions to solve a particular problem by the computer language. c. What is a verification condition (VC)? Symbolic executing enables us to transform the verification procedure into proving that the input assertion with symbolic values substituted for all input variables implies the output assertion with final symbolic values substituted for all variables. A proposition phrased in this way is referred to as a Verification Condition (VC). d. What is Fibonacci series? The Fibonacci Sequence is the series of numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34,... The next number is found by adding up the two numbers before it. e. Given a number convert it to octal equivalent f. What is the error condition (fixed error) that might be used to terminate square root algorithm? 1 x 10-6 or g. What are prime numbers? Write first 10 prime numbers. Prime number is a number which is not divisible by any other number other then 1 and itself. First 10 prime numbers are 2,3,5,7,11,13,17,19,23,29. h. Find the GCD of 18 and i. What is longest monotone subsequence? A monotone increasing subsequence is a subset of numbers which are strictly increasing from left to right. This definition does not require that the numbers be adjacent in the original set or that the longest sequence is unique. For example: j. In which applications removing duplicates from an array algorithm is used? Data Compression and text processing problems k. What is sorting? Sorting is any process of arranging items systematically l. What is hashing? Hash searching is used to index and retrieve items in a list using a shorter fixed-length value because it is faster to find the item using the shorter hashed key than to find it using the original value.

2 SECTION - B Answer any four of the following 2. What is a flowchart? Draw and explain various symbols used in flowchart. Flowchart can be defined as a diagrammatic representation of and algorithm. Symbol Used Geometrical Name Oval Uses Parallellogram Input Rectangle Start and Stop Output Processing and 4. Write and explain the expression and parameters used for generating random numbers using Linear Congruential Method. where the parameters a, b, m and x0 must be carefully chosen in advance according to certain criteria. The parameters a, b, and m are referred to as the multiplier, increment, and modulus respectively. All parameters should be integers greater than or equal to zero and m should be greater than x 0,a and b. Parameter x 0 : The parameter x 0 can be chosen arbitrarily within the range 0--x 0 <m. Parameter m: The value of m should e greater than or Arrows Small Circle Rhombus Hexagon Connectors Connector Decision Making Repetition or Looping equal to the length of the random sequence required. In addition it must be possible to do the computation (a*x)+b mod m without roundoff. Further requirements on a are that it should be larger than m and less than m- m, (a-1) should be a multiple of every prime dividing into m, and if m is a multiple of 4 then (a-1) should also be a multiple of 4. These conditions together with the requirements that b should relatively prime to m are needed to guarantee that the sequence has a period of m. Parameter a: The choice of a depends on the choice of m. If m is a power of 2 then a should satisfy the condition: a mod 8 = 5 If m is a power of 10, then a should be chosen such that: a mod 200 = Write the algorithm to exchange the values of two variables. PROBLEM STATEMENT: Given two variables, a and b, exchange the values assigned to them. INPUT: a as integer, b as integer OUTPUT: new value of a must be old value of b, new value of b must be old value of a. ALGORITHM exchange(a,b) t <-- a; a <-- b; b <-- t; Paramter b: The constant b should be odd and not a multiple of 5. When a, b, and m are chosen according to the conditions outlined above a sequence of m pseudorandom numbers in the range 0 to (m-1) can be generated before the sequence begins to repeat. 5. Write the algorithm to compute nth Fibonacci number. ALGORITHM fibonacci(n) //PROBLEM STATEMENT: Algorithm to print the first n fibonacci numbers.

3 //INPUT: n - numbers to be generated of the series. preceding term term a - as number before the b - as number preceding c - new term // OUTPUT: fibonacci series a <-- 0; b <-- 1; i <-- 2; write (a); write (b); while i < n do return; a <-- a + b; b <-- a + b; write (a); write (b); i <-- i + 2; 6. Explain how you rearrange the elements in an array so that they appear in reverse order. The problem of reversing the order of an array of numbers appears to be completely straightforward. We start the design of this algorithm by careful examination of the array before and after it has been reversed; for example, In terms of suffixes the exchanges are : Examining the effects of these exchanges we discover that after step 3 the array is completely reversed. In setting up our algorithm we need a pair of suffixes that model this increasingdecreasing behavior. Our increasing suffix can be the variable i which is incremented by1.for our decreasing suffix we might try n-i since this decreases by 1 with each increase in i by 1.This means that when i=1 we find that n-i is equal to n- 1 rather than n. We can correct this by adding 1. So the suffix n-i-1 can be used at other end rather than using n-i. 7. Write a short note on Two way merge. Merging two or more sets of data is a task that is frequently performed in computing. It is simpler than sorting because it is possible to take advantage of the partial order in the data. Examination of two ordered arrays should help to discover the essential of a suitable merging procedure. Consider the two arrays: A little though reveals that the merged result should be as indicated below: What we observe from our diagram is that the first element ends up in the last position. Carrying this process through we get the following set of exchanges. The origins are written above each element in the c array. What we see here is c is longer than a and b. In fact c must contain a number of elements corresponding to the sum of the elements in a and b (i.e., a+b). To see how this might be done let us consider the smallest merging problem. To merge the two one dimensional array all we need to do is select

4 the smaller of the a and b elements and place it in c.the larger element is then placed in c. 8 is less than 15 so 8 will take c[1] place and 15 c[2] place. In the same way we start merging arrays of lengths m and n.the comparison between a[1] and b[1] SECTION - C Answer any four of the following 8. a. Explain various characteristics of an algorithm. INPUT: An algorithm may accept zero or more quantities. OUTPUT : An algorithm must produce atleast one quantity. DEFINITENESS: Each instruction is clear, precise and well defined. There should not be any ambiguity. FINITENESS: The algorithm must have finite number of instructions. Thus it terminate after a finite number of steps. must EFFECTIVENESS: Every instruction must be basic so that it must be carried out, in principle, by a person using only pencil and paper. allows us to set c[1]. After placing 8 in c[1] we need a way of deciding which element must be placed next in the c array. In the general case the next element to be placed into c is always going to be the smaller of the first elements in the unmanaged parts of arrays a and b. To keep track of the yet to be merged parts of both the a and b arrays two index pointers i and j will be needed. As an element is selected from either a or b the appropriate pointer must be incremented /decremented by 1. a set of more precisely defined subtasks. These subtasks should more accurately describe how the final goal is to be reached. With each splitting of a task into subtasks it is essential that the way in which the subtasks need to interact with each other be precisely defined. Only in this way is it possible to preserve the overall structure of the solution to the problem. Preservation of the overall structure in the solution to a problem is important both for making the algorithm comprehensible and also for making it possible to prove the correctness of the solution. The process of repeatedly breaking a task down into subtasks and then each subtask into still smaller subtasks must continue until we eventually end up with subtasks that can be implemented as program statements. 9. Write the algorithm and description of sine function computation. Algorithm Description b. What is top-down design? Explain how you break a problem in sub problems. A technique for algorithm design that tries to accommodate this human limitation is known as top-down design or stepwise refinement. Topdown design provides us with a way of handling the inherent logical complexity and details, frequently encountered in computer algorithms. Breaking a problem into subproblems Top-down design suggests that we take the general statements that we have about the solution, one at a time, and break them down into Algorithm ALGORITHM sin(x) //PROBLEM STATEMENT : Given a value x generate an algorithm to evaluate the function sin(x) as defined by the series expansion sin(x) = x/1!- x3/3! + x5/5! - x7/7!+... //INPUT : x as real //OUTPUT: to generate sin(x)

5 //error is termination d <- 3; condition while (n mod d = 0) AND (d < r) error <-- 1.0* e-6; i <-- 1; x2 <-- x * x; term <-- x; tsin <-- x; while abs(term) > error do (i* (i-1)); i <-- i + 2; term <-- -term * x2 / do d <- d + 2; if n mod d = 0 then sdivisor <- d; else sdivisor <- 1; tsin <-- tsin + term; return tsin; 10. a. Write the algorithm to find GCD of two numbers. ALGORITHM gcd(n,m) PROBLEM STATEMENT: Given two positive non-zero integers n and m design an algorithm for finding their greatest common divisor (GCD). INPUT: n, m as integers whose gcd is to be sought OUTPUT: gcd of n, m integers //r :integer variable to store the remainder repeat r <--n mod m; n <-- m; m <-- r; until r=0 return m; b. Write the algorithm to find smallest divisor of an integer. ALGORITHM smallestdivisor(n) if NOT odd(n) then sdivisor <- 2; else r <- trun(sqrt(n));

6 11. Write short notes on a. Finding maximum in a set. b. Array Counting or Histogramming. b. Given an element x and a set of data that is in ascending order, write an Binary Search algorithm to find whether or not x is present in the set. //PROBLEM STATEMENT: Algorithm to find an element using binary search method. //INPUT: a: integer array n : integer variable to hold upper limit 12. a. Given a set of numbers below, sort them into non decreasing order using insertion sort element key: integer variable, key //OUTPUT: position of the element found. Algorithm BinarySearch(a,n,key) bottom = 1; do top = n; mid = (bottom + top) / 2; if (item < a[mid]) top = mid - 1; else if (item > a[mid]) bottom = mid + 1; while (item!= a[mid] && bottom <= top); if (item == a[mid]) return mid+1; else return -1;

Unit 1: Introduction to Algorithms

Unit 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 information

Assertions & Verification & Example Loop Invariants Example Exam Questions

Assertions & Verification & Example Loop Invariants Example Exam Questions 2014 November 27 1. Assertions & Verification & Example Loop Invariants Example Exam Questions 2. A B C Give a general template for refining an operation into a sequence and state what questions a designer

More information

Assertions & Verification Example Exam Questions

Assertions & Verification Example Exam Questions 2009 November 23 Assertions & Verification Example Exam Questions 1. 2. A B C Give a general template for refining an operation into a sequence and state what questions a designer must answer to verify

More information

09/28/2015. Problem Rearrange the elements in an array so that they appear in reverse order.

09/28/2015. Problem Rearrange the elements in an array so that they appear in reverse order. Unit 4 The array is a powerful that is widely used in computing. Arrays provide a special way of sorting or organizing data in a computer s memory. The power of the array is largely derived from the fact

More information

Algorithms 4. Odd or even Algorithm 5. Greatest among three numbers Algorithm 6. Simple Calculator Algorithm

Algorithms 4. Odd or even Algorithm 5. Greatest among three numbers Algorithm 6. Simple Calculator Algorithm s 4. Odd or even Step 3 : If number divisible by 2 then Print "Number is Even" Step 3.1 : else Print "Number is Odd" Step 4 : Stop 5. Greatest among three numbers Step 2 : Read values of a, b and c Step

More information

Module 2: Classical Algorithm Design Techniques

Module 2: Classical Algorithm Design Techniques Module 2: Classical Algorithm Design Techniques Dr. Natarajan Meghanathan Associate Professor of Computer Science Jackson State University Jackson, MS 39217 E-mail: natarajan.meghanathan@jsums.edu Module

More information

Loops / Repetition Statements

Loops / Repetition Statements Loops / Repetition Statements Repetition statements allow us to execute a statement multiple times Often they are referred to as loops C has three kinds of repetition statements: the while loop the for

More information

MAT 243 Test 2 SOLUTIONS, FORM A

MAT 243 Test 2 SOLUTIONS, FORM A MAT 243 Test 2 SOLUTIONS, FORM A 1. [15 points] Calculate the following quantities: a. 17 mod 4 Solution: 17 17 4 = 17 4 4 = 1. 4 b. 17 div 4 17 Solution: = 4. 4 c. (( 1) mod 12) mod (27 div 5) Solution:

More information

SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. Numbers & Number Systems

SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. Numbers & Number Systems SCHOOL OF ENGINEERING & BUILT ENVIRONMENT Mathematics Numbers & Number Systems Introduction Numbers and Their Properties Multiples and Factors The Division Algorithm Prime and Composite Numbers Prime Factors

More information

Lab Manual. Program Design and File Structures (P): IT-219

Lab Manual. Program Design and File Structures (P): IT-219 Lab Manual Program Design and File Structures (P): IT-219 Lab Instructions Several practicals / programs? Whether an experiment contains one or several practicals /programs One practical / program Lab

More information

Subject: Computer Science

Subject: Computer Science Subject: Computer Science Topic: Data Types, Variables & Operators 1 Write a program to print HELLO WORLD on screen. 2 Write a program to display output using a single cout statement. 3 Write a program

More information

Prof. Sushant S Sundikar 1

Prof. Sushant S Sundikar 1 UNIT 5 The related activities of sorting, searching and merging are central to many computer applications. Sorting and merging provide us with a means of organizing information take advantage of the organization

More information

Bulgarian Math Olympiads with a Challenge Twist

Bulgarian Math Olympiads with a Challenge Twist Bulgarian Math Olympiads with a Challenge Twist by Zvezdelina Stankova Berkeley Math Circle Beginners Group September 0, 03 Tasks throughout this session. Harder versions of problems from last time appear

More information

Chapter Summary. Mathematical Induction Recursive Definitions Structural Induction Recursive Algorithms

Chapter Summary. Mathematical Induction Recursive Definitions Structural Induction Recursive Algorithms Chapter Summary Mathematical Induction Recursive Definitions Structural Induction Recursive Algorithms Section 5.1 Sec.on Summary Mathematical Induction Examples of Proof by Mathematical Induction Mistaken

More information

COP 4516: Math for Programming Contest Notes

COP 4516: Math for Programming Contest Notes COP 4516: Math for Programming Contest Notes Euclid's Algorithm Euclid's Algorithm is the efficient way to determine the greatest common divisor between two integers. Given two positive integers a and

More information

Gujarat University M. Sc. Computer Science [S. F.] Semester-1 Syllabus Gujarat Arts & Science College, Ahmedabad.

Gujarat University M. Sc. Computer Science [S. F.] Semester-1 Syllabus Gujarat Arts & Science College, Ahmedabad. B. Sc. Computer Science SEM-II EFFECTIVE FROM ACADEMIC YEAR - 2016-2017 CODE Titles Th. Pr. COM-103 ProgramminginC (Theory) 4 COM-104 ProgramminginC(Practical) 4 Teaching Scheme Unit Computer Theory COM

More information

PROGRAMMING IN C AND C++:

PROGRAMMING IN C AND C++: PROGRAMMING IN C AND C++: Week 1 1. Introductions 2. Using Dos commands, make a directory: C:\users\YearOfJoining\Sectionx\USERNAME\CS101 3. Getting started with Visual C++. 4. Write a program to print

More information

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION Copyright Cengage Learning. All rights reserved. SECTION 5.5 Application: Correctness of Algorithms Copyright Cengage Learning. All rights reserved.

More information

Number System. Introduction. Natural Numbers (N) Whole Numbers (W) Integers (Z) Prime Numbers (P) Face Value. Place Value

Number System. Introduction. Natural Numbers (N) Whole Numbers (W) Integers (Z) Prime Numbers (P) Face Value. Place Value 1 Number System Introduction In this chapter, we will study about the number system and number line. We will also learn about the four fundamental operations on whole numbers and their properties. Natural

More information

Number Theory Open, Round 1 Test #101

Number Theory Open, Round 1 Test #101 Number Theory Open, Round 1 Test #101 1. Write your 6-digit ID# in the I.D. NUMBER grid, left-justified, and bubble. Check that each column has only one number darkened. 2. In the EXAM NO. grid, write

More information

Question Bank Subject: Advanced Data Structures Class: SE Computer

Question Bank Subject: Advanced Data Structures Class: SE Computer Question Bank Subject: Advanced Data Structures Class: SE Computer Question1: Write a non recursive pseudo code for post order traversal of binary tree Answer: Pseudo Code: 1. Push root into Stack_One.

More information

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) WINTER 18 EXAMINATION Subject Name: Data Structure Model wer Subject Code: 17330 Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in

More information

Interactive Math Glossary Terms and Definitions

Interactive Math Glossary Terms and Definitions Terms and Definitions Absolute Value the magnitude of a number, or the distance from 0 on a real number line Addend any number or quantity being added addend + addend = sum Additive Property of Area the

More information

WHOLE NUMBER AND DECIMAL OPERATIONS

WHOLE NUMBER AND DECIMAL OPERATIONS WHOLE NUMBER AND DECIMAL OPERATIONS Whole Number Place Value : 5,854,902 = Ten thousands thousands millions Hundred thousands Ten thousands Adding & Subtracting Decimals : Line up the decimals vertically.

More information

COE428 Lecture Notes Week 1 (Week of January 9, 2017)

COE428 Lecture Notes Week 1 (Week of January 9, 2017) COE428 Lecture Notes: Week 1 1 of 10 COE428 Lecture Notes Week 1 (Week of January 9, 2017) Table of Contents COE428 Lecture Notes Week 1 (Week of January 9, 2017)...1 Announcements...1 Topics...1 Informal

More information

Lesson #3. Variables, Operators, and Expressions. 3. Variables, Operators and Expressions - Copyright Denis Hamelin - Ryerson University

Lesson #3. Variables, Operators, and Expressions. 3. Variables, Operators and Expressions - Copyright Denis Hamelin - Ryerson University Lesson #3 Variables, Operators, and Expressions Variables We already know the three main types of variables in C: int, char, and double. There is also the float type which is similar to double with only

More information

Foundation. Scheme of Work. Year 9. September 2016 to July 2017

Foundation. Scheme of Work. Year 9. September 2016 to July 2017 Foundation Scheme of Work Year 9 September 06 to July 07 Assessments Students will be assessed by completing two tests (topic) each Half Term. These are to be recorded on Go Schools. There will not be

More information

COMPUTER SCIENCE TRIPOS

COMPUTER SCIENCE TRIPOS CST.2000.1.1 COMPUTER SCIENCE TRIPOS Part IA Monday 5 June 2000 1.30 to 4.30 Paper 1 Answer two questions from Section A, and one question from each of Sections B, C, D and E. Submit the answers in six

More information

1. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which:

1. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which: P R O B L E M S Finite Autom ata. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which: a) Are a multiple of three in length. b) End with the string

More information

Computers Programming Course 6. Iulian Năstac

Computers Programming Course 6. Iulian Năstac Computers Programming Course 6 Iulian Năstac Recap from previous course Data types four basic arithmetic type specifiers: char int float double void optional specifiers: signed, unsigned short long 2 Recap

More information

Questions Bank. 14) State any four advantages of using flow-chart

Questions Bank. 14) State any four advantages of using flow-chart Questions Bank Sub:PIC(22228) Course Code:-EJ-2I ----------------------------------------------------------------------------------------------- Chapter:-1 (Overview of C Programming)(10 Marks) 1) State

More information

3 The L oop Control Structure

3 The L oop Control Structure 3 The L oop Control Structure Loops The while Loop Tips and Traps More Operators The for Loop Nesting of Loops Multiple Initialisations in the for Loop The Odd Loop The break Statement The continue Statement

More information

Two Approaches to Algorithms An Example (1) Iteration (2) Recursion

Two Approaches to Algorithms An Example (1) Iteration (2) Recursion 2. Recursion Algorithm Two Approaches to Algorithms (1) Iteration It exploits while-loop, for-loop, repeat-until etc. Classical, conventional, and general approach (2) Recursion Self-function call It exploits

More information

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF CHAPTER 4 ELEMENTARY NUMBER THEORY AND METHODS OF PROOF Copyright Cengage Learning. All rights reserved. SECTION 4.3 Direct Proof and Counterexample III: Divisibility Copyright Cengage Learning. All rights

More information

Unit-II Programming and Problem Solving (BE1/4 CSE-2)

Unit-II Programming and Problem Solving (BE1/4 CSE-2) Unit-II Programming and Problem Solving (BE1/4 CSE-2) Problem Solving: Algorithm: It is a part of the plan for the computer program. An algorithm is an effective procedure for solving a problem in a finite

More information

UCT Algorithm Circle: Number Theory

UCT Algorithm Circle: Number Theory UCT Algorithm Circle: 7 April 2011 Outline Primes and Prime Factorisation 1 Primes and Prime Factorisation 2 3 4 Some revision (hopefully) What is a prime number? An integer greater than 1 whose only factors

More information

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF CHAPTER 4 ELEMENTARY NUMBER THEORY AND METHODS OF PROOF Copyright Cengage Learning. All rights reserved. SECTION 4.3 Direct Proof and Counterexample III: Divisibility Copyright Cengage Learning. All rights

More information

Computer Science 4U Unit 1. Programming Concepts and Skills Algorithms

Computer Science 4U Unit 1. Programming Concepts and Skills Algorithms Computer Science 4U Unit 1 Programming Concepts and Skills Algorithms Algorithm In mathematics and computer science, an algorithm is a step-by-step procedure for calculations. Algorithms are used for calculation,

More information

GO - OPERATORS. This tutorial will explain the arithmetic, relational, logical, bitwise, assignment and other operators one by one.

GO - OPERATORS. This tutorial will explain the arithmetic, relational, logical, bitwise, assignment and other operators one by one. http://www.tutorialspoint.com/go/go_operators.htm GO - OPERATORS Copyright tutorialspoint.com An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations.

More information

UNIT 5. Sorting and Hashing

UNIT 5. Sorting and Hashing UNIT 5 Sorting and Hashing SORTING METHODS SYLLABUS: 5.1.Sorting Methods a. Bubble Sort, b. Selection Sort, c. Quick Sort, d. Insertion Sort, e. Merge Sort, f. Radix Sort 5.2.Hashing Concepts CONTINUE

More information

YEAR 8 SCHEME OF WORK

YEAR 8 SCHEME OF WORK YEAR 8 SCHEME OF WORK Year 8 Term 1 Chapter: Week Topic 1 2 2.1:1: Working with 2.2:1: Working with 3 4 2.1:2: Geometry 2.2:2: Geometry 5 6 2.1:3: Probability 2.2:3: Probability Topic break-down (sub-topics)

More information

CSci 1113, Fall 2015 Lab Exercise 4 (Week 5): Write Your Own Functions. User Defined Functions

CSci 1113, Fall 2015 Lab Exercise 4 (Week 5): Write Your Own Functions. User Defined Functions CSci 1113, Fall 2015 Lab Exercise 4 (Week 5): Write Your Own Functions User Defined Functions In previous labs, you've encountered useful functions, such as sqrt() and pow(), that were created by other

More information

Answers. 1. (A) Attempt any five : 20 Marks

Answers. 1. (A) Attempt any five : 20 Marks Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The model answer and the answer written by candidate

More information

Constructing 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 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 information

FLOWCHARTS A flowchart is a graphical representation of the steps to be followed for solving problem. It consists of a set of symbols.

FLOWCHARTS A flowchart is a graphical representation of the steps to be followed for solving problem. It consists of a set of symbols. FLOWCHARTS A flowchart is a graphical representation of the steps to be followed for solving problem. It consists of a set of symbols. Each symbol represents a specific activity. A typical problem involves

More information

Assignment: 1. (Unit-1 Flowchart and Algorithm)

Assignment: 1. (Unit-1 Flowchart and Algorithm) Assignment: 1 (Unit-1 Flowchart and Algorithm) 1. Explain: Flowchart with its symbols. 2. Explain: Types of flowchart with example. 3. Explain: Algorithm with example. 4. Draw a flowchart to find the area

More information

CS1800 Discrete Structures Fall 2017 October 25, CS1800 Discrete Structures Midterm Version B

CS1800 Discrete Structures Fall 2017 October 25, CS1800 Discrete Structures Midterm Version B CS1800 Discrete Structures Fall 2017 October 25, 2017 Instructions: CS1800 Discrete Structures Midterm Version B 1. The exam is closed book and closed notes. You may not use a calculator or any other electronic

More information

LOOPS. 1- Write a program that prompts user to enter an integer N and determines and prints the sum of cubes from 5 to N (i.e. sum of 5 3 to N 3 ).

LOOPS. 1- Write a program that prompts user to enter an integer N and determines and prints the sum of cubes from 5 to N (i.e. sum of 5 3 to N 3 ). LOOPS 1- Write a program that prompts user to enter an integer N and determines and prints the sum of cubes from 5 to N (i.e. sum of 5 3 to N 3 ). 2-Give the result of the following program: #include

More information

CS1800 Discrete Structures Fall 2017 October 25, CS1800 Discrete Structures Midterm Version B

CS1800 Discrete Structures Fall 2017 October 25, CS1800 Discrete Structures Midterm Version B CS1800 Discrete Structures Fall 2017 October 25, 2017 Instructions: CS1800 Discrete Structures Midterm Version B 1. The exam is closed book and closed notes. You may not use a calculator or any other electronic

More information

Alphanumeric Divisibility

Alphanumeric Divisibility Alphanumeric Divisibility Robert Israel, University of British Columbia, israel@math.ubc.ca Stan Wagon, Macalester College, wagon@macalester.edu [Corresponding author] Take a word using at most 10 letters,

More information

INSTITUTE OF AERONAUTICAL ENGINEERING

INSTITUTE OF AERONAUTICAL ENGINEERING INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad - 500 043 COMPUTER SCIENCE AND ENGINEERING TUTORIAL QUESTION BANK Course Name Course Code Class Branch DATA STRUCTURES ACS002 B. Tech

More information

Hegarty Maths Clip Numbers List

Hegarty Maths Clip Numbers List Hegarty Maths Clip Numbers List Strand Topic Skill Number Arithmetic with positive integers Simple addition & its meaning 1 Number Arithmetic with positive integers Simple subtraction & its meaning 2 Number

More information

VARIABLE, OPERATOR AND EXPRESSION [SET 1]

VARIABLE, OPERATOR AND EXPRESSION [SET 1] VARIABLE, OPERATOR AND EXPRESSION Question 1 Write a program to print HELLO WORLD on screen. Write a program to display the following output using a single cout statement. Subject Marks Mathematics 90

More information

! Addition! Multiplication! Bigger Example - RSA cryptography

! Addition! Multiplication! Bigger Example - RSA cryptography ! Addition! Multiplication! Bigger Example - RSA cryptography Modular Arithmetic Modular Exponentiation Primality Testing (Fermat s little theorem) Probabilistic algorithm Euclid s Algorithm for gcd (greatest

More information

KS3 - Year 8 & 9 Course Outline: Mathematics

KS3 - Year 8 & 9 Course Outline: Mathematics KS3 - Year 8 & 9 Course Outline: Mathematics EFG D C B visualise and use 2D representations of 3D objects 39 81-82 G1 N1 N2 enlarge 2D shapes, given a centre of enlargement and a positive whole number

More information

Birkdale High School - Higher Scheme of Work

Birkdale High School - Higher Scheme of Work Birkdale High School - Higher Scheme of Work Module 1 - Integers and Decimals Understand and order integers (assumed) Use brackets and hierarchy of operations (BODMAS) Add, subtract, multiply and divide

More information

UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA C ASSIGNMENTS

UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA C ASSIGNMENTS UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA C ASSIGNMENTS All programs need to be submitted on 7th Oct 206 by writing in hand written format in A4 sheet. Flowcharts, algorithms, source codes and outputs

More information

VALLIAMMAI ENGINEERING COLLEGE

VALLIAMMAI ENGINEERING COLLEGE VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur 60 20 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK B.E I SEMESTER GE85- Problem Solving and Python Programming Regulation 207 Academic

More information

Data Structure and Algorithm Midterm Reference Solution TA

Data Structure and Algorithm Midterm Reference Solution TA Data Structure and Algorithm Midterm Reference Solution TA email: dsa1@csie.ntu.edu.tw Problem 1. To prove log 2 n! = Θ(n log n), it suffices to show N N, c 1, c 2 > 0 such that c 1 n ln n ln n! c 2 n

More information

Lab 1: Cipher Fundamentals

Lab 1: Cipher Fundamentals Lab 1: Cipher Fundamentals Objective: The key objective of this lab is to be introduced to some of the fundamental principles involved in cryptography, including the usage of Base-64, hexadecimal, the

More information

COMP3121/3821/9101/ s1 Assignment 1

COMP3121/3821/9101/ s1 Assignment 1 Sample solutions to assignment 1 1. (a) Describe an O(n log n) algorithm (in the sense of the worst case performance) that, given an array S of n integers and another integer x, determines whether or not

More information

SECTION 5.1. Sequences

SECTION 5.1. Sequences SECTION 5.1 Sequences Sequences Problem: count number of ancestors one has 2 parents, 4 grandparents, 8 greatgrandparents,, written in a row as 2, 4, 8, 16, 32, 64, 128, To look for pattern of the numbers,

More information

Math 302 Introduction to Proofs via Number Theory. Robert Jewett (with small modifications by B. Ćurgus)

Math 302 Introduction to Proofs via Number Theory. Robert Jewett (with small modifications by B. Ćurgus) Math 30 Introduction to Proofs via Number Theory Robert Jewett (with small modifications by B. Ćurgus) March 30, 009 Contents 1 The Integers 3 1.1 Axioms of Z...................................... 3 1.

More information

Problem Solving (Computing) Array and Pointer

Problem Solving (Computing) Array and Pointer CS101 Introduction to computing Problem Solving (Computing) & Array and Pointer A. Sahu and S. V.Rao Dept of Comp. Sc. & Engg. Indian Institute of Technology Guwahati 1 Outline Loop invariant and loop

More information

Lab 1: Cipher Fundamentals

Lab 1: Cipher Fundamentals Lab 1: Cipher Fundamentals Objective: The key objective of this lab is to be introduced to some of the fundamental principles involved in cryptography, including the usage of Base-64, hexadecimal, the

More information

Component 02. Algorithms and programming. Sorting Algorithms and Searching Algorithms. Matthew Robinson

Component 02. Algorithms and programming. Sorting Algorithms and Searching Algorithms. Matthew Robinson Component 02 Algorithms and programming Sorting Algorithms and Searching Algorithms 1 BUBBLE SORT Bubble sort is a brute force and iterative sorting algorithm where each adjacent item in the array is compared.

More information

If a b or a c, then a bc If a b and b c, then a c Every positive integer n > 1 can be written uniquely as n = p 1 k1 p 2 k2 p 3 k3 p 4 k4 p s

If a b or a c, then a bc If a b and b c, then a c Every positive integer n > 1 can be written uniquely as n = p 1 k1 p 2 k2 p 3 k3 p 4 k4 p s Points missed: Student's Name: Total score: /100 points East Tennessee State University Department of Computer and Information Sciences CSCI 1900 (Tarnoff) Math for Computer Science TEST 1 for Summer Term,

More information

AXIOMS FOR THE INTEGERS

AXIOMS FOR THE INTEGERS AXIOMS FOR THE INTEGERS BRIAN OSSERMAN We describe the set of axioms for the integers which we will use in the class. The axioms are almost the same as what is presented in Appendix A of the textbook,

More information

PROGRAM DESIGN TOOLS. Algorithms, Flow Charts, Pseudo codes and Decision Tables. Designed by Parul Khurana, LIECA.

PROGRAM DESIGN TOOLS. Algorithms, Flow Charts, Pseudo codes and Decision Tables. Designed by Parul Khurana, LIECA. PROGRAM DESIGN TOOLS Algorithms, Flow Charts, Pseudo codes and Decision Tables Introduction The various tools collectively referred to as program design tools, that helps in planning the program are:-

More information

Structured Program Development in C

Structured Program Development in C 1 3 Structured Program Development in C 3.2 Algorithms 2 Computing problems All can be solved by executing a series of actions in a specific order Algorithm: procedure in terms of Actions to be executed

More information

Hash Functions. Kuan-Yu Chen ( 陳冠宇 ) TR-212, NTUST

Hash Functions. Kuan-Yu Chen ( 陳冠宇 ) TR-212, NTUST Hash Functions Kuan-Yu Chen ( 陳冠宇 ) 2018/12/12 @ TR-212, NTUST Review A binary heap is a complete binary tree in which every node satisfies the heap property Min Heap Max Heap A binomial heap HH is a set

More information

CS 6402 DESIGN AND ANALYSIS OF ALGORITHMS QUESTION BANK

CS 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 information

Mathematics Background

Mathematics Background Finding Area and Distance Students work in this Unit develops a fundamentally important relationship connecting geometry and algebra: the Pythagorean Theorem. The presentation of ideas in the Unit reflects

More information

COMPUTER ARITHMETIC (Part 1)

COMPUTER ARITHMETIC (Part 1) Eastern Mediterranean University School of Computing and Technology ITEC255 Computer Organization & Architecture COMPUTER ARITHMETIC (Part 1) Introduction The two principal concerns for computer arithmetic

More information

q To develop recursive methods for recursive mathematical functions ( ).

q To develop recursive methods for recursive mathematical functions ( ). Chapter 8 Recursion CS: Java Programming Colorado State University Motivations Suppose you want to find all the files under a directory that contains a particular word. How do you solve this problem? There

More information

( ) n 3. n 2 ( ) D. Ο

( ) n 3. n 2 ( ) D. Ο CSE 0 Name Test Summer 0 Last Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. The time to multiply two n n matrices is: A. Θ( n) B. Θ( max( m,n, p) ) C.

More information

q To develop recursive methods for recursive mathematical functions ( ).

q To develop recursive methods for recursive mathematical functions ( ). /2/8 Chapter 8 Recursion CS: Java Programming Colorado State University Motivations Suppose you want to find all the files under a directory that contains a particular word. How do you solve this problem?

More information

TABLES AND HASHING. Chapter 13

TABLES AND HASHING. Chapter 13 Data Structures Dr Ahmed Rafat Abas Computer Science Dept, Faculty of Computer and Information, Zagazig University arabas@zu.edu.eg http://www.arsaliem.faculty.zu.edu.eg/ TABLES AND HASHING Chapter 13

More information

Number Algebra Geometry and Measure Statistics. Aspect 1 Aspect 2 Aspect 3 Aspect 4 Work out the upper. Calculate area of and lower bounds of

Number Algebra Geometry and Measure Statistics. Aspect 1 Aspect 2 Aspect 3 Aspect 4 Work out the upper. Calculate area of and lower bounds of Year 7 Year 8 Excellence: 85%+ proficiency from all good objectives. For aspect 1 and aspect 3, there should be some proficiency towards these objectives to achieve excellence. Good: 70%+ proficiency in

More information

CS 199 Computer Programming. Spring 2018 Lecture 2 Problem Solving

CS 199 Computer Programming. Spring 2018 Lecture 2 Problem Solving CS 199 Computer Programming Spring 2018 Lecture 2 Problem Solving ALGORITHMS AND FLOWCHARTS A typical programming task can be divided into two phases: Problem solving phase produce an ordered sequence

More information

Invariants and Algorithms

Invariants and Algorithms 1 Introduction Invariants and Algorithms November 9, 2015 Cody Johnson ctj@math.cmu.edu An invariant is something that doesn t change after some process. A monovariant is something that changes in one

More information

A Survey of Mathematics with Applications 8 th Edition, 2009

A Survey of Mathematics with Applications 8 th Edition, 2009 A Correlation of A Survey of Mathematics with Applications 8 th Edition, 2009 South Carolina Discrete Mathematics Sample Course Outline including Alternate Topics and Related Objectives INTRODUCTION This

More information

CS 2412 Data Structures. Chapter 10 Sorting and Searching

CS 2412 Data Structures. Chapter 10 Sorting and Searching CS 2412 Data Structures Chapter 10 Sorting and Searching Some concepts Sorting is one of the most common data-processing applications. Sorting algorithms are classed as either internal or external. Sorting

More information

Montana City School GRADE 5

Montana City School GRADE 5 Montana City School GRADE 5 Montana Standard 1: Students engage in the mathematical processes of problem solving and reasoning, estimation, communication, connections and applications, and using appropriate

More information

Engineering program development. Edited by Péter Vass

Engineering program development. Edited by Péter Vass Engineering program development Edited by Péter Vass Introduction Question: Why engineering program development may be useful for a PhD student in Earth Sciences? Counter-argument: In these days a wide

More information

PURPLE COMET MATH MEET April 2011 HIGH SCHOOL - PROBLEMS. The ratio of 3 to the positive number n is the same as the ratio of n to 192. Find n.

PURPLE COMET MATH MEET April 2011 HIGH SCHOOL - PROBLEMS. The ratio of 3 to the positive number n is the same as the ratio of n to 192. Find n. PURPLE COMET MATH MEET April 2011 HIGH SCHOOL - PROBLEMS Copyright Titu Andreescu and Jonathan Kane Problem 1 The ratio of 3 to the positive number n is the same as the ratio of n to 192. Find n. Problem

More information

11.3 Function Prototypes

11.3 Function Prototypes 11.3 Function Prototypes A Function Prototype contains the function s return type, name and parameter list Writing the function prototype is declaring the function. float square (float x); In a function

More information

UNDERSTANDING PROBLEMS AND HOW TO SOLVE THEM BY USING COMPUTERS

UNDERSTANDING 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 information

Midterm Exam 2B Answer key

Midterm Exam 2B Answer key Midterm Exam 2B Answer key 15110 Principles of Computing Fall 2015 April 6, 2015 Name: Andrew ID: Lab section: Instructions Answer each question neatly in the space provided. There are 6 questions totaling

More information

CS Data Structures and Algorithm Analysis

CS Data Structures and Algorithm Analysis CS 483 - Data Structures and Algorithm Analysis Lecture VI: Chapter 5, part 2; Chapter 6, part 1 R. Paul Wiegand George Mason University, Department of Computer Science March 8, 2006 Outline 1 Topological

More information

Chapter 3 Structured Program Development

Chapter 3 Structured Program Development 1 Chapter 3 Structured Program Development Copyright 2007 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 3 - Structured Program Development Outline 3.1 Introduction

More information

Most nonzero floating-point numbers are normalized. This means they can be expressed as. x = ±(1 + f) 2 e. 0 f < 1

Most nonzero floating-point numbers are normalized. This means they can be expressed as. x = ±(1 + f) 2 e. 0 f < 1 Floating-Point Arithmetic Numerical Analysis uses floating-point arithmetic, but it is just one tool in numerical computation. There is an impression that floating point arithmetic is unpredictable and

More information

Recursive Functions. Biostatistics 615 Lecture 5

Recursive Functions. Biostatistics 615 Lecture 5 Recursive Functions Biostatistics 615 Lecture 5 Notes on Problem Set 1 Results were very positive! (But homework was time-consuming!) Familiar with Union Find algorithms Language of choice 50% tried C

More information

Algorithm classification

Algorithm classification Types of Algorithms Algorithm classification Algorithms that use a similar problem-solving approach can be grouped together We ll talk about a classification scheme for algorithms This classification scheme

More information

C- PROGRAMMING (3:0:0) Sub code : CS1C01/CS2C01 CIE : 50%Marks Hrs/week : 03 SEE : 50%Marks SEE Hrs : 03 Hours Max. Marks: 100 Course Outcomes:

C- PROGRAMMING (3:0:0) Sub code : CS1C01/CS2C01 CIE : 50%Marks Hrs/week : 03 SEE : 50%Marks SEE Hrs : 03 Hours Max. Marks: 100 Course Outcomes: C- PROGRAMMING (3:0:0) Sub code : CS1C01/CS2C01 CIE : 50%Marks Hrs/week : 03 SEE : 50%Marks SEE Hrs : 03 Hours Max. Marks: 100 Course Outcomes: On successful completion of the course, the students will

More information

Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest. Introduction to Algorithms

Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest. Introduction to Algorithms Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest Introduction to Algorithms Preface xiii 1 Introduction 1 1.1 Algorithms 1 1.2 Analyzing algorithms 6 1.3 Designing algorithms 1 1 1.4 Summary 1 6

More information

CMSC 341 Lecture 16/17 Hashing, Parts 1 & 2

CMSC 341 Lecture 16/17 Hashing, Parts 1 & 2 CMSC 341 Lecture 16/17 Hashing, Parts 1 & 2 Prof. John Park Based on slides from previous iterations of this course Today s Topics Overview Uses and motivations of hash tables Major concerns with hash

More information

ANNA UNIVERSITY: CHENNAI B.E./B.Tech. DEGREE EXAMINATIONS, JAN Regulations First Semester (Common to All Branches )

ANNA UNIVERSITY: CHENNAI B.E./B.Tech. DEGREE EXAMINATIONS, JAN Regulations First Semester (Common to All Branches ) ANNA UNIVERSITY: CHENNAI 600 025 B.E./B.Tech. DEGREE EXAMINATIONS, JAN - 2012 Regulations - 2008 First Semester (Common to All Branches ) GE 2115 - COMPUTER PRACTICE LABORATORY I Note: Mark distribution

More information

The Ultimate Maths Vocabulary List

The Ultimate Maths Vocabulary List The Ultimate Maths Vocabulary List The 96 Words Every Pupil Needs to Know by the End of Year 6 KS1 & KS2 How to Use This Resource An essential building block in pupil s understanding of maths is their

More information

PITSCO Math Individualized Prescriptive Lessons (IPLs)

PITSCO Math Individualized Prescriptive Lessons (IPLs) Orientation Integers 10-10 Orientation I 20-10 Speaking Math Define common math vocabulary. Explore the four basic operations and their solutions. Form equations and expressions. 20-20 Place Value Define

More information