Exercise 1.1(Paid Exchanges Necessary) Consider the three-element list with the following initial configuration: (i.e. x1 is at the front). Prove that.

Slides:



Advertisements
Similar presentations
A Primal-Dual Approach to Online Optimization Problems.
Advertisements

CSE 4101/5101 Prof. Andy Mirzaian. Lists Move-to-Front Search Trees Binary Search Trees Multi-Way Search Trees B-trees Splay Trees Trees Red-Black.
Knapsack Problem Section 7.6. Problem Suppose we have n items U={u 1,..u n }, that we would like to insert into a knapsack of size C. Each item u i has.
PREFIXSPAN ALGORITHM Mining Sequential Patterns Efficiently by Prefix- Projected Pattern Growth
CS223 Advanced Data Structures and Algorithms 1 Greedy Algorithms Neil Tang 4/8/2010.
On the Competitiveness of Self Organizing Linear Search J. Ian Munro (University of Waterloo) Competitiveness: How well does an on line algorithm do in.
Copyright © 2009 Curt Hill Self Organizing Lists Another form of searchable list.
Text Chapters 1, 2. Sorting ä Sorting Problem: ä Input: A sequence of n numbers ä Output: A permutation (reordering) of the input sequence such that:
Exercise Exercise3.1 8 Exercise3.1 9 Exercise
1 Class Constrained Packing We need to pack items into bins. All the bins have the same capacity. Each bin can accommodate items from a bounded number.
Online Algorithms Motivation and Definitions Paging Problem Competitive Analysis Online Load Balancing.
Exercise Exercise Exercise Exercise
Exercise Exercise Exercise Exercise
Exercise Exercise6.1 7 Exercise6.1 8 Exercise6.1 9.
Objectives Learn how to implement the sequential search algorithm Explore how to sort an array using the selection sort algorithm Learn how to implement.
CSE 421 Algorithms Richard Anderson Lecture 6 Greedy Algorithms.
Discrete Math CSC151 Analysis of Algorithms. Complexity of Algorithms  In CS it's important to be able to predict how many resources an algorithm will.
Dynamic Programming -Solutions (a) Dynamic programming requires that future decisions depend only on optimal ways to reach prior states. This will.
Evaluation of Algorithms for the List Update Problem Suporn Pongnumkul R. Ravi Kedar Dhamdhere.
Sorting Networks Uri Zwick Tel Aviv University May 2015.
Binary search trees Definition Binary search trees and dynamic set operations Balanced binary search trees –Tree rotations –Red-black trees Move to front.
Sorting Example Insertion Sort. Insertion Sort Sorting problem: n Given an array of N integers, rearrange them so that they are in increasing order. Insertion.
Sort an array - the selection sort algorithm. Selection Sort Selection sort a classic computer algorithm that is used to sort an array The selection sort.
Fall 2013 Instructor: Reza Entezari-Maleki Sharif University of Technology 1 Fundamentals of Programming Session 17 These.
Basic Math Skills Lesson 10: Sales Tax p
EXAMPLE 4 Find a unit rate A car travels 110 miles in 2 hours. Find the unit rate. 110 miles 2 hours = 1 hour 55 miles 2 hours miles 2 = The unit.
9/8/10 A. Smith; based on slides by E. Demaine, C. Leiserson, S. Raskhodnikova, K. Wayne Adam Smith Algorithm Design and Analysis L ECTURE 6 Greedy Algorithms.
Fall 2013 Instructor: Reza Entezari-Maleki Sharif University of Technology 1 Fundamentals of Programming Session 17 These.
Multiplying and Dividing Decimals Lesson Sara spent $3.44 at one store and $6.89 at another store. How much did she spend in all? 2. Lars gave the.
CS 162 Intro to Programming II Searching 1. Data is stored in various structures – Typically it is organized on the type of data – Optimized for retrieval.
Bill Payment Optimization Algorithms. Purpose To find and/or construct algorithms that will optimize the decision process of paying bills from an account.
Sigma Notation A compact way of defining a series A series is the sum of a sequence.
Bubble Sort. Bubble Sort Example 9, 6, 2, 12, 11, 9, 3, 7 6, 9, 2, 12, 11, 9, 3, 7 6, 2, 9, 12, 11, 9, 3, 7 6, 2, 9, 11, 12, 9, 3, 7 6, 2, 9, 11, 9, 12,
CSE 5314 On-line Computation Homework 1 Wook Choi Feb/26/2004.
Greedy Algorithms. What is “Greedy Algorithm” Optimization problem usually goes through a sequence of steps A greedy algorithm makes the choice looks.
Warm-Up Find the value of each expression − (1.9) ÷ 0.3 Which One Doesn’t Belong? (Include your reasoning…)
Introduction to the k-Server Problem Marcel Birkner.
David Luebke 1 2/26/2016 CS 332: Algorithms Dynamic Programming.
CSE 421 Algorithms Richard Anderson Lecture 8 Optimal Caching Dijkstra’s algorithm.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 10.
CSE 421 Algorithms Richard Anderson Lecture 8 Greedy Algorithms: Homework Scheduling and Optimal Caching.
CSE 5314 – Spring 2004 Homework #1 - Solutions [Soumya Sanyal] Q 1.5: Prove that the algorithm “MTF every-other-access” (i.e. move the item to the front.
Lecture 2 Algorithm Analysis
PRINTER TECH SUPPORT To get best solutions you can
Binary search trees Definition
Exercise 3.10 Prove Theorem 3.8 R(ALG) >= k(s+1)/(k+s) Solution:
Auburn University COMP7330/7336 Advanced Parallel and Distributed Computing Parallel Odd-Even Sort Algorithm Dr. Xiao.
Stacks and Queues.
Static Optimality and Dynamic Search Optimality in Lists and Trees
Optimal Sorting Algorithms for Parallel Computers
Exercise Exercise Proof that
Call On Toll-Free We Serve for 24*7 hours.
BACK SOLUTION:
Transposons and Mechanisms of Transposition
Bubble, Selection & Insertion sort
Greedy Algorithms / Caching Problem Yin Tat Lee
Richard Anderson Autumn 2015 Lecture 8 – Greedy Algorithms II
Greedy Algorithms: Homework Scheduling and Optimal Caching
ورود اطلاعات بصورت غيربرخط
Greedy Algorithms / Caching Problem Yin Tat Lee
Searching and Sorting Arrays
Insertion Sort Demo Sorting problem:
Richard Anderson Winter 2019 Lecture 8 – Greedy Algorithms II
CE 221 Data Structures and Algorithms
Presents a preliminary view of sorting algorithms
7. Ford-Fulkerson Algorithm with multiple optimal solutions
Exercise (11).
Exercise 2.3 Use Theorem 2.1 to prove that R(BIT)
Solution Free Body Diagram.
Presentation transcript:

Exercise 1.1(Paid Exchanges Necessary) Consider the three-element list with the following initial configuration: (i.e. x1 is at the front). Prove that the optimal offline cost to serve the request sequence x3,x2,x3,x2 is 8. Now consider an optimal offline algorithm without paid exchanges and prove that it pays 9 to serve the same sequence. Solution: Transpositions: After accessing or inserting an item in the list, we allow this item to be moved free of charge to any location closer to the front of list. These transpositions are called free transpositions. All other transpositions are paid transpositions and cost 1 each. Optimal offline algorithm allows for us to know the entire request sequence prior to servicing any request.

Initial Configuration: and Request Sequence: x3,x2,x3,x2 1) Allowing Paid Exchanges: a) Request for x3 Paid exchange of x1 with x2 => cost = 1 New Configuration: Paid exchange of x1 with x3 => cost = 1 New Configuration: Access x3 => cost = 2 b) Request for x2 Access x2 => cost = 1 c) Request for x3 Access x3 => cost = 2 d) Request for x2 Access x2 => cost = 1 Total cost = = 8

Initial Configuration: and Request Sequence: x3,x2,x3,x2 2) No Paid Exchanges: a) Request for x3 Step 1: Access x3 => cost = 3 Step 2: Move x3 to the front => cost = 0 (free transposition) New Configuration: b) Request for x2 Step 1: Access x2 => cost = 3 Step 2: Move x2 to the front => cost = 0 (free transposition) New Configuration: c) Request for x3 Access x3 => cost = 2 d) Request for x2 Access x2 => cost = 1 Total cost = = 9