Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to HKOI. Self Introduction Ice Breaking Game.

Similar presentations


Presentation on theme: "Introduction to HKOI. Self Introduction Ice Breaking Game."— Presentation transcript:

1 Introduction to HKOI

2 Self Introduction

3 Ice Breaking Game

4 Level 1 Level 1 Form a big circle Form a big circle The person holding the deck of cards will start the game, by introducing himself, and then passes the deck of cards to his left. The person holding the deck of cards will start the game, by introducing himself, and then passes the deck of cards to his left. In each preceding turn, the person holding the deck of cards will repeat what the previous person has said, and then introduces himself. After that, he will passes the deck to his left. In each preceding turn, the person holding the deck of cards will repeat what the previous person has said, and then introduces himself. After that, he will passes the deck to his left. The game ends when the deck of cards return to the first person. The game ends when the deck of cards return to the first person.

5 Ice Breaking Game Level 2 Level 2 Form a big circle Form a big circle The person holding the deck of cards will start the game, by introducing himself and drawing a card from the deck. After that, he will pass the deck of cards to the k th person on his left, where k is the number written on the card he draw. The person holding the deck of cards will start the game, by introducing himself and drawing a card from the deck. After that, he will pass the deck of cards to the k th person on his left, where k is the number written on the card he draw. In each preceding turn, the person holding the deck of cards will repeat what the previous person has said, and then introduces himself. After that, he will draw a card from the deck and pass the deck of cards to the k th person on his left, where k is the number written on the card he draw. In each preceding turn, the person holding the deck of cards will repeat what the previous person has said, and then introduces himself. After that, he will draw a card from the deck and pass the deck of cards to the k th person on his left, where k is the number written on the card he draw. The game ends when the deck runs out of cards. The game ends when the deck runs out of cards.

6 Problems Just like in Final Events Just like in Final Events Usually starts with a story or a situation in daily life. Usually starts with a story or a situation in daily life. e.g. A group of people is playing an ice-breaking game e.g. A group of people is playing an ice-breaking game Specifies a set of well-defined inputs, and the corresponding outputs Specifies a set of well-defined inputs, and the corresponding outputs What can be the input and output of the ice-breaking game we played? What can be the input and output of the ice-breaking game we played? Sometimes, there may be more than one correct output, and the problem only requires you to output any one of the them. Sometimes, there may be more than one correct output, and the problem only requires you to output any one of the them. Be careful of the format of the input and output! Be careful of the format of the input and output! Example: sorting Example: sorting

7 Algorithms “ Informally, an algorithm is any well-defined computational procedure that takes some value, or set of values, as input and produces some value, or set of values, as output. An algorithm is thus a sequence of computational steps that transform the input into the output. ” [CLRS] “ Informally, an algorithm is any well-defined computational procedure that takes some value, or set of values, as input and produces some value, or set of values, as output. An algorithm is thus a sequence of computational steps that transform the input into the output. ” [CLRS] An algorithm ( 算法 ) is a method to solve a problem. An algorithm ( 算法 ) is a method to solve a problem. There may be more than one algorithms corresponding to a problem. There may be more than one algorithms corresponding to a problem. Take sorting as an example. Bubble sort and insertion sort are algorithms that solves the problem. Take sorting as an example. Bubble sort and insertion sort are algorithms that solves the problem. We usually regard algorithms as language independent. We usually regard algorithms as language independent. An algorithm, by definition, must eventually terminates. An algorithm, by definition, must eventually terminates. Many important algorithms are named after Computer Scientists. Many important algorithms are named after Computer Scientists.

8 Algorithms Tree-Search algorithms Tree-Search algorithms Depth-First Search Depth-First Search Breath-First Search Breath-First Search Graph algorithms Graph algorithms Dijkstra ’ s Dijkstra ’ s Floyd-Warshall Floyd-Warshall Bellman-Ford Bellman-Ford Prim ’ s Prim ’ s Kruskal ’ s Kruskal ’ s Convex Hull algorithm Convex Hull algorithm Graham ’ s scan Graham ’ s scan WA NT SA Q NSW V T

9 Data Structures Data structures ( 數據結構 ) are how we organize and store the input data, or intermediate results of computation Data structures ( 數據結構 ) are how we organize and store the input data, or intermediate results of computation Helps to speed up algorithms Helps to speed up algorithms Different data structures have different properties Different data structures have different properties different types of data different types of data different types of operations different types of operations Examples Examples Array Array Stack Stack Queue Queue Heap Heap Binary Search Tree Binary Search Tree

10 Complexity We want to know how well an algorithm “ scales ” (i.e. when there is a large input). We want to know how well an algorithm “ scales ” (i.e. when there is a large input). Usually, minor improvements are not critical in competitions. Usually, minor improvements are not critical in competitions. A reasonable implementation can pass. A reasonable implementation can pass. So, we want to hide the lower order terms. So, we want to hide the lower order terms. We do not know the exact time each operation takes. We do not know the exact time each operation takes. So, we want to measure the time by counting the number of basic operations. So, we want to measure the time by counting the number of basic operations.

11 Complexity

12 Complexity Big-O notation Big-O notation Definition Definition We say that f(x) is in O(g(x)) if and only if there exist numbers x 0 and M such that |f(x)| ≤ M |g(x)| for x > x 0

13 Complexity Bubble sort Bubble sort For i := 1 to n do For j := 2 to i do if a[j] > a[j-1] then swap(a[j], a[j-1]); For i := 1 to n do For j := 2 to i do if a[j] > a[j-1] then swap(a[j], a[j-1]); Worst case number of swaps = n(n-1)/2 Worst case number of swaps = n(n-1)/2 Time Complexity = O(n 2 ) Time Complexity = O(n 2 ) Total space needed = size of array + space of variables Total space needed = size of array + space of variables Space Complexity = 32*n +32*3 = O(n) +O(1) = O(n) Space Complexity = 32*n +32*3 = O(n) +O(1) = O(n)

