AN EXAMPLE FOR THE USE OF BITWISE OPERATIONS IN PROGRAMMING
|
|
- Ethelbert Reed
- 6 years ago
- Views:
Transcription
1 AN EXAMPLE FOR THE USE OF BITWISE OPERATIONS IN PROGRAMMING Krasimir Yakov Yordzhev This piece of work presets a meaigful example for the advatages of usig bitwise operatios for creatig effective algorithms i programmig. A task coected with mathematical modelig i weavig idustry is examied ad computed MSC: 68N15, 68R05, 05A18 Key words: C/C++ programmig laguage, bitwise operatio, biary matrix, equivalece relatio, factor set, weaver structure, biary system, lexicographic order 1. Itroductio. The use of bitwise operatios is a powerful method used i C/C++ programmig laguages. Ufortuately i widespread books o this topic there is icomplete or o descriptio for the work of the bitwise operatios [2,4,5,9,11]. The aim of this article is to correct this lapse to a certai extet ad preset a meaigful example of a programmig task, where the use of bitwise operatios is appropriate i order to facilitate the work ad to icrease the effectiveess of the respective algorithm. O the other had the algorithm specified here could have a good practical applicatio for computig a kow combiatorial task coected with the classificatio of the various textile structures. 2. Task formulatio. Let us deote by B the set of all biary matrices, i.е. matrices composed by rows ad colums, all elemets of which are either 0 or 1. It s a well-kow fact that the umber of 2 all matrices of B is equal to 2. Let A, B B. We will say, that A ad B are equivalet ad we will write A ~ B, if B is obtaied from A as a result of sequetial cyclic move of the last row or colum at a first place. It s easy to see that the so described relatio is a equivalece relatio. So this way we come to a formulatio of the followig programmig task: Task 1. Write a program that with assiged positive iteger returs oe represetative of each equivalece class i B cocerig the above metioed equivalece relatio. As a result from the solutio of task 1 we will also compute a combiatorial task to fid the umber of all equivalece classes i B regardig the equivalece relatio ~, i.e. for fidig the cardial umber of the factor set B / ~. This task is applicable i waverig idustry. With the help of the elemets of B the various threads iterweavig of a certai weaver structure could be coded, ad with this codig by usig two equivalet matrices the weavig of oe ad the same fabric is coded, because of cyclic recurrece of the repetitio of iterweavig [6,8]. From a practical poit of view just matrices with at least oe 0 ad at least oe 1 i each row ad each colum have meaig. Let s mark with Q the set of all matrices of that kid, Q B. The ext task which we are goig to compute is a bit more difficult versio of task 1.
2 Task 2. Write a program that with assiged positive iteger returs oe represetative of each equivalece class i Q cocerig the above metioed equivalece relatio. 3. Bitwise operatios i C/C++. Bitwise operatios ca be applied for iteger data type oly, i.e. they caot be used for float ad double types. For the defiitio of the bitwise operatios i C/C++ ad some of their elemetary applicatios could be see, for example, i [1,3,7,10]. We assume as usually that bits umberig i variables starts from right to left, ad that the umber of the very right oe is 0. Let x, y ad z are iteger variables of oe type, for which w bits are eeded. Let x ad y are iitialized ad let the z x y assigmet is made, where is oe of the operators & (bitwise AND), (bitwise iclusive OR) or ^ (bitwise exclusive OR). For each i 0,1,, w 1 the ew cotets of the i bit i z will be as it is preseted i the followig table: The i bit of x The i bit of y The i bit of x & y The i bit of x y Thei bit of x^ y z ~ x I case that, if the i bit of x is 0, the the i bit of z becomes 1, ad if the i bit of x is 1, the the i bit of z becomes 0, i 0,1,, w 1. I case that k is a oegative iteger, the the statemet z x k; (bitwise shift left) will write i the ( i k) bit of z the value of the k bit of x, wherei 0,1,, w k 1, ad the very right k bits of z will be filled by zeroes. This operatio is equivalet to a multiplicatio of k x by 2. The statemet z x k works the similar way (bitwise shift right). But we must be careful here, as i various programmig eviromets (see for example i [7]) this operatio has differet iterpretatios somewhere k bits of z from the very left place are compulsory filled by 0 (logical displacemet), ad elsewhere the very left k bits of z are filled with the value from the very left (sig) bit; i.e. if the umber is egative, the the fillig will be with 1 (arithmetic displacemet). Therefore it s recommeded to use usiged type of variables (if the opposite is ot ecessary) while workig with bitwise operatios. Directly form the defiitio of the operatio bitwise shift left follows k the effectiveess of the followig fuctio computig 2, where k is a oegative iteger: usiged it Power2(usiged it k) { retur 1<<k; To compute the value of the i bit of a iteger variable x we ca use the fuctio:
3 it BitValue(it x, usiged it i) { if ( (x & (1<<i) ) == 0 ) retur 0; else retur 1; Bitwise operatios are left associative. The priority of operatios i descedig order is as follows: bitwise complemet ~; arithmetic operatios * (multiply), / (divide), % (remaider or modulus); arithmetic operatios + (biary plus or add) - (biary mius or subtract); the bitwise operatios << ad >>; relatioal operatios <, >, <=, >=, ==,!=; bitwise operatios &,^ ad ; logical operatios && ad. 4. Algorithm realizatio. Each biary matrix A ca be coded with the help of vector (array) of oegative itegers v ( v0, v1,, v 1), where 0 v i 2 1 for each i : 0 i 1. Oe-to-oe correspodece is realized through biary presetatio of atural umbers, i.e. the i row of the matrix A is v i i biary system. The row i of A will be completely il if ad oly if v i 0 ; ad all elemets of the i row of A will be equal to 1 if ad oly if v 2 i 1. I other words, it s a ecessary ad sufficiet coditio for each i 0,1,, 1 to be realized 1 v i 2 2, i order to obtai at least oe 0 ad at least oe 1 i each row. I order to obtai at least oe 0 i each colum of the matrix A, it is ecessary ad sufficiet that the bitwise AND of all umbers, represetig the rows of A to be equal to 0. I order to obtai at least oe 1 i each colum of the matrix A it is ecessary ad sufficiet that the bitwise iclusive OR of all umbers, represetig the rows of A to be equal to 2 1, i.e. to be equal to a umber which is writte i biary system with exact umber of 1 ad ot eve oe 0. Thus we obtai the followig fuctio, which checks whether the array of itegers v v, v,, v represets a matrix of Q, or ot ) ( it IsQ(usiged it v[], usiged it ) { // Returs 1, if with v a matrix i Q is coded // Returs 0, otherwise for (it i=0; i <= -1; i++) if (v[i]<1 v[i] > (1<<)-2) retur 0; it x,y; x = (1<<) -1; y=0; for (it j=0; j <= -1; j++) { x = x & v[j]; y = y v[j]; if (x!= 0) retur 0; if (y!= (1<<)-1) retur 0; retur 1;
4 Let x be a iteger, for which we are certai that it belogs to the iterval 0 x 2 1, i.e. there s o eed of more tha digits 0 or 1 for its biary code. The to preset x i biary system (see the fuctio BitValue described i the previous sectio), writte with the aid of exactly digits 0 or 1 ad evetually with a certai umber of isigificat zeroes at the begiig, we ca use the followig fuctio: void BiPr(it x, usiged it k) { it z; for (it i = k-1; i >= 0; i--) { z = x & (1<<i); if (z == 0) cout<< 0 ; else cout<< 1 ; cout<< \ ; Let us examie the set V {( v0, v1,, v 1) 0 v 2 1, i 0,1,, 1. i All elemets of V ca be sorted i ascedig lexicographic order. The essece of the proposed by us algorithm is to obtai sequetially all elemets of V i the same icreasig order from the smallest oe to the biggest oe ad right after obtaiig them to check whether this elemet is miimal accordig to the lexicography order i he class of equivalece. At last we will separate just the miimal i their class of equivalecy elemets ad they will be the oly represetatives of each equivalet class i the sets ad Q (which was required i Tasks 1 ad 2). For this purpose we B will desig fuctio IsMi, which will retur 1, if the iput argumet is miimal i the class of equivalecy to which it belogs to, ad 0 otherwise. But before that we eed the followig auxiliary fuctio CicleMove, which from assiged oegative itegers x ad retur a umber, which is obtaied from x by movig all bits with oe to the right, begiig with the movig of the very right bit to the place of the bit 1. I this case we will be helped by the bitwise operatios. usiged it CicleMove(usiged it x,usiged it ) { usiged it b0 = x & 1; // Record the value //of the very right bit of x x=x & ((1<<)-1); // Replaces all bits to the //left from the o with umber (-1) with 0 retur (x >> 1) (b0 << -1); The followig auxiliary fuctio will also be useful for the computig of the mai task: It IsLess(usiged it u[],usiged it v[],it ) { // Retur 1, if accordig to lexicographic order //u[0] u[1] u[-1] < v[0] v[1] v[-1] // Retur 0, otherwise
5 it i = 0; while ((u[i] == v[i]) && (i<-1)) i++; if (u[i] < v[i]) retur 1; else retur 0; The above metioed fuctio IsMi could look as follows: it IsMi(usiged it v[], usiged it ) { // Retur 1, if accordig to lexicographic order //v[0] v[1] v[-1]is miimal i its class of // equivalecy // Retur 0, otherwise usiged it u[32], v1[32]; for (it i = 0; i <= -1; i++) v1[i] = v[i]; for (it j = 0; j <= -1; j++) { for (it i = 1; i <= -1; i++) { for (it s = 0; s <= -1; s++) { it s1 = (s+i) % ; u[s] = v1[s1]; if (IsLess(u,v,) ) retur 0; for (it i=0; i <= -1; i++) v1[i]=ciclemove(v1[i],); retur 1; Takig the advatages of the above described fuctios we propose the followig computig of tasks 1 ad 2 (for =4, for example). I order to be brief here we will ot prit all the elemets obtaied, ad we will obtai their umber oly. For the hard-copy itself for each row of ay of the obtaied matrices we ca take advatage of the above described procedure BiPr ad after orgaizig of a cycle by the umber of the row to prit the whole matrix as well.. it mai() { cost it =4; it i; usiged log it NB = 0; usiged log it NQ = 0; // Number of elemets //i B // Number of elemets //i Q usiged log it NBEq = 0; // Number of the //classes of equivalecy i B usiged log it NQEq = 0; // Number of the //classes of equivalecy i Q usiged it v[]; it r=(1<<)-1; for (i = 0; i<; i++) v[i]=0; do { i=-1; for (it k=0; k<=r; k++) { v[i]=k; NB++;
6 if (IsQ(v,) ) NQ++; if (IsMi(v,) ) { NBEq++; if (IsQ(v,)) NQEq++; while (v[i]==r) i--; if (i>=0) { v[i]++; for (it k=-1; k>i; k--) { v[k]=0; while ( i>=0 ); cout<< Number of elemets i B <<NB<< \ ; cout<< Number of elemets i Q <<NQ<< \ ; cout<< Number of the classes of equivalecy i B <<NBEq<< \ ; cout<< Number of the classes of equivalecy i Q <<NQEq<< \ ; retur 0; The results from the above described program for some values of ca be summarized i the followig table B Q B Q / ~ / ~ REFERENCES [1] S. R. DAVIS C++ for dummies. IDG Books Worldwide, [2] C. S. HORSTMANN Computig cocepts with C++ essetials. Joh Wiley & Sos,1999. [3] B. W. KERNIGAN, D. M RITCHIE The C programmig Laguage. AT&T Bell Laboratories, [4] П. АЗЪЛОВ Информатика Езикът С++ в примери и задачи за 9-10 клас. София, Просвета, [5] П. АЗЪЛОВ Обектно ориентирано програмиране Структури от данни и STL. София, Сиела, [6] Г. И. БОРЗУНОВ Шерстяная промишленост-обзорная информащия. Москва, ЦНИИ ИТЭИЛП, 3, (1983). [7] С. В. ГЛУШАКОВ, А. В. КОВАЛЬ, С. В. СМИРНОВ Язык программирования C++. Харьков, Фолио, [8] К. Я. ЙОРДЖЕВ, И. В. СТАТУЛОВ Математическо моделиране и количествена оценка на първичните тъкачни сплитки. Текстил и облекло, 10, (1999), [9] Х. КРУШКОВ Практическо ръководство по програмиране на С++. Пловдив, Макрос,2006.
7 [10] Е. Л. РОМАНОВ Практикум по программированию на C++. Санкт Петербург, БХВ, [11] М. ТОДОРОВА Програмиране на С++. Част І, част ІІ, София, Сиела, Krasimir Yakov Yordzhev South-West Uiversity N. Rilsky 2700 Blagoevgrad, Bulgaria
AN EXAMPLE FOR THE USE OF BITWISE OPERATIONS IN PROGRAMMING. Krasimir Yordzhev
МАТЕМАТИКА И МАТЕМАТИЧЕСКО ОБРАЗОВАНИЕ, 2009 MATHEMATICS AND EDUCATION IN MATHEMATICS, 2009 Proceedings of the Thirty Eighth Spring Conference of the Union of Bulgarian Mathematicians Borovetz, April 1
More informationAn Entertaining Example for the Usage of Bitwise Operations in Programming
An Entertaining Example for the Usage of Bitwise Operations in Programming Hristina Kostadinova, Krasimir Yordzhev South-West University "Neofit Rilski" Blagoevgrad, Bulgaria kostadinova@swu.bg yordzhev@swu.bg
More informationarxiv: v1 [cs.ms] 6 Jan 2012
1 A Representation of Binary Matrices Hristina Kostadinova Krasimir Yordzhev arxiv:1201.1473v1 [cs.ms] 6 Jan 2012 Abstract In this article we discuss the presentation of a random binary matrix using sequence
More informationMatrix representation of a solution of a combinatorial problem of the group theory
Matrix represetatio of a solutio of a combiatorial problem of the group theory Krasimir Yordzhev, Lilyaa Totia Faculty of Mathematics ad Natural Scieces South-West Uiversity 66 Iva Mihailov Str, 2700 Blagoevgrad,
More informationOnes Assignment Method for Solving Traveling Salesman Problem
Joural of mathematics ad computer sciece 0 (0), 58-65 Oes Assigmet Method for Solvig Travelig Salesma Problem Hadi Basirzadeh Departmet of Mathematics, Shahid Chamra Uiversity, Ahvaz, Ira Article history:
More informationA REPRESENTATION OF BINARY MATRICES * Hristina Kostadinova, Krasimir Yordzhev
МАТЕМАТИКА И МАТЕМАТИЧЕСКО ОБРАЗОВАНИЕ, 2010 MATHEMATICS AND EDUCATION IN MATHEMATICS, 2010 Proceedings of the Thirty Ninth Spring Conference of the Union of Bulgarian Mathematicians Albena, April 6 10,
More informationBOOLEAN MATHEMATICS: GENERAL THEORY
CHAPTER 3 BOOLEAN MATHEMATICS: GENERAL THEORY 3.1 ISOMORPHIC PROPERTIES The ame Boolea Arithmetic was chose because it was discovered that literal Boolea Algebra could have a isomorphic umerical aspect.
More informationPython Programming: An Introduction to Computer Science
Pytho Programmig: A Itroductio to Computer Sciece Chapter 1 Computers ad Programs 1 Objectives To uderstad the respective roles of hardware ad software i a computig system. To lear what computer scietists
More informationLecture 1: Introduction and Strassen s Algorithm
5-750: Graduate Algorithms Jauary 7, 08 Lecture : Itroductio ad Strasse s Algorithm Lecturer: Gary Miller Scribe: Robert Parker Itroductio Machie models I this class, we will primarily use the Radom Access
More informationCounting the Number of Minimum Roman Dominating Functions of a Graph
Coutig the Number of Miimum Roma Domiatig Fuctios of a Graph SHI ZHENG ad KOH KHEE MENG, Natioal Uiversity of Sigapore We provide two algorithms coutig the umber of miimum Roma domiatig fuctios of a graph
More informationChapter 9. Pointers and Dynamic Arrays. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 9 Poiters ad Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 9.1 Poiters 9.2 Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Slide 9-3
More informationLecturers: Sanjam Garg and Prasad Raghavendra Feb 21, Midterm 1 Solutions
U.C. Berkeley CS170 : Algorithms Midterm 1 Solutios Lecturers: Sajam Garg ad Prasad Raghavedra Feb 1, 017 Midterm 1 Solutios 1. (4 poits) For the directed graph below, fid all the strogly coected compoets
More informationChapter 1. Introduction to Computers and C++ Programming. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 1 Itroductio to Computers ad C++ Programmig Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 1.1 Computer Systems 1.2 Programmig ad Problem Solvig 1.3 Itroductio to C++ 1.4 Testig
More informationChapter 3 Classification of FFT Processor Algorithms
Chapter Classificatio of FFT Processor Algorithms The computatioal complexity of the Discrete Fourier trasform (DFT) is very high. It requires () 2 complex multiplicatios ad () complex additios [5]. As
More informationPseudocode ( 1.1) Analysis of Algorithms. Primitive Operations. Pseudocode Details. Running Time ( 1.1) Estimating performance
Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Pseudocode ( 1.1) High-level descriptio of a algorithm More structured
More informationOn Infinite Groups that are Isomorphic to its Proper Infinite Subgroup. Jaymar Talledo Balihon. Abstract
O Ifiite Groups that are Isomorphic to its Proper Ifiite Subgroup Jaymar Talledo Baliho Abstract Two groups are isomorphic if there exists a isomorphism betwee them Lagrage Theorem states that the order
More informationWhat are we going to learn? CSC Data Structures Analysis of Algorithms. Overview. Algorithm, and Inputs
What are we goig to lear? CSC316-003 Data Structures Aalysis of Algorithms Computer Sciece North Carolia State Uiversity Need to say that some algorithms are better tha others Criteria for evaluatio Structure
More informationElementary Educational Computer
Chapter 5 Elemetary Educatioal Computer. Geeral structure of the Elemetary Educatioal Computer (EEC) The EEC coforms to the 5 uits structure defied by vo Neuma's model (.) All uits are preseted i a simplified
More informationAlgorithm. Counting Sort Analysis of Algorithms
Algorithm Coutig Sort Aalysis of Algorithms Assumptios: records Coutig sort Each record cotais keys ad data All keys are i the rage of 1 to k Space The usorted list is stored i A, the sorted list will
More informationHomework 1 Solutions MA 522 Fall 2017
Homework 1 Solutios MA 5 Fall 017 1. Cosider the searchig problem: Iput A sequece of umbers A = [a 1,..., a ] ad a value v. Output A idex i such that v = A[i] or the special value NIL if v does ot appear
More informationLecture Notes 6 Introduction to algorithm analysis CSS 501 Data Structures and Object-Oriented Programming
Lecture Notes 6 Itroductio to algorithm aalysis CSS 501 Data Structures ad Object-Orieted Programmig Readig for this lecture: Carrao, Chapter 10 To be covered i this lecture: Itroductio to algorithm aalysis
More information1. (a) Write a C program to display the texts Hello, World! on the screen. (2 points)
1. (a) Write a C program to display the texts Hello, World! o the scree. (2 poits) Solutio 1: pritf("hello, World!\"); Solutio 2: void mai() { pritf("hello, World!\"); (b) Write a C program to output a
More informationFuzzy Minimal Solution of Dual Fully Fuzzy Matrix Equations
Iteratioal Coferece o Applied Mathematics, Simulatio ad Modellig (AMSM 2016) Fuzzy Miimal Solutio of Dual Fully Fuzzy Matrix Equatios Dequa Shag1 ad Xiaobi Guo2,* 1 Sciece Courses eachig Departmet, Gasu
More informationarxiv: v2 [math.co] 29 May 2013
arxiv:1301.5100v2 [math.co] 29 May 2013 Bitwise operations related to a combinatorial problem on binary matrices Krasimir Yankov Yordzhev Abstract Some techniques for the use of bitwise operations are
More informationUniversity of Waterloo Department of Electrical and Computer Engineering ECE 250 Algorithms and Data Structures
Uiversity of Waterloo Departmet of Electrical ad Computer Egieerig ECE 250 Algorithms ad Data Structures Midterm Examiatio ( pages) Istructor: Douglas Harder February 7, 2004 7:30-9:00 Name (last, first)
More informationChapter 5. Functions for All Subtasks. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 5 Fuctios for All Subtasks Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 5.1 void Fuctios 5.2 Call-By-Referece Parameters 5.3 Usig Procedural Abstractio 5.4 Testig ad Debuggig
More informationRecursion. Recursion. Mathematical induction: example. Recursion. The sum of the first n odd numbers is n 2 : Informal proof: Principle:
Recursio Recursio Jordi Cortadella Departmet of Computer Sciece Priciple: Reduce a complex problem ito a simpler istace of the same problem Recursio Itroductio to Programmig Dept. CS, UPC 2 Mathematical
More informationLecture 5. Counting Sort / Radix Sort
Lecture 5. Coutig Sort / Radix Sort T. H. Corme, C. E. Leiserso ad R. L. Rivest Itroductio to Algorithms, 3rd Editio, MIT Press, 2009 Sugkyukwa Uiversity Hyuseug Choo choo@skku.edu Copyright 2000-2018
More informationOutline and Reading. Analysis of Algorithms. Running Time. Experimental Studies. Limitations of Experiments. Theoretical Analysis
Outlie ad Readig Aalysis of Algorithms Iput Algorithm Output Ruig time ( 3.) Pseudo-code ( 3.2) Coutig primitive operatios ( 3.3-3.) Asymptotic otatio ( 3.6) Asymptotic aalysis ( 3.7) Case study Aalysis
More informationCS 11 C track: lecture 1
CS 11 C track: lecture 1 Prelimiaries Need a CMS cluster accout http://acctreq.cms.caltech.edu/cgi-bi/request.cgi Need to kow UNIX IMSS tutorial liked from track home page Track home page: http://courses.cms.caltech.edu/courses/cs11/material
More informationCMPT 125 Assignment 2 Solutions
CMPT 25 Assigmet 2 Solutios Questio (20 marks total) a) Let s cosider a iteger array of size 0. (0 marks, each part is 2 marks) it a[0]; I. How would you assig a poiter, called pa, to store the address
More informationSolution printed. Do not start the test until instructed to do so! CS 2604 Data Structures Midterm Spring, Instructions:
CS 604 Data Structures Midterm Sprig, 00 VIRG INIA POLYTECHNIC INSTITUTE AND STATE U T PROSI M UNI VERSI TY Istructios: Prit your ame i the space provided below. This examiatio is closed book ad closed
More informationProject 2.5 Improved Euler Implementation
Project 2.5 Improved Euler Implemetatio Figure 2.5.10 i the text lists TI-85 ad BASIC programs implemetig the improved Euler method to approximate the solutio of the iitial value problem dy dx = x+ y,
More informationA graphical view of big-o notation. c*g(n) f(n) f(n) = O(g(n))
ca see that time required to search/sort grows with size of We How do space/time eeds of program grow with iput size? iput. time: cout umber of operatios as fuctio of iput Executio size operatio Assigmet:
More informationNew Results on Energy of Graphs of Small Order
Global Joural of Pure ad Applied Mathematics. ISSN 0973-1768 Volume 13, Number 7 (2017), pp. 2837-2848 Research Idia Publicatios http://www.ripublicatio.com New Results o Eergy of Graphs of Small Order
More informationA New Morphological 3D Shape Decomposition: Grayscale Interframe Interpolation Method
A ew Morphological 3D Shape Decompositio: Grayscale Iterframe Iterpolatio Method D.. Vizireau Politehica Uiversity Bucharest, Romaia ae@comm.pub.ro R. M. Udrea Politehica Uiversity Bucharest, Romaia mihea@comm.pub.ro
More informationRunning Time. Analysis of Algorithms. Experimental Studies. Limitations of Experiments
Ruig Time Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects. The
More informationRunning Time ( 3.1) Analysis of Algorithms. Experimental Studies. Limitations of Experiments
Ruig Time ( 3.1) Aalysis of Algorithms Iput Algorithm Output A algorithm is a step- by- step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects.
More informationAnalysis of Algorithms
Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Ruig Time Most algorithms trasform iput objects ito output objects. The
More informationRecursion. Computer Science S-111 Harvard University David G. Sullivan, Ph.D. Review: Method Frames
Uit 4, Part 3 Recursio Computer Sciece S-111 Harvard Uiversity David G. Sulliva, Ph.D. Review: Method Frames Whe you make a method call, the Java rutime sets aside a block of memory kow as the frame of
More informationAbstract. Chapter 4 Computation. Overview 8/13/18. Bjarne Stroustrup Note:
Chapter 4 Computatio Bjare Stroustrup www.stroustrup.com/programmig Abstract Today, I ll preset the basics of computatio. I particular, we ll discuss expressios, how to iterate over a series of values
More informationName of the Student: Unit I (Logic and Proofs) 1) Truth Table: Conjunction Disjunction Conditional Biconditional
SUBJECT NAME : Discrete Mathematics SUBJECT CODE : MA 2265 MATERIAL NAME : Formula Material MATERIAL CODE : JM08ADM009 (Sca the above QR code for the direct dowload of this material) Name of the Studet:
More informationThe Adjacency Matrix and The nth Eigenvalue
Spectral Graph Theory Lecture 3 The Adjacecy Matrix ad The th Eigevalue Daiel A. Spielma September 5, 2012 3.1 About these otes These otes are ot ecessarily a accurate represetatio of what happeed i class.
More informationData Structures and Algorithms. Analysis of Algorithms
Data Structures ad Algorithms Aalysis of Algorithms Outlie Ruig time Pseudo-code Big-oh otatio Big-theta otatio Big-omega otatio Asymptotic algorithm aalysis Aalysis of Algorithms Iput Algorithm Output
More informationCIS 121 Data Structures and Algorithms with Java Spring Stacks and Queues Monday, February 12 / Tuesday, February 13
CIS Data Structures ad Algorithms with Java Sprig 08 Stacks ad Queues Moday, February / Tuesday, February Learig Goals Durig this lab, you will: Review stacks ad queues. Lear amortized ruig time aalysis
More informationChapter 11. Friends, Overloaded Operators, and Arrays in Classes. Copyright 2014 Pearson Addison-Wesley. All rights reserved.
Chapter 11 Frieds, Overloaded Operators, ad Arrays i Classes Copyright 2014 Pearso Addiso-Wesley. All rights reserved. Overview 11.1 Fried Fuctios 11.2 Overloadig Operators 11.3 Arrays ad Classes 11.4
More informationChapter 4. Procedural Abstraction and Functions That Return a Value. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 4 Procedural Abstractio ad Fuctios That Retur a Value Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 4.1 Top-Dow Desig 4.2 Predefied Fuctios 4.3 Programmer-Defied Fuctios 4.4
More informationn Some thoughts on software development n The idea of a calculator n Using a grammar n Expression evaluation n Program organization n Analysis
Overview Chapter 6 Writig a Program Bjare Stroustrup Some thoughts o software developmet The idea of a calculator Usig a grammar Expressio evaluatio Program orgaizatio www.stroustrup.com/programmig 3 Buildig
More informationTheory of Fuzzy Soft Matrix and its Multi Criteria in Decision Making Based on Three Basic t-norm Operators
Theory of Fuzzy Soft Matrix ad its Multi Criteria i Decisio Makig Based o Three Basic t-norm Operators Md. Jalilul Islam Modal 1, Dr. Tapa Kumar Roy 2 Research Scholar, Dept. of Mathematics, BESUS, Howrah-711103,
More informationComputers and Scientific Thinking
Computers ad Scietific Thikig David Reed, Creighto Uiversity Chapter 15 JavaScript Strigs 1 Strigs as Objects so far, your iteractive Web pages have maipulated strigs i simple ways use text box to iput
More informationSolving Fuzzy Assignment Problem Using Fourier Elimination Method
Global Joural of Pure ad Applied Mathematics. ISSN 0973-768 Volume 3, Number 2 (207), pp. 453-462 Research Idia Publicatios http://www.ripublicatio.com Solvig Fuzzy Assigmet Problem Usig Fourier Elimiatio
More informationHow do we evaluate algorithms?
F2 Readig referece: chapter 2 + slides Algorithm complexity Big O ad big Ω To calculate ruig time Aalysis of recursive Algorithms Next time: Litterature: slides mostly The first Algorithm desig methods:
More informationCHAPTER IV: GRAPH THEORY. Section 1: Introduction to Graphs
CHAPTER IV: GRAPH THEORY Sectio : Itroductio to Graphs Sice this class is called Number-Theoretic ad Discrete Structures, it would be a crime to oly focus o umber theory regardless how woderful those topics
More information. Written in factored form it is easy to see that the roots are 2, 2, i,
CMPS A Itroductio to Programmig Programmig Assigmet 4 I this assigmet you will write a java program that determies the real roots of a polyomial that lie withi a specified rage. Recall that the roots (or
More informationLU Decomposition Method
SOLUTION OF SIMULTANEOUS LINEAR EQUATIONS LU Decompositio Method Jamie Traha, Autar Kaw, Kevi Marti Uiversity of South Florida Uited States of America kaw@eg.usf.edu http://umericalmethods.eg.usf.edu Itroductio
More informationAnalysis of Algorithms
Aalysis of Algorithms Ruig Time of a algorithm Ruig Time Upper Bouds Lower Bouds Examples Mathematical facts Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite
More informationA SOFTWARE MODEL FOR THE MULTILAYER PERCEPTRON
A SOFTWARE MODEL FOR THE MULTILAYER PERCEPTRON Roberto Lopez ad Eugeio Oñate Iteratioal Ceter for Numerical Methods i Egieerig (CIMNE) Edificio C1, Gra Capitá s/, 08034 Barceloa, Spai ABSTRACT I this work
More information1.2 Binomial Coefficients and Subsets
1.2. BINOMIAL COEFFICIENTS AND SUBSETS 13 1.2 Biomial Coefficiets ad Subsets 1.2-1 The loop below is part of a program to determie the umber of triagles formed by poits i the plae. for i =1 to for j =
More informationAnalysis Metrics. Intro to Algorithm Analysis. Slides. 12. Alg Analysis. 12. Alg Analysis
Itro to Algorithm Aalysis Aalysis Metrics Slides. Table of Cotets. Aalysis Metrics 3. Exact Aalysis Rules 4. Simple Summatio 5. Summatio Formulas 6. Order of Magitude 7. Big-O otatio 8. Big-O Theorems
More informationLoad balanced Parallel Prime Number Generator with Sieve of Eratosthenes on Cluster Computers *
Load balaced Parallel Prime umber Geerator with Sieve of Eratosthees o luster omputers * Soowook Hwag*, Kyusik hug**, ad Dogseug Kim* *Departmet of Electrical Egieerig Korea Uiversity Seoul, -, Rep. of
More informationReversible Realization of Quaternary Decoder, Multiplexer, and Demultiplexer Circuits
Egieerig Letters, :, EL Reversible Realizatio of Quaterary Decoder, Multiplexer, ad Demultiplexer Circuits Mozammel H.. Kha, Member, ENG bstract quaterary reversible circuit is more compact tha the correspodig
More informationcondition w i B i S maximum u i
ecture 10 Dyamic Programmig 10.1 Kapsack Problem November 1, 2004 ecturer: Kamal Jai Notes: Tobias Holgers We are give a set of items U = {a 1, a 2,..., a }. Each item has a weight w i Z + ad a utility
More informationBehavioral Modeling in Verilog
Behavioral Modelig i Verilog COE 202 Digital Logic Desig Dr. Muhamed Mudawar Kig Fahd Uiversity of Petroleum ad Mierals Presetatio Outlie Itroductio to Dataflow ad Behavioral Modelig Verilog Operators
More informationEE University of Minnesota. Midterm Exam #1. Prof. Matthew O'Keefe TA: Eric Seppanen. Department of Electrical and Computer Engineering
EE 4363 1 Uiversity of Miesota Midterm Exam #1 Prof. Matthew O'Keefe TA: Eric Seppae Departmet of Electrical ad Computer Egieerig Uiversity of Miesota Twi Cities Campus EE 4363 Itroductio to Microprocessors
More informationLecture 18. Optimization in n dimensions
Lecture 8 Optimizatio i dimesios Itroductio We ow cosider the problem of miimizig a sigle scalar fuctio of variables, f x, where x=[ x, x,, x ]T. The D case ca be visualized as fidig the lowest poit of
More informationCSE 417: Algorithms and Computational Complexity
Time CSE 47: Algorithms ad Computatioal Readig assigmet Read Chapter of The ALGORITHM Desig Maual Aalysis & Sortig Autum 00 Paul Beame aalysis Problem size Worst-case complexity: max # steps algorithm
More informationModule 8-7: Pascal s Triangle and the Binomial Theorem
Module 8-7: Pascal s Triagle ad the Biomial Theorem Gregory V. Bard April 5, 017 A Note about Notatio Just to recall, all of the followig mea the same thig: ( 7 7C 4 C4 7 7C4 5 4 ad they are (all proouced
More informationAPPLICATION NOTE PACE1750AE BUILT-IN FUNCTIONS
APPLICATION NOTE PACE175AE BUILT-IN UNCTIONS About This Note This applicatio brief is iteded to explai ad demostrate the use of the special fuctios that are built ito the PACE175AE processor. These powerful
More informationBitwise Operations Related to a Combinatorial Problem on Binary Matrices
I.J.Modern Education and Computer Science, 2013, 4, 19-24 Published Online May 2013 in MECS (http://www.mecs-press.org/) DOI: 10.5815/ijmecs.2013.04.03 Bitwise Operations Related to a Combinatorial Problem
More informationPolynomial Functions and Models. Learning Objectives. Polynomials. P (x) = a n x n + a n 1 x n a 1 x + a 0, a n 0
Polyomial Fuctios ad Models 1 Learig Objectives 1. Idetify polyomial fuctios ad their degree 2. Graph polyomial fuctios usig trasformatios 3. Idetify the real zeros of a polyomial fuctio ad their multiplicity
More informationChapter 10. Defining Classes. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 10 Defiig Classes Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 10.1 Structures 10.2 Classes 10.3 Abstract Data Types 10.4 Itroductio to Iheritace Copyright 2015 Pearso Educatio,
More informationNeural Networks A Model of Boolean Functions
Neural Networks A Model of Boolea Fuctios Berd Steibach, Roma Kohut Freiberg Uiversity of Miig ad Techology Istitute of Computer Sciece D-09596 Freiberg, Germay e-mails: steib@iformatik.tu-freiberg.de
More informationAnalysis of Algorithms
Presetatio for use with the textbook, Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 2015 Aalysis of Algorithms Iput 2015 Goodrich ad Tamassia Algorithm Aalysis of Algorithms
More informationThe isoperimetric problem on the hypercube
The isoperimetric problem o the hypercube Prepared by: Steve Butler November 2, 2005 1 The isoperimetric problem We will cosider the -dimesioal hypercube Q Recall that the hypercube Q is a graph whose
More informationEE260: Digital Design, Spring /16/18. n Example: m 0 (=x 1 x 2 ) is adjacent to m 1 (=x 1 x 2 ) and m 2 (=x 1 x 2 ) but NOT m 3 (=x 1 x 2 )
EE26: Digital Desig, Sprig 28 3/6/8 EE 26: Itroductio to Digital Desig Combiatioal Datapath Yao Zheg Departmet of Electrical Egieerig Uiversity of Hawaiʻi at Māoa Combiatioal Logic Blocks Multiplexer Ecoders/Decoders
More informationCOMP Parallel Computing. PRAM (1): The PRAM model and complexity measures
COMP 633 - Parallel Computig Lecture 2 August 24, 2017 : The PRAM model ad complexity measures 1 First class summary This course is about parallel computig to achieve high-er performace o idividual problems
More informationMR-2010I %MktBSize Macro 989. %MktBSize Macro
MR-2010I %MktBSize Macro 989 %MktBSize Macro The %MktBSize autocall macro suggests sizes for balaced icomplete block desigs (BIBDs). The sizes that it reports are sizes that meet ecessary but ot sufficiet
More informationAn Efficient Algorithm for Graph Bisection of Triangularizations
A Efficiet Algorithm for Graph Bisectio of Triagularizatios Gerold Jäger Departmet of Computer Sciece Washigto Uiversity Campus Box 1045 Oe Brookigs Drive St. Louis, Missouri 63130-4899, USA jaegerg@cse.wustl.edu
More informationXiaozhou (Steve) Li, Atri Rudra, Ram Swaminathan. HP Laboratories HPL Keyword(s): graph coloring; hardness of approximation
Flexible Colorig Xiaozhou (Steve) Li, Atri Rudra, Ram Swamiatha HP Laboratories HPL-2010-177 Keyword(s): graph colorig; hardess of approximatio Abstract: Motivated b y reliability cosideratios i data deduplicatio
More informationTask scenarios Outline. Scenarios in Knowledge Extraction. Proposed Framework for Scenario to Design Diagram Transformation
6-0-0 Kowledge Trasformatio from Task Scearios to View-based Desig Diagrams Nima Dezhkam Kamra Sartipi {dezhka, sartipi}@mcmaster.ca Departmet of Computig ad Software McMaster Uiversity CANADA SEKE 08
More informationBig-O Analysis. Asymptotics
Big-O Aalysis 1 Defiitio: Suppose that f() ad g() are oegative fuctios of. The we say that f() is O(g()) provided that there are costats C > 0 ad N > 0 such that for all > N, f() Cg(). Big-O expresses
More informationAssignment 5; Due Friday, February 10
Assigmet 5; Due Friday, February 10 17.9b The set X is just two circles joied at a poit, ad the set X is a grid i the plae, without the iteriors of the small squares. The picture below shows that the iteriors
More informationc-dominating Sets for Families of Graphs
c-domiatig Sets for Families of Graphs Kelsie Syder Mathematics Uiversity of Mary Washigto April 6, 011 1 Abstract The topic of domiatio i graphs has a rich history, begiig with chess ethusiasts i the
More informationCS : Programming for Non-Majors, Summer 2007 Programming Project #3: Two Little Calculations Due by 12:00pm (noon) Wednesday June
CS 1313 010: Programmig for No-Majors, Summer 2007 Programmig Project #3: Two Little Calculatios Due by 12:00pm (oo) Wedesday Jue 27 2007 This third assigmet will give you experiece writig programs that
More informationLower Bounds for Sorting
Liear Sortig Topics Covered: Lower Bouds for Sortig Coutig Sort Radix Sort Bucket Sort Lower Bouds for Sortig Compariso vs. o-compariso sortig Decisio tree model Worst case lower boud Compariso Sortig
More informationPattern Recognition Systems Lab 1 Least Mean Squares
Patter Recogitio Systems Lab 1 Least Mea Squares 1. Objectives This laboratory work itroduces the OpeCV-based framework used throughout the course. I this assigmet a lie is fitted to a set of poits usig
More informationChapter 8. Strings and Vectors. Copyright 2014 Pearson Addison-Wesley. All rights reserved.
Chapter 8 Strigs ad Vectors Overview 8.1 A Array Type for Strigs 8.2 The Stadard strig Class 8.3 Vectors Slide 8-3 8.1 A Array Type for Strigs A Array Type for Strigs C-strigs ca be used to represet strigs
More information9.1. Sequences and Series. Sequences. What you should learn. Why you should learn it. Definition of Sequence
_9.qxd // : AM Page Chapter 9 Sequeces, Series, ad Probability 9. Sequeces ad Series What you should lear Use sequece otatio to write the terms of sequeces. Use factorial otatio. Use summatio otatio to
More informationExact Minimum Lower Bound Algorithm for Traveling Salesman Problem
Exact Miimum Lower Boud Algorithm for Travelig Salesma Problem Mohamed Eleiche GeoTiba Systems mohamed.eleiche@gmail.com Abstract The miimum-travel-cost algorithm is a dyamic programmig algorithm to compute
More informationChapter 8. Strings and Vectors. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 8 Strigs ad Vectors Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 8.1 A Array Type for Strigs 8.2 The Stadard strig Class 8.3 Vectors Copyright 2015 Pearso Educatio, Ltd..
More informationAlpha Individual Solutions MAΘ National Convention 2013
Alpha Idividual Solutios MAΘ Natioal Covetio 0 Aswers:. D. A. C 4. D 5. C 6. B 7. A 8. C 9. D 0. B. B. A. D 4. C 5. A 6. C 7. B 8. A 9. A 0. C. E. B. D 4. C 5. A 6. D 7. B 8. C 9. D 0. B TB. 570 TB. 5
More informationCreating Exact Bezier Representations of CST Shapes. David D. Marshall. California Polytechnic State University, San Luis Obispo, CA , USA
Creatig Exact Bezier Represetatios of CST Shapes David D. Marshall Califoria Polytechic State Uiversity, Sa Luis Obispo, CA 93407-035, USA The paper presets a method of expressig CST shapes pioeered by
More information5.3 Recursive definitions and structural induction
/8/05 5.3 Recursive defiitios ad structural iductio CSE03 Discrete Computatioal Structures Lecture 6 A recursively defied picture Recursive defiitios e sequece of powers of is give by a = for =0,,, Ca
More informationHash Tables. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015.
Presetatio for use with the textbook Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 2015 Hash Tables xkcd. http://xkcd.com/221/. Radom Number. Used with permissio uder Creative
More informationn n B. How many subsets of C are there of cardinality n. We are selecting elements for such a
4. [10] Usig a combiatorial argumet, prove that for 1: = 0 = Let A ad B be disjoit sets of cardiality each ad C = A B. How may subsets of C are there of cardiality. We are selectig elemets for such a subset
More informationChapter 24. Sorting. Objectives. 1. To study and analyze time efficiency of various sorting algorithms
Chapter 4 Sortig 1 Objectives 1. o study ad aalyze time efficiecy of various sortig algorithms 4. 4.7.. o desig, implemet, ad aalyze bubble sort 4.. 3. o desig, implemet, ad aalyze merge sort 4.3. 4. o
More informationOne advantage that SONAR has over any other music-sequencing product I ve worked
*gajedra* D:/Thomso_Learig_Projects/Garrigus_163132/z_productio/z_3B2_3D_files/Garrigus_163132_ch17.3d, 14/11/08/16:26:39, 16:26, page: 647 17 CAL 101 Oe advatage that SONAR has over ay other music-sequecig
More informationGraceful Labelings of Pendant Graphs
Rose-Hulma Udergraduate Mathematics Joural Volume Issue Article 0 Graceful Labeligs of Pedat Graphs Alessadra Graf Norther Arizoa Uiversity, ag@au.edu Follow this ad additioal works at: http://scholar.rose-hulma.edu/rhumj
More informationNovel Encryption Schemes Based on Catalan Numbers
D. Sravaa Kumar, H. Sueetha, A. hadrasekhar / Iteratioal Joural of Egieerig Research ad Applicatios (IJERA) ISSN: 48-96 www.iera.com Novel Ecryptio Schemes Based o atala Numbers 1 D. Sravaa Kumar H. Sueetha
More informationExamples and Applications of Binary Search
Toy Gog ITEE Uiersity of Queeslad I the secod lecture last week we studied the biary search algorithm that soles the problem of determiig if a particular alue appears i a sorted list of iteger or ot. We
More information