🗊 Презентация Two pointers method

Нажмите для полного просмотра!
Two pointers method, слайд №1 Two pointers method, слайд №2 Two pointers method, слайд №3 Two pointers method, слайд №4 Two pointers method, слайд №5 Two pointers method, слайд №6 Two pointers method, слайд №7 Two pointers method, слайд №8 Two pointers method, слайд №9 Two pointers method, слайд №10 Two pointers method, слайд №11 Two pointers method, слайд №12 Two pointers method, слайд №13 Two pointers method, слайд №14 Two pointers method, слайд №15 Two pointers method, слайд №16 Two pointers method, слайд №17 Two pointers method, слайд №18 Two pointers method, слайд №19 Two pointers method, слайд №20 Two pointers method, слайд №21 Two pointers method, слайд №22 Two pointers method, слайд №23 Two pointers method, слайд №24 Two pointers method, слайд №25 Two pointers method, слайд №26 Two pointers method, слайд №27 Two pointers method, слайд №28 Two pointers method, слайд №29 Two pointers method, слайд №30 Two pointers method, слайд №31 Two pointers method, слайд №32 Two pointers method, слайд №33 Two pointers method, слайд №34 Two pointers method, слайд №35 Two pointers method, слайд №36 Two pointers method, слайд №37 Two pointers method, слайд №38

Вы можете ознакомиться и скачать презентацию на тему Two pointers method. Доклад-сообщение содержит 38 слайдов. Презентации для любого класса можно скачать бесплатно. Если материал и наш сайт презентаций Mypresentation Вам понравились – поделитесь им с друзьями с помощью социальных кнопок и добавьте в закладки в своем браузере.

Слайды и текст этой презентации


Слайд 1


TWO POINTERS METHOD Lyzhin Ivan, 2016
Описание слайда:
TWO POINTERS METHOD Lyzhin Ivan, 2016

Слайд 2


Problem There is array A with N positive integers. Segment of array – a sequence of one or more consecutive elements in array. D-good segment –...
Описание слайда:
Problem There is array A with N positive integers. Segment of array – a sequence of one or more consecutive elements in array. D-good segment – segment, in which sum of elements not greater than D. Count the pairs (L, R) such that segment [L, R] of array A is D-good.

Слайд 3


1. Very primitive solution Sum elements for each pair (L, R).
Описание слайда:
1. Very primitive solution Sum elements for each pair (L, R).

Слайд 4


2. Primitive solution Notice that sum(L, R) = sum(L, R-1)+A[R] If sum(L, R1)>D then sum(L, R2)>D for each R2>R1
Описание слайда:
2. Primitive solution Notice that sum(L, R) = sum(L, R-1)+A[R] If sum(L, R1)>D then sum(L, R2)>D for each R2>R1

Слайд 5


3. Good solution Notice that it’s enough to find maxR(L) = max(R) such sum(L, R)D for each R’>R. We can precompute prefix sums and than find maxR by...
Описание слайда:
3. Good solution Notice that it’s enough to find maxR(L) = max(R) such sum(L, R)D for each R’>R. We can precompute prefix sums and than find maxR by binary search.

Слайд 6


3. Good solution
Описание слайда:
3. Good solution

Слайд 7


4. Best solution Notice that maxR(L)>=maxR(L-1). So we can start finding maxR(L) from maxR(L-1). In this way out pointer R goes only forward.
Описание слайда:
4. Best solution Notice that maxR(L)>=maxR(L-1). So we can start finding maxR(L) from maxR(L-1). In this way out pointer R goes only forward.

Слайд 8


Tracing, step 0
Описание слайда:
Tracing, step 0

Слайд 9


Tracing, step 1
Описание слайда:
Tracing, step 1

Слайд 10


Tracing, step 2
Описание слайда:
Tracing, step 2

Слайд 11


Tracing, step 3
Описание слайда:
Tracing, step 3

Слайд 12


Tracing, step 4
Описание слайда:
Tracing, step 4

Слайд 13


Tracing, step 5
Описание слайда:
Tracing, step 5

Слайд 14


Tracing, step 6
Описание слайда:
Tracing, step 6

Слайд 15


Tracing, step 7
Описание слайда:
Tracing, step 7

Слайд 16


Tracing, step 8
Описание слайда:
Tracing, step 8

Слайд 17


Tracing, step 9
Описание слайда:
Tracing, step 9

Слайд 18


Tracing, step 10
Описание слайда:
Tracing, step 10

Слайд 19


Tracing, step 11
Описание слайда:
Tracing, step 11

Слайд 20


Tracing, step 12
Описание слайда:
Tracing, step 12

Слайд 21


Tracing, step 13
Описание слайда:
Tracing, step 13

Слайд 22


Tracing, step 14
Описание слайда:
Tracing, step 14

Слайд 23


Tracing, step 15
Описание слайда:
Tracing, step 15

Слайд 24


Tracing, step 16
Описание слайда:
Tracing, step 16

Слайд 25


Tracing, step 17
Описание слайда:
Tracing, step 17

Слайд 26


Tracing, step 18
Описание слайда:
Tracing, step 18

Слайд 27


Tracing, step 19
Описание слайда:
Tracing, step 19

Слайд 28


Tracing, step 20
Описание слайда:
Tracing, step 20

Слайд 29


Tracing, step 21
Описание слайда:
Tracing, step 21

Слайд 30


Tracing, step 22
Описание слайда:
Tracing, step 22

Слайд 31


Tracing, step 23
Описание слайда:
Tracing, step 23

Слайд 32


Tracing, step 24
Описание слайда:
Tracing, step 24

Слайд 33


Tracing, step 25
Описание слайда:
Tracing, step 25

Слайд 34


Tracing, step 26
Описание слайда:
Tracing, step 26

Слайд 35


Tracing, step 27
Описание слайда:
Tracing, step 27

Слайд 36


Tracing, step 28
Описание слайда:
Tracing, step 28

Слайд 37


Other examples There are 2 sorted arrays of integers: A and B. Count pairs (i, j) such that A[i]=B[j]. There are N points on circle. Find two points...
Описание слайда:
Other examples There are 2 sorted arrays of integers: A and B. Count pairs (i, j) such that A[i]=B[j]. There are N points on circle. Find two points such that distance between them is maximal. There are N points on circle. Find three points such that area of triangle is maximal.

Слайд 38


Additional links and home task Article about two pointers method Discussion on codeforces Contest
Описание слайда:
Additional links and home task Article about two pointers method Discussion on codeforces Contest



Теги pointers method
Похожие презентации
Mypresentation.ru
Загрузить презентацию