14 Complexity Binary search Binary search While a<=b do While a<=b dom=(a+b)/2 If a[m]=key, Then return m If a[m]<key, Then a=m+1 If a[m]>key, Then b=m-1 Worst case number of iterations = lg n Worst case number of iterations = lg n Time Complexity = O(log n) Time Complexity = O(log n) Total space needed = size of array + space of variables Total space needed = size of array + space of variables Space Complexity = O(n) Space Complexity = O(n)

15 Complexity Usually, the time complexity of the algorithm gives us a rough estimation of the actual run time. Usually, the time complexity of the algorithm gives us a rough estimation of the actual run time. O(n) for n ~ 10 8 -10 9 O(n) for n ~ 10 8 -10 9 O(n log n) for n ~ 5x10 5 O(n log n) for n ~ 5x10 5 O(n 2 ) for n ~ 1000-10000 O(n 2 ) for n ~ 1000-10000 O(n 3 ) for n ~ 100~1000 O(n 3 ) for n ~ 100~1000 O(n 4 ) for n ~ 50-100 O(n 4 ) for n ~ 50-100 O(k n ) (k>1) or O(n!) for very small n, usually 1) or O(n!) for very small n, usually < 20 Keep in mind Keep in mind The constant hidden by Big-O notation (including the algorithm and the details implementation) The constant hidden by Big-O notation (including the algorithm and the details implementation) Computers vary in speeds, so the time needed will be different. In fact, computers are getting faster these days. Computers vary in speeds, so the time needed will be different. In fact, computers are getting faster these days. Read the instructions carefully for the time limit. Read the instructions carefully for the time limit. Test the program/computer before making assumptions! Test the program/computer before making assumptions!

16 Training Session Topics are divided into two categories, such that students may master the necessary skills after two years of training Topics are divided into two categories, such that students may master the necessary skills after two years of training Intermediate: designed for students who have never entered training team in the past Intermediate: designed for students who have never entered training team in the past Advanced: designed for students who are familiar with intermediate topics Advanced: designed for students who are familiar with intermediate topics All topics are open to all trainees. All topics are open to all trainees. We strongly recommend that students make sure they have the necessary background knowledge before they attend a training session. We strongly recommend that students make sure they have the necessary background knowledge before they attend a training session.

17 Training Session On Saturdays (including some public holidays) On Saturdays (including some public holidays) Venue Venue HW312(Intermediate) and HW311(Advanced), Haking Wong Building, The University of Hong Kong HW312(Intermediate) and HW311(Advanced), Haking Wong Building, The University of Hong Kong AM Session AM Session regular training topics regular training topics 10:00am – 1:00pm 10:00am – 1:00pm Lunch Lunch Questions and discussions Questions and discussions Making friends Making friends PM Session PM Session 2:00pm – 5:00pm 2:00pm – 5:00pm Detailed schedule is available in the official website (http://www.hkoi.org/) Detailed schedule is available in the official website (http://www.hkoi.org/)http://www.hkoi.org/ Training notes will be uploaded after each training session. Training notes will be uploaded after each training session.

18 Training Topics Algorithms and Data Structures Algorithms and Data Structures Linux Linux Free, popular and powerful Free, popular and powerful Competition environment Competition environment C++ C++ Advantage of Stardard Template Library (STL) Advantage of Stardard Template Library (STL)

19 Training References Books Books “ Introduction to Algorithms ” by Cormen, Leiserson, Rivest, Stein [CLRS] “ Introduction to Algorithms ” by Cormen, Leiserson, Rivest, Stein [CLRS] Heapsort, Quicksort, Sorting in Linear Time, Elementary Data Structures, Binary Search Trees, Dynamic Programming, Greedy Algorithms, Data Structures for Disjoint Sets, Elementary Graph Algorithms, Minimum Spanning Trees, Single-Source Shortest Path, All-Pairs Shortest Path Heapsort, Quicksort, Sorting in Linear Time, Elementary Data Structures, Binary Search Trees, Dynamic Programming, Greedy Algorithms, Data Structures for Disjoint Sets, Elementary Graph Algorithms, Minimum Spanning Trees, Single-Source Shortest Path, All-Pairs Shortest Path Online Online Wikipedia (http://en.wikipedia.org/) Wikipedia (http://en.wikipedia.org/)http://en.wikipedia.org/

20 Online Judge HKOI Judge (HKOJ) HKOI Judge (HKOJ) https://judge.hkoi.org https://judge.hkoi.org https://judge.hkoi.org After each training, some problems are open for practice. After each training, some problems are open for practice. Update your personal information. Update your personal information. Take attendance on your own every training. Take attendance on your own every training. Rank, score and attendance are for reference only. Rank, score and attendance are for reference only.

21 Team Formation Test 29 May 2010 29 May 2010 Trainees with outstanding performance can represent Hong Kong in international and national competitions Trainees with outstanding performance can represent Hong Kong in international and national competitions The delegation selection algorithm is based on the score of the Team Formation Test (TFT) The delegation selection algorithm is based on the score of the Team Formation Test (TFT)

22 External Competitions International Olympiad of Informatics (IOI) International Olympiad of Informatics (IOI) http://www.ioi2010.org/ http://www.ioi2010.org/ http://www.ioi2010.org/ 14-21 August 2010 @ Canada 14-21 August 2010 @ Canada National Olympiad of Informatics (NOI) National Olympiad of Informatics (NOI) 全國信息學奧林匹克競賽 全國信息學奧林匹克競賽


Download ppt "Introduction to HKOI. Self Introduction Ice Breaking Game."

Similar presentations


Ads by Google