Lec3_DP

Lec3_DP - 1 / 9 / 1 C O T 6 9 3 6 1 E x a m p l e • [ , 6...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 / 9 / 1 C O T 6 9 3 6 1 E x a m p l e • [ , 6 ] , [ 1 , 4 ] , [ 2 , 1 3 ] , [ 3 , 5 ] , [ 3 , 8 ] , [ 5 , 7 ] , [ 5 , 9 ] , [ 6 , 1 ] , [ 8 , 1 1 ] , [ 8 , 1 2 ] , [ 1 2 , 1 4 ] • S i m p l e G r e e d y S e l e c t i o n – S o r t b y s t a r t t i m e a n d p i c k i n “ g r e e d y ” f a s h i o n – D o e s n o t w o r k . W H Y ? • [ , 6 ] , [ 6 , 1 ] i s t h e s o l u t i o n y o u w i l l e n d u p w i t h . • O t h e r g r e e d y s t r a t e g i e s – S o r t b y l e n g t h o f i n t e r v a l – D o e s n o t w o r k . W H Y ? 1 / 9 / 1 C O T 6 9 3 6 2 E x a m p l e • [ , 6 ] , [ 1 , 4 ] , [ 2 , 1 3 ] , [ 3 , 5 ] , [ 3 , 8 ] , [ 5 , 7 ] , [ 5 , 9 ] , [ 6 , 1 ] , [ 8 , 1 1 ] , [ 8 , 1 2 ] , [ 1 2 , 1 4 ] • [ 1 , 4 ] , [ 3 , 5 ] , [ , 6 ] , [ 5 , 7 ] , [ 3 , 8 ] , [ 5 , 9 ] , [ 6 , 1 ] , [ 8 , 1 1 ] , [ 8 , 1 2 ] , [ 2 , 1 3 ] , [ 1 2 , 1 4 ]-- S o r t e d b y f i n i s h t i m e s • [ 1 , 4 ] , [ 3 , 5 ] , [ , 6 ] , [ 5 , 7 ] , [ 3 , 8 ] , [ 5 , 9 ] , [ 6 , 1 ] , [ 8 , 1 1 ] , [ 8 , 1 2 ] , [ 2 , 1 3 ] , [ 1 2 , 1 4 ] • [ 1 , 4 ] , [ 3 , 5 ] , [ , 6 ] , [ 5 , 7 ] , [ 3 , 8 ] , [ 5 , 9 ] , [ 6 , 1 ] , [ 8 , 1 1 ] , [ 8 , 1 2 ] , [ 2 , 1 3 ] , [ 1 2 , 1 4 ] • [ 1 , 4 ] , [ 3 , 5 ] , [ , 6 ] , [ 5 , 7 ] , [ 3 , 8 ] , [ 5 , 9 ] , [ 6 , 1 ] , [ 8 , 1 1 ] , [ 8 , 1 2 ] , [ 2 , 1 3 ] , [ 1 2 , 1 4 ] • [ 1 , 4 ] , [ 3 , 5 ] , [ , 6 ] , [ 5 , 7 ] , [ 3 , 8 ] , [ 5 , 9 ] , [ 6 , 1 ] , [ 8 , 1 1 ] , [ 8 , 1 2 ] , [ 2 , 1 3 ] , [ 1 2 , 1 4 ] • [ 1 , 4 ] , [ 3 , 5 ] , [ , 6 ] , [ 5 , 7 ] , [ 3 , 8 ] , [ 5 , 9 ] , [ 6 , 1 ] , [ 8 , 1 1 ] , [ 8 , 1 2 ] , [ 2 , 1 3 ] , [ 1 2 , 1 4 ] 1 / 9 / 1 C O T 6 9 3 6 3 G r e e d y A l g o r i t h m s • G i v e n a s e t o f a c t i v i t i e s ( s i , f i ) , w e w a n t t o s c h e d u l e t h e m a x i m u m n u m b e r o f n o n- o v e r l a p p i n g a c t i v i t i e s . • G R E E D Y- A C T I V I T Y- S E L E C T O R ( s , f ) 1 . n = l e n g t h [ s ] 2 . S = { a 1 } 3 . i = 1 4 . f o r m = 2 t o n d o 5 . i f s m i s n o t b e f o r e f i t h e n 6 . S = S U { a m } 7 . i = m 8 . r e t u r n S 1 / 9 / 1 C O T 6 9 3 6 4 W h y d o e s i t w o r k ? • T H E O R E M L e t A b e a s e t o f a c t i v i t i e s a n d l e t a 1 b e t h e a c t i v i t y w i t h t h e e a r l i e s t f i n i s h t i m e . T h e n a c t i v i t y a 1 i s i n s o m e m a x i m u m- s i z e d s u b s e t o f n o n- o v e r l a p p i n g a c t i v i t i e s . • P R O O F L e t S ’ b e a s o l u t i o n t h a t d o e s n o t c o n t a i n a 1 . L e t a ’ 1 b e t h e a c t i v i t y w i t h t h e e a r l i e s t f i n i s h t i m e i n S ’ . T h e n r e p l a c i n g a ’ 1 b y a 1 g i v e s a s o l u t i o n S o f t h e s a m e s i z e ....
View Full Document

This note was uploaded on 02/18/2012 for the course CIS 6936 taught by Professor Giri during the Spring '12 term at FIU.

Page1 / 22

Lec3_DP - 1 / 9 / 1 C O T 6 9 3 6 1 E x a m p l e • [ , 6...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online