# Chapter Objectives. Chapter 9. Sequential Search. Search Algorithms. Search Algorithms. Binary Search

Save this PDF as:

Size: px
Start display at page:

Download "Chapter Objectives. Chapter 9. Sequential Search. Search Algorithms. Search Algorithms. Binary Search"

## Transcription

1 Chapter Objectives Chapter 9 Search Algorithms Data Structures Using C++ 1 Learn the various search algorithms Explore how to implement the sequential and binary search algorithms Discover how the sequential and binary search algorithms perform Become aware of the lower bound on comparison-based search algorithms Learn about hashing Data Structures Using C++ 2 Sequential Search template<class elemtype> int arraylisttype<elemtype>::seqsearch(const elemtype& item) int loc; bool found = false; for(loc = 0; loc < length; loc++) if(list[loc] == item) found = true; break; } if(found) return loc; What is the time complexity? return -1; }//end seqsearch Data Structures Using C++ 3 Search Algorithms Search item: target To determine the average number of comparisons in the successful case of the sequential search algorithm: Consider all possible cases Find the number of comparisons for each case Add the number of comparisons and divide by the number of cases Data Structures Using C++ 4 Search Algorithms Suppose that there are n elements in the list. The following expression gives the average number of comparisons, assuming that each element is equally likely to be sought: Binary Search (assumes list is sorted) It is known that Therefore, the following expression gives the average number of comparisons made by the sequential search in the successful case: Data Structures Using C++ 5 Data Structures Using C++ 6

2 Binary Search: middle element first + last mid = 2 Data Structures Using C++ 7 Binary Search template<class elemtype> int orderedarraylisttype<elemtype>::binarysearch (const elemtype& item) int first = 0; int last = length - 1; int mid; bool found = false; while(first <= last &&!found) mid = (first + last) / 2; if(list[mid] == item) found = true; if(list[mid] > item) last = mid - 1; first = mid + 1; } if(found) return mid; return 1; }//end binarysearch Data Structures Using C++ 8 Binary Search: Example Binary Search: Example Unsuccessful search Total number of comparisons is 6 Data Structures Using C++ 9 Data Structures Using C++ 10 Performance of Binary Search Performance of Binary Search Data Structures Using C++ 11 Data Structures Using C++ 12

3 Performance of Binary Search Unsuccessful search for a list of length n, a binary search makes approximately 2 log 2 (n + 1) key comparisons Search Algorithm Analysis Summary Successful search for a list of length n, on average, a binary search makes 2 log 2 n 4 key comparisons Worst case upper bound: log 2 n Data Structures Using C++ 13 Data Structures Using C++ 14 Lower Bound on Comparison- Based Search Definition: A comparison-based search algorithm performs its search by repeatedly comparing the target element to the list elements. Theorem: Let L be a list of size n > 1. Suppose that the elements of L are sorted. If SRH(n) denotes the minimum number of comparisons needed, in the worst case, by using a comparison-based algorithm to recognize whether an element x is in L, then SRH(n) = log 2 (n + 1). If list not sorted, worst case is n comparisons Corollary: The binary search algorithm is the optimal worst-case algorithm for solving search problems by the comparison method (when the list is sorted). For unsorted lists, sequential search is optimal Hashing An alternative to comparison-based search Requires storing data in a special data structure, called a hash table Main objectives to choosing hash functions: Choose a hash function that is easy to compute Minimize the number of collisions Data Structures Using C++ 15 Data Structures Using C++ 16 Commonly Used Hash Functions Mid-Square Hash function, h, computed by squaring the identifier Using appropriate number of bits from the middle of the square to obtain the bucket address Middle bits of a square usually depend on all the characters, it is expected that different keys will yield different hash addresses with high probability, even if some of the characters are the same Commonly Used Hash Functions Folding Key X is partitioned into parts such that all the parts, except possibly the last parts, are of equal length Parts then added, in convenient way, to obtain hash address Division (Modular arithmetic) Key X is converted into an integer ix This integer divided by size of hash table to get remainder, giving address of X in HT Data Structures Using C++ 17 Data Structures Using C++ 18

4 Commonly Used Hash Functions Suppose that each key is a string. The following C++ function uses the division method to compute the address of the key: int hashfunction(char *key, int keylength) int sum = 0; for(int j = 0; j <= keylength; j++) sum = sum + static_cast<int>(key[j]); return (sum % HTSize); }//end hashfunction Collision Resolution Algorithms to handle collisions Two categories of collision resolution techniques Open addressing (closed hashing) Chaining (open hashing) Data Structures Using C++ 19 Data Structures Using C++ 20 Collision Resolution: Open Addressing Pseudocode implementing linear probing: hindex = hashfunction(insertkey); found = false; while(ht[hindex]!= emptykey &&!found) if(ht[hindex].key == key) found = true; hindex = (hindex + 1) % HTSize; if(found) cerr<< Duplicate items are not allowed. <<endl; HT[hIndex] = newitem; Data Structures Using C++ 21 Linear Probing 9 will be next location if h(x) = 6,7,8, or 9 Probability of 9 being next = 4/20, for 14, it s 5/20, but only 1/20 for 0 or 1 Clustering Data Structures Using C++ 22 Random Probing Uses a random number generator to find the next available slot ith slot in the probe sequence is: (h(x) + r i ) % HTSize where r i is the ith value in a random permutation of the numbers 1 to HTSize 1 All insertions and searches use the same sequence of random numbers Quadratic Probing ith slot in the probe sequence is: (h(x) + i 2 ) % HTSize (start i at 0) Reduces primary clustering of linear probing We do not know if it probes all the positions in the table When HTSize is prime, quadratic probing probes about half the table before repeating the probe sequence Data Structures Using C++ 23 Data Structures Using C++ 24

5 Deletion: Open Addressing Deletion: Open Addressing When deleting, need to remove the item from its spot, but cannot reset it to empty (Why?) IndexStatusList[i] set to 1 to mark item i as deleted Data Structures Using C++ 25 Data Structures Using C++ 26 Collision Resolution: Chaining (Open Hashing) Hashing Analysis Let Then a is called the load factor No probing needed; instead put linked list at each hash position Data Structures Using C++ 27 Data Structures Using C++ 28 Average Number of Comparisons Linear probing: Successful search: Unsuccessful search: Chaining: Average Number of Comparisons 1. Successful search Quadratic probing: Successful search: 2. Unsuccessful search Unsuccessful search: Data Structures Using C++ 29 Data Structures Using C++ 30

6 Hashing 1 Searching Lists There are many instances when one is interested in storing and searching a list: A phone company wants to provide caller ID: Given a phone number a name is returned. Somebody who plays the Lotto thinks they can increase their chance to win if they keep track of the winning number from the last 3 years. Both of these have simple solutions using arrays, linked lists, binary trees, etc. Unfortunately, none of these solutions is adequate, as we will see. Hashing 4 Hash Table Example I have 5 friends whose phone numbers I want to store in a hash table of size 8. Their names and numbers are: Susy Olson Sarah Skillet Ryan Hamster Justin Case Chris Lindmeyer I use as a hash function h(k) =k mod 8,wherek is the phone number viewed as a 7-digit decimal number. Notice that mod 8 = mod 8 = 1. But I can t put Sarah Skillet and Ryan Hamster both in the position 1. Can we fix this problem? Hashing 2 Problematic List Searching Here are some solutions to the problems: For caller ID: Use an array indexed by phone number. Requires one operation to return name. An array of size 1,000,000,000 is needed. Use a linked list. This requires O(n) time and space, where n is the number of actual phone numbers. This is the best we can do space-wise, but the time required is horrendous. A balanced binary tree: O(n) space and O(log n) time. Better, but not good enough. For the Lotto we could use the same solutions. The number of possible lotto number s is 15,625,000 for a 6/50 lotto. The number of entries stored is on the order of 1000, assuming a daily lotto. Hashing 5 Hash Table Problems The problem with hash tables is that two keys can have the same hash value. This is called collision. There are several ways to deal with this problem: Pick the hash function h to minimize the number of collisions. Implement the hash table in a way that allows keys with the same hash value to all be stored. The second method is almost always needed, even for very good hash functions. Why? We will talk about 2 collision resolution techniques: Chaining Open Addressing But first, a bit more on hash functions Hashing 3 The Hash Table Solution A Hash table is similar to an array: Has fixed size m. An item with key k goes into index h(k), where h is a function from the keyspace to 0, 1,...,m 1} The function h is called a hash function. We call h(k) the hash value of k. A hash table allows us to store values from a large set in a small array in such a way that searching is fast. The space required to store n numbers in a hash table of size m is O(m + n). Notice that this does not depend on the size of the keyspace. The average time required to insert, delete, and search for an element in a hash table is O(1). Sounds perfect. Then what s the problem? Let s look at an example. Hashing 6 Hash Functions Most hash functions assume the keys come from the set 0, 1,...}. If the keys are not natural numbers, some method must be used to convert them. Phone number and ID numbers can be converted by removing the hyphens. Characters can be converted using ASCII. Strings can be converted by converting each character using ASCII, and then interpreting the string of natural numbers as if it where stored base 128. We need to choose a good hash function. A hash function is good if it can be computed quickly, and the keys are distributed uniformly throughout the table.

8 Chaining or Open Addressing? Hashing Performance: Chaining Verses Open Addressing 20 1 Ch: I 1+x Ch: S 1/(1-x) OA: I/US 15 (1/x)*log(1/(1-x))+1/x OA: SS Hashing 13 Double Hashing With double hashing we use two hash functions. Let h1 and h2 be hash functions. We define our probe sequence by h(k, i) =(h1(k)+i h2(k)) mod m. Often pick m =2 n for some n, and ensure that h2(k) is always odd. Double hashing tends to distribute keys more uniformly than linear probing. Hashing 16 Hashing 14 Double Hashing Example Let h1 = k mod 13 Let h2 =1+(k mod 8),and Let the hash table have size 13. Then our probe sequence is defined by h(k, i) =(h1(k)+i h2(k)) mod 13 =(k mod 13 + i(1 + (k mod 8))) mod 13 Insert the following keys into the table: 18, 41, 22, 44, 59, 32, 31, Hashing 15 Open Addressing: Performance Again, we set α = n/m.thisistheaverage number of keys per array index. Note that α 1 for open addressing. We assume a good probe sequence has been used. That is, for any key, each permutation of 0, 1...,m 1 is equally likely as a probe sequence. The average number of probes for insertion or unsuccessful search is at most 1/(1 α). The average number of probes for a successful search is at most 1 α ln 1 1 α + 1 α.

### Universal hashing. In other words, the probability of a collision for two different keys x and y given a hash function randomly chosen from H is 1/m.

Universal hashing No matter how we choose our hash function, it is always possible to devise a set of keys that will hash to the same slot, making the hash scheme perform poorly. To circumvent this, we

### Fundamental Algorithms

Fundamental Algorithms Chapter 7: Hash Tables Michael Bader Winter 2014/15 Chapter 7: Hash Tables, Winter 2014/15 1 Generalised Search Problem Definition (Search Problem) Input: a sequence or set A of

### Sorting revisited. Build the binary search tree: O(n^2) Traverse the binary tree: O(n) Total: O(n^2) + O(n) = O(n^2)

Sorting revisited How did we use a binary search tree to sort an array of elements? Tree Sort Algorithm Given: An array of elements to sort 1. Build a binary search tree out of the elements 2. Traverse

### Lecture 7: Hashing III: Open Addressing

Lecture 7: Hashing III: Open Addressing Lecture Overview Open Addressing, Probing Strategies Uniform Hashing, Analysis Cryptographic Hashing Readings CLRS Chapter.4 (and.3.3 and.5 if interested) Open Addressing

### Tables so far. set() get() delete() BST Average O(lg n) O(lg n) O(lg n) Worst O(n) O(n) O(n) RB Tree Average O(lg n) O(lg n) O(lg n)

Hash Tables Tables so far set() get() delete() BST Average O(lg n) O(lg n) O(lg n) Worst O(n) O(n) O(n) RB Tree Average O(lg n) O(lg n) O(lg n) Worst O(lg n) O(lg n) O(lg n) Table naïve array implementation

### Review of Hashing: Integer Keys

CSE 326 Lecture 13: Much ado about Hashing Today s munchies to munch on: Review of Hashing Collision Resolution by: Separate Chaining Open Addressing \$ Linear/Quadratic Probing \$ Double Hashing Rehashing

### INDEX ABOUT HASHING IN GENERAL

INDEX ABOUT HASHING IN GENERAL 1. URL... 2 2. INTRODUCTION.. 2 3. HASH TABLE STRUCTURE... 3 3.1 OPERATIONS 4 3.1.1 CREATE A TABLE 4 3.1.2 DELETE A TABLE 4 3.1.3 STRING LOOKUP.. 5 3.1.4 INSERT A STRING

### Analysis of Binary Search algorithm and Selection Sort algorithm

Analysis of Binary Search algorithm and Selection Sort algorithm In this section we shall take up two representative problems in computer science, work out the algorithms based on the best strategy to

### Efficiency of algorithms. Algorithms. Efficiency of algorithms. Binary search and linear search. Best, worst and average case.

Algorithms Efficiency of algorithms Computational resources: time and space Best, worst and average case performance How to compare algorithms: machine-independent measure of efficiency Growth rate Complexity

### Merge Sort. 2004 Goodrich, Tamassia. Merge Sort 1

Merge Sort 7 2 9 4 2 4 7 9 7 2 2 7 9 4 4 9 7 7 2 2 9 9 4 4 Merge Sort 1 Divide-and-Conquer Divide-and conquer is a general algorithm design paradigm: Divide: divide the input data S in two disjoint subsets

### Binary search algorithm

Binary search algorithm Definition Search a sorted array by repeatedly dividing the search interval in half. Begin with an interval covering the whole array. If the value of the search key is less than

### Hash Tables. Computer Science E-119 Harvard Extension School Fall 2012 David G. Sullivan, Ph.D. Data Dictionary Revisited

Hash Tables Computer Science E-119 Harvard Extension School Fall 2012 David G. Sullivan, Ph.D. Data Dictionary Revisited We ve considered several data structures that allow us to store and search for data

### Cloud and Big Data Summer School, Stockholm, Aug., 2015 Jeffrey D. Ullman

Cloud and Big Data Summer School, Stockholm, Aug., 2015 Jeffrey D. Ullman To motivate the Bloom-filter idea, consider a web crawler. It keeps, centrally, a list of all the URL s it has found so far. It

### Lecture 2 February 12, 2003

6.897: Advanced Data Structures Spring 003 Prof. Erik Demaine Lecture February, 003 Scribe: Jeff Lindy Overview In the last lecture we considered the successor problem for a bounded universe of size u.

### Record Storage and Primary File Organization

Record Storage and Primary File Organization 1 C H A P T E R 4 Contents Introduction Secondary Storage Devices Buffering of Blocks Placing File Records on Disk Operations on Files Files of Unordered Records

### BM307 File Organization

BM307 File Organization Gazi University Computer Engineering Department 9/24/2014 1 Index Sequential File Organization Binary Search Interpolation Search Self-Organizing Sequential Search Direct File Organization

### 6. Standard Algorithms

6. Standard Algorithms The algorithms we will examine perform Searching and Sorting. 6.1 Searching Algorithms Two algorithms will be studied. These are: 6.1.1. inear Search The inear Search The Binary

### CSE373: Data Structures & Algorithms Lecture 14: Hash Collisions. Linda Shapiro Spring 2016

CSE373: Data Structures & Algorithms Lecture 14: Hash Collisions Linda Shapiro Spring 2016 Announcements Friday: Review List and go over answers to Practice Problems 2 Hash Tables: Review Aim for constant-time

### TIE-20106 1 TIE-20106 2

TIE-20106 1 1 List structures In this chapter, a few simple data structures (stack and queue) that can be implemented with arrays and/or lists are covered. Two more complex structures based on lists are

### Converting a Number from Decimal to Binary

Converting a Number from Decimal to Binary Convert nonnegative integer in decimal format (base 10) into equivalent binary number (base 2) Rightmost bit of x Remainder of x after division by two Recursive

### DATA STRUCTURES USING C

DATA STRUCTURES USING C QUESTION BANK UNIT I 1. Define data. 2. Define Entity. 3. Define information. 4. Define Array. 5. Define data structure. 6. Give any two applications of data structures. 7. Give

### Zabin Visram Room CS115 CS126 Searching. Binary Search

Zabin Visram Room CS115 CS126 Searching Binary Search Binary Search Sequential search is not efficient for large lists as it searches half the list, on average Another search algorithm Binary search Very

### Binary Search Trees. Data in each node. Larger than the data in its left child Smaller than the data in its right child

Binary Search Trees Data in each node Larger than the data in its left child Smaller than the data in its right child FIGURE 11-6 Arbitrary binary tree FIGURE 11-7 Binary search tree Data Structures Using

### Practical Survey on Hash Tables. Aurelian Țuțuianu

Practical Survey on Hash Tables Aurelian Țuțuianu In memoriam Mihai Pătraşcu (17 July 1982 5 June 2012) I have no intention to ever teach computer science. I want to teach the love for computer science,

### Chapter 13. Chapter Outline. Disk Storage, Basic File Structures, and Hashing

Chapter 13 Disk Storage, Basic File Structures, and Hashing Copyright 2007 Ramez Elmasri and Shamkant B. Navathe Chapter Outline Disk Storage Devices Files of Records Operations on Files Unordered Files

### CSE 326, Data Structures. Sample Final Exam. Problem Max Points Score 1 14 (2x7) 2 18 (3x6) 3 4 4 7 5 9 6 16 7 8 8 4 9 8 10 4 Total 92.

Name: Email ID: CSE 326, Data Structures Section: Sample Final Exam Instructions: The exam is closed book, closed notes. Unless otherwise stated, N denotes the number of elements in the data structure

### Big Data & Scripting storage networks and distributed file systems

Big Data & Scripting storage networks and distributed file systems 1, 2, in the remainder we use networks of computing nodes to enable computations on even larger datasets for a computation, each node

### Datenbanksysteme II: Hashing. Ulf Leser

Datenbanksysteme II: Hashing Ulf Leser Content of this Lecture Hashing Extensible Hashing Linear Hashing Ulf Leser: Implementation of Database Systems, Winter Semester 2012/2013 2 Sorting or Hashing Sorted

### Sample Questions Csci 1112 A. Bellaachia

Sample Questions Csci 1112 A. Bellaachia Important Series : o S( N) 1 2 N N i N(1 N) / 2 i 1 o Sum of squares: N 2 N( N 1)(2N 1) N i for large N i 1 6 o Sum of exponents: N k 1 k N i for large N and k

### Binary Heap Algorithms

CS Data Structures and Algorithms Lecture Slides Wednesday, April 5, 2009 Glenn G. Chappell Department of Computer Science University of Alaska Fairbanks CHAPPELLG@member.ams.org 2005 2009 Glenn G. Chappell

### Cpt S 223. School of EECS, WSU

Priority Queues (Heaps) 1 Motivation Queues are a standard mechanism for ordering tasks on a first-come, first-served basis However, some tasks may be more important or timely than others (higher priority)

### - Easy to insert & delete in O(1) time - Don t need to estimate total memory needed. - Hard to search in less than O(n) time

Skip Lists CMSC 420 Linked Lists Benefits & Drawbacks Benefits: - Easy to insert & delete in O(1) time - Don t need to estimate total memory needed Drawbacks: - Hard to search in less than O(n) time (binary

### root node level: internal node edge leaf node CS@VT Data Structures & Algorithms 2000-2009 McQuain

inary Trees 1 A binary tree is either empty, or it consists of a node called the root together with two binary trees called the left subtree and the right subtree of the root, which are disjoint from each

### Binary Number System. 16. Binary Numbers. Base 10 digits: 0 1 2 3 4 5 6 7 8 9. Base 2 digits: 0 1

Binary Number System 1 Base 10 digits: 0 1 2 3 4 5 6 7 8 9 Base 2 digits: 0 1 Recall that in base 10, the digits of a number are just coefficients of powers of the base (10): 417 = 4 * 10 2 + 1 * 10 1

### Big Data & Scripting Part II Streaming Algorithms

Big Data & Scripting Part II Streaming Algorithms 1, Counting Distinct Elements 2, 3, counting distinct elements problem formalization input: stream of elements o from some universe U e.g. ids from a set

### Chapter 13. Disk Storage, Basic File Structures, and Hashing

Chapter 13 Disk Storage, Basic File Structures, and Hashing Chapter Outline Disk Storage Devices Files of Records Operations on Files Unordered Files Ordered Files Hashed Files Dynamic and Extendible Hashing

### Quiz 1 Solutions. (a) T F The height of any binary search tree with n nodes is O(log n). Explain:

Introduction to Algorithms March 9, 2011 Massachusetts Institute of Technology 6.006 Spring 2011 Professors Erik Demaine, Piotr Indyk, and Manolis Kellis Quiz 1 Solutions Problem 1. Quiz 1 Solutions True

### Quiz 4 Solutions EECS 211: FUNDAMENTALS OF COMPUTER PROGRAMMING II. 1 Q u i z 4 S o l u t i o n s

Quiz 4 Solutions Q1: What value does function mystery return when called with a value of 4? int mystery ( int number ) { if ( number

### , each of which contains a unique key value, say k i , R 2. such that k i equals K (or to determine that no such record exists in the collection).

The Search Problem 1 Suppose we have a collection of records, say R 1, R 2,, R N, each of which contains a unique key value, say k i. Given a particular key value, K, the search problem is to locate the

### RSA Question 2. Bob thinks that p and q are primes but p isn t. Then, Bob thinks Φ Bob :=(p-1)(q-1) = φ(n). Is this true?

RSA Question 2 Bob thinks that p and q are primes but p isn t. Then, Bob thinks Φ Bob :=(p-1)(q-1) = φ(n). Is this true? Bob chooses a random e (1 < e < Φ Bob ) such that gcd(e,φ Bob )=1. Then, d = e -1

### Chapter 13: Query Processing. Basic Steps in Query Processing

Chapter 13: Query Processing! Overview! Measures of Query Cost! Selection Operation! Sorting! Join Operation! Other Operations! Evaluation of Expressions 13.1 Basic Steps in Query Processing 1. Parsing

### Copyright 2007 Ramez Elmasri and Shamkant B. Navathe. Slide 13-1

Slide 13-1 Chapter 13 Disk Storage, Basic File Structures, and Hashing Chapter Outline Disk Storage Devices Files of Records Operations on Files Unordered Files Ordered Files Hashed Files Dynamic and Extendible

### Discrete Math in Computer Science Homework 7 Solutions (Max Points: 80)

Discrete Math in Computer Science Homework 7 Solutions (Max Points: 80) CS 30, Winter 2016 by Prasad Jayanti 1. (10 points) Here is the famous Monty Hall Puzzle. Suppose you are on a game show, and you

### INTRODUCTION The collection of data that makes up a computerized database must be stored physically on some computer storage medium.

Chapter 4: Record Storage and Primary File Organization 1 Record Storage and Primary File Organization INTRODUCTION The collection of data that makes up a computerized database must be stored physically

### Chapter 13 Disk Storage, Basic File Structures, and Hashing.

Chapter 13 Disk Storage, Basic File Structures, and Hashing. Copyright 2004 Pearson Education, Inc. Chapter Outline Disk Storage Devices Files of Records Operations on Files Unordered Files Ordered Files

### Faster deterministic integer factorisation

David Harvey (joint work with Edgar Costa, NYU) University of New South Wales 25th October 2011 The obvious mathematical breakthrough would be the development of an easy way to factor large prime numbers

### Binary Search. Search for x in a sorted array A.

Divide and Conquer A general paradigm for algorithm design; inspired by emperors and colonizers. Three-step process: 1. Divide the problem into smaller problems. 2. Conquer by solving these problems. 3.

### Anti-persistence: History Independent Data Structures

Anti-persistence: History Independent Data Structures Moni Naor Vanessa Teague Dept. of Computer Science and Applied Math Dept. of Computer Science Weizmann Institute Stanford University naor@wisdom.weizmann.ac.il

### LSN 2 Number Systems. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology

LSN 2 Number Systems Department of Engineering Technology LSN 2 Decimal Number System Decimal number system has 10 digits (0-9) Base 10 weighting system... 10 5 10 4 10 3 10 2 10 1 10 0. 10-1 10-2 10-3

Family Name:... First Name:... Section:... Advanced Cryptography Final Exam July 18 th, 2006 Start at 9:15, End at 12:00 This document consists of 12 pages. Instructions Electronic devices are not allowed.

### Merkle Hash Trees for Distributed Audit Logs

Merkle Hash Trees for Distributed Audit Logs Subject proposed by Karthikeyan Bhargavan Karthikeyan.Bhargavan@inria.fr April 7, 2015 Modern distributed systems spread their databases across a large number

### 12.0 Statistical Graphics and RNG

12.0 Statistical Graphics and RNG 1 Answer Questions Statistical Graphics Random Number Generators 12.1 Statistical Graphics 2 John Snow helped to end the 1854 cholera outbreak through use of a statistical

### A Survey on Efficient Hashing Techniques in Software Configuration Management

A Survey on Efficient Hashing Techniques in Software Configuration Management Bernhard Grill Vienna University of Technology Vienna, Austria Email: e1028282@student.tuwien.ac.at Abstract This paper presents

### U.C. Berkeley CS276: Cryptography Handout 0.1 Luca Trevisan January, 2009. Notes on Algebra

U.C. Berkeley CS276: Cryptography Handout 0.1 Luca Trevisan January, 2009 Notes on Algebra These notes contain as little theory as possible, and most results are stated without proof. Any introductory

### Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay

Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay Lecture - 17 Shannon-Fano-Elias Coding and Introduction to Arithmetic Coding

### Elementary factoring algorithms

Math 5330 Spring 013 Elementary factoring algorithms The RSA cryptosystem is founded on the idea that, in general, factoring is hard. Where as with Fermat s Little Theorem and some related ideas, one can

### APP INVENTOR. Test Review

APP INVENTOR Test Review Main Concepts App Inventor Lists Creating Random Numbers Variables Searching and Sorting Data Linear Search Binary Search Selection Sort Quick Sort Abstraction Modulus Division

### Analysis of Algorithms I: Binary Search Trees

Analysis of Algorithms I: Binary Search Trees Xi Chen Columbia University Hash table: A data structure that maintains a subset of keys from a universe set U = {0, 1,..., p 1} and supports all three dictionary

### Chapter 6: Physical Database Design and Performance. Database Development Process. Physical Design Process. Physical Database Design

Chapter 6: Physical Database Design and Performance Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred R. McFadden Robert C. Nickerson ISYS 464 Spring 2003 Topic 23 Database

### Algorithms and Data Structures

Algorithm Analysis Page 1 BFH-TI: Softwareschule Schweiz Algorithm Analysis Dr. CAS SD01 Algorithm Analysis Page 2 Outline Course and Textbook Overview Analysis of Algorithm Pseudo-Code and Primitive Operations

### CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis. Linda Shapiro Winter 2015

CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis Linda Shapiro Today Registration should be done. Homework 1 due 11:59 pm next Wednesday, January 14 Review math essential

### 2013 Five years Integrated M.Sc.(IT) Semester 1 060010101 - Fundamentals of Programming

03 Five years Integrated M.Sc.(IT) Semester 00000 - Fundamentals Programming File should contain. Problem Statement. Algorithm 3. Flowchart. Program in C language(code) 5. Output and sample calculation

### MODULAR ARITHMETIC. a smallest member. It is equivalent to the Principle of Mathematical Induction.

MODULAR ARITHMETIC 1 Working With Integers The usual arithmetic operations of addition, subtraction and multiplication can be performed on integers, and the result is always another integer Division, on

### MLR Institute of Technology

MLR Institute of Technology DUNDIGAL 500 043, HYDERABAD COMPUTER SCIENCE AND ENGINEERING Computer Programming Lab List of Experiments S.No. Program Category List of Programs 1 Operators a) Write a C program

### I. Introduction. MPRI Cours 2-12-2. Lecture IV: Integer factorization. What is the factorization of a random number? II. Smoothness testing. F.

F. Morain École polytechnique MPRI cours 2-12-2 2013-2014 3/22 F. Morain École polytechnique MPRI cours 2-12-2 2013-2014 4/22 MPRI Cours 2-12-2 I. Introduction Input: an integer N; logox F. Morain logocnrs

### Chapter 3. if 2 a i then location: = i. Page 40

Chapter 3 1. Describe an algorithm that takes a list of n integers a 1,a 2,,a n and finds the number of integers each greater than five in the list. Ans: procedure greaterthanfive(a 1,,a n : integers)

### Display Format To change the exponential display format, press the [MODE] key 3 times.

Tools FX 300 MS Calculator Overhead OH 300 MS Handouts Other materials Applicable activities Activities for the Classroom FX-300 Scientific Calculator Quick Reference Guide (inside the calculator cover)

### Ex. 2.1 (Davide Basilio Bartolini)

ECE 54: Elements of Information Theory, Fall 00 Homework Solutions Ex.. (Davide Basilio Bartolini) Text Coin Flips. A fair coin is flipped until the first head occurs. Let X denote the number of flips

### Lecture 1: Data Storage & Index

Lecture 1: Data Storage & Index R&G Chapter 8-11 Concurrency control Query Execution and Optimization Relational Operators File & Access Methods Buffer Management Disk Space Management Recovery Manager

### The Steepest Descent Algorithm for Unconstrained Optimization and a Bisection Line-search Method

The Steepest Descent Algorithm for Unconstrained Optimization and a Bisection Line-search Method Robert M. Freund February, 004 004 Massachusetts Institute of Technology. 1 1 The Algorithm The problem

### Factoring Algorithms

Institutionen för Informationsteknologi Lunds Tekniska Högskola Department of Information Technology Lund University Cryptology - Project 1 Factoring Algorithms The purpose of this project is to understand

### Analysis of a Search Algorithm

CSE 326 Lecture 4: Lists and Stacks 1. Agfgd 2. Dgsdsfd 3. Hdffdsf 4. Sdfgsfdg 5. Tefsdgass We will review: Analysis: Searching a sorted array (from last time) List ADT: Insert, Delete, Find, First, Kth,

### DNS LOOKUP SYSTEM DATA STRUCTURES AND ALGORITHMS PROJECT REPORT

DNS LOOKUP SYSTEM DATA STRUCTURES AND ALGORITHMS PROJECT REPORT By GROUP Avadhut Gurjar Mohsin Patel Shraddha Pandhe Page 1 Contents 1. Introduction... 3 2. DNS Recursive Query Mechanism:...5 2.1. Client

### Breaking The Code. Ryan Lowe. Ryan Lowe is currently a Ball State senior with a double major in Computer Science and Mathematics and

Breaking The Code Ryan Lowe Ryan Lowe is currently a Ball State senior with a double major in Computer Science and Mathematics and a minor in Applied Physics. As a sophomore, he took an independent study

### A First Book of C++ Chapter 2 Data Types, Declarations, and Displays

A First Book of C++ Chapter 2 Data Types, Declarations, and Displays Objectives In this chapter, you will learn about: Data Types Arithmetic Operators Variables and Declarations Common Programming Errors

### arxiv:1112.0829v1 [math.pr] 5 Dec 2011

How Not to Win a Million Dollars: A Counterexample to a Conjecture of L. Breiman Thomas P. Hayes arxiv:1112.0829v1 [math.pr] 5 Dec 2011 Abstract Consider a gambling game in which we are allowed to repeatedly

### DATABASE DESIGN - 1DL400

DATABASE DESIGN - 1DL400 Spring 2015 A course on modern database systems!! http://www.it.uu.se/research/group/udbl/kurser/dbii_vt15/ Kjell Orsborn! Uppsala Database Laboratory! Department of Information

### Class Overview. CSE 326: Data Structures. Goals. Goals. Data Structures. Goals. Introduction

Class Overview CSE 326: Data Structures Introduction Introduction to many of the basic data structures used in computer software Understand the data structures Analyze the algorithms that use them Know

### Vimal P.Parmar Research Scholar, Department of Computer Science Saurashtra University, Rajkot Gujarat, INDIA

Comparing Linear Search and Binary Search Algorithms to Search an Element from a Linear List Implemented through Static Array, Dynamic Array and Linked List Vimal P.Parmar Research Scholar, Department

### Linear Codes. Chapter 3. 3.1 Basics

Chapter 3 Linear Codes In order to define codes that we can encode and decode efficiently, we add more structure to the codespace. We shall be mainly interested in linear codes. A linear code of length

### Lecture 13: Factoring Integers

CS 880: Quantum Information Processing 0/4/0 Lecture 3: Factoring Integers Instructor: Dieter van Melkebeek Scribe: Mark Wellons In this lecture, we review order finding and use this to develop a method

### Bounded Cost Algorithms for Multivalued Consensus Using Binary Consensus Instances

Bounded Cost Algorithms for Multivalued Consensus Using Binary Consensus Instances Jialin Zhang Tsinghua University zhanggl02@mails.tsinghua.edu.cn Wei Chen Microsoft Research Asia weic@microsoft.com Abstract

### Speedy Signature Based Intrusion Detection System Using Finite State Machine and Hashing Techniques

www.ijcsi.org 387 Speedy Signature Based Intrusion Detection System Using Finite State Machine and Hashing Techniques Utkarsh Dixit 1, Shivali Gupta 2 and Om Pal 3 1 School of Computer Science, Centre

### Integer Factorization using the Quadratic Sieve

Integer Factorization using the Quadratic Sieve Chad Seibert* Division of Science and Mathematics University of Minnesota, Morris Morris, MN 56567 seib0060@morris.umn.edu March 16, 2011 Abstract We give

### 1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++

Answer the following 1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++ 2) Which data structure is needed to convert infix notations to postfix notations? Stack 3) The

### Chapter 6: Episode discovery process

Chapter 6: Episode discovery process Algorithmic Methods of Data Mining, Fall 2005, Chapter 6: Episode discovery process 1 6. Episode discovery process The knowledge discovery process KDD process of analyzing

### The Goldberg Rao Algorithm for the Maximum Flow Problem

The Goldberg Rao Algorithm for the Maximum Flow Problem COS 528 class notes October 18, 2006 Scribe: Dávid Papp Main idea: use of the blocking flow paradigm to achieve essentially O(min{m 2/3, n 1/2 }

### THE NUMBER OF REPRESENTATIONS OF n OF THE FORM n = x 2 2 y, x > 0, y 0

THE NUMBER OF REPRESENTATIONS OF n OF THE FORM n = x 2 2 y, x > 0, y 0 RICHARD J. MATHAR Abstract. We count solutions to the Ramanujan-Nagell equation 2 y +n = x 2 for fixed positive n. The computational

### Gambling and Data Compression

Gambling and Data Compression Gambling. Horse Race Definition The wealth relative S(X) = b(x)o(x) is the factor by which the gambler s wealth grows if horse X wins the race, where b(x) is the fraction

### Why you shouldn't use set (and what you should use instead) Matt Austern

Why you shouldn't use set (and what you should use instead) Matt Austern Everything in the standard C++ library is there for a reason, but it isn't always obvious what that reason is. The standard isn't

### A Comparison of Dictionary Implementations

A Comparison of Dictionary Implementations Mark P Neyer April 10, 2009 1 Introduction A common problem in computer science is the representation of a mapping between two sets. A mapping f : A B is a function

### a 11 x 1 + a 12 x 2 + + a 1n x n = b 1 a 21 x 1 + a 22 x 2 + + a 2n x n = b 2.

Chapter 1 LINEAR EQUATIONS 1.1 Introduction to linear equations A linear equation in n unknowns x 1, x,, x n is an equation of the form a 1 x 1 + a x + + a n x n = b, where a 1, a,..., a n, b are given

### CS104: Data Structures and Object-Oriented Design (Fall 2013) October 24, 2013: Priority Queues Scribes: CS 104 Teaching Team

CS104: Data Structures and Object-Oriented Design (Fall 2013) October 24, 2013: Priority Queues Scribes: CS 104 Teaching Team Lecture Summary In this lecture, we learned about the ADT Priority Queue. A

### File System Management

Lecture 7: Storage Management File System Management Contents Non volatile memory Tape, HDD, SSD Files & File System Interface Directories & their Organization File System Implementation Disk Space Allocation

### CSC148 Lecture 8. Algorithm Analysis Binary Search Sorting

CSC148 Lecture 8 Algorithm Analysis Binary Search Sorting Algorithm Analysis Recall definition of Big Oh: We say a function f(n) is O(g(n)) if there exists positive constants c,b such that f(n)

### Why? A central concept in Computer Science. Algorithms are ubiquitous.

Analysis of Algorithms: A Brief Introduction Why? A central concept in Computer Science. Algorithms are ubiquitous. Using the Internet (sending email, transferring files, use of search engines, online

### Computer and Network Security

MIT 6.857 Computer and Networ Security Class Notes 1 File: http://theory.lcs.mit.edu/ rivest/notes/notes.pdf Revision: December 2, 2002 Computer and Networ Security MIT 6.857 Class Notes by Ronald L. Rivest

### H/wk 13, Solutions to selected problems

H/wk 13, Solutions to selected problems Ch. 4.1, Problem 5 (a) Find the number of roots of x x in Z 4, Z Z, any integral domain, Z 6. (b) Find a commutative ring in which x x has infinitely many roots.