Sorting (Discussion 10) (Các thuật toán sắp xếp) - Christine Zhou
Génération de l'aperçu...
Slide bài giảng thảo luận về các thuật toán sắp xếp: Insertion Sort, Selection Sort, Merge Sort, Heapsort, Quicksort, Counting Sort, Radix Sort.
Description
Discussion 10: Sorting Christine Zhou Agenda Announcements We’ll try to get through all the worksheet, but no guarantees Announcements Midterm 2 is tomorrow! Check room assignments HW6 due Friday Project 2 milestone due on Monday, just need to pass the integration tests Best of luck!! No slip hours for this! You do not need your game fully functioning, remember these integration tests are not comprehensive! Extra office hours Monday and Wednesday night! 6-8PM More details to come later Insertion Sort Have a sorted portion and a non-sorted portion In the non-sorted portion, pick the first element and “insert” its correct position Keeping swapping with whatever is to the left Will be at the right position when the left element is less than the element you are inserting Selection Sort Scan through the array, always “selecting” the smallest item and bringing it to the front Merge Sort Split array into two equal partitions Call mergesort on each of the partitions Now the partitions are sorted or the partitions are one element Merge the two halves together Have pointers to each partitions and combine them so the partitions are now sorted Heapsort Use a max heap Algorithm: Turn elements into a heap, represent with an array Repeat: remove max and rearrange heap, put max at the end Quicksort Pick a pivot Divide array into 3 parts: less than portion, equal to portion, greater than portion Repeat previous steps on 1st and 3rd if they include more than one element Runtime: Average case: 𝚹(NlogN) Worst case: 𝚹(N^2) Counting Sort Keep an array called counts that keeps track of the count of each value, go through the entire array and collect the counts Keep an array called starts and this will tell us where to start for each element, go through the counts and collect the starts Go through all the elements of the array and place the element where it should belong based on the starts array Runtime: N is the nu
Résumé IA
- Nom du document
- Sorting (Discussion 10) (Các thuật toán sắp xếp) - Christine Zhou
- École / Cours
- University of California, Berkeley · Lập trình Java
- Contenu
- Tài liệu giới thiệu và mô tả ngắn gọn các thuật toán sắp xếp phổ biến như Insertion Sort, Selection Sort, Merge Sort, Heapsort, Quicksort, Counting Sort và Radix Sort. Ngoài ra, có các thông báo về lịch học, bài tập và dự án.
- Table des matières
- Agenda
- Announcements
- Insertion Sort
- Selection Sort
- Merge Sort
- Heapsort
- Quicksort
- Counting Sort
- Radix Sort
- Pages
- 10 pages
- Téléversé par
- Uni24h
Foire aux questions
Ce document est-il gratuit ?
Oui. « Sorting (Discussion 10) (Các thuật toán sắp xếp) - Christine Zhou » est gratuit — il suffit de vous connecter et de cliquer sur Télécharger pour obtenir le fichier original.
Combien de pages compte ce document ?
Le document contient 10 pages, pour le cours Lập trình Java. Vous pouvez le prévisualiser en ligne avant de le télécharger.
Puis-je prévisualiser avant de télécharger ?
Oui. Vous pouvez prévisualiser ce document directement sur cette page avec le lecteur en ligne, puis décider de le télécharger ou non.
Sorting (Discussion 10) (Các thuật toán sắp xếp) - Christine Zhou
Génération de l'aperçu...
Discussion 10: Sorting Christine Zhou Agenda Announcements We’ll try to get through all the worksheet, but no guarantees Announcements Midterm 2 is tomorrow! Check room assignments HW6 due Friday Project 2 milestone due on Monday, just need to pass the integration tests Best of luck!! No slip hours for this! You do not need your game fully functioning, remember these integration tests are not comprehensive! Extra office hours Monday and Wednesday night! 6-8PM More details to come later Insertion Sort Have a sorted portion and a non-sorted portion In the non-sorted portion, pick the first element and “insert” its correct position Keeping swapping with whatever is to the left Will be at the right position when the left element is less than the element you are inserting Selection Sort Scan through the array, always “selecting” the smallest item and bringing it to the front Merge Sort Split array into two equal partitions Call mergesort on each of the partitions Now the partitions are sorted or the partitions are one element Merge the two halves together Have pointers to each partitions and combine them so the partitions are now sorted Heapsort Use a max heap Algorithm: Turn elements into a heap, represent with an array Repeat: remove max and rearrange heap, put max at the end Quicksort Pick a pivot Divide array into 3 parts: less than portion, equal to portion, greater than portion Repeat previous steps on 1st and 3rd if they include more than one element Runtime: Average case: 𝚹(NlogN) Worst case: 𝚹(N^2) Counting Sort Keep an array called counts that keeps track of the count of each value, go through the entire array and collect the counts Keep an array called starts and this will tell us where to start for each element, go through the counts and collect the starts Go through all the elements of the array and place the element where it should belong based on the starts array Runtime: N is the nu
Lire le document entier
- Nom du document
- Sorting (Discussion 10) (Các thuật toán sắp xếp) - Christine Zhou
- École / Cours
- University of California, Berkeley · Lập trình Java
- Contenu
- Tài liệu giới thiệu và mô tả ngắn gọn các thuật toán sắp xếp phổ biến như Insertion Sort, Selection Sort, Merge Sort, Heapsort, Quicksort, Counting Sort và Radix Sort. Ngoài ra, có các thông báo về lịch học, bài tập và dự án.
- Table des matières
- Agenda
- Announcements
- Insertion Sort
- Selection Sort
- Merge Sort
- Heapsort
- Quicksort
- Counting Sort
- Radix Sort
- Pages
- 10 pages
- Téléversé par
- Uni24h
Commentaires (0)
Aucun commentaire pour le moment. Soyez le premier !
Misc.onclusion (Discussion 14-END) (Ôn tập cấu trúc dữ liệu) - Christine Zhou
Final Review Solutions (Cấu trúc dữ liệu heap, hàng đợi ưu tiên và duyệt đồ thị) - Ching and Christines
Giáo trình Lập trình Java
Inheritance (Discussion 4) (Kế thừa trong Java) - Christine Zhou
Asymptotic Analysis (Discussion 7) (Phân tích tiệm cận) - Christine Zhou
Chương 7.Cơ học lượng tử - Vật lý đại cương 3 - TS.Nguyễn Thị Trang
Chương 6.Quang học lượng tử - Vật lý đại cương 3 - TS.Nguyễn Thị Trang
Chương 5.Thuyết tương đối - Vật lý đại cương 3 - TS.Nguyễn Thị Trang
Chương 4. Tán xạ ánh sáng - Vật lý đại cương 3 - TS.Nguyễn Thị Trang
Chương 3.Phân cực ánh sáng - Vật lý đại cương 3 - TS.Nguyễn Thị Trang
Commentaires (0)
Aucun commentaire pour le moment. Soyez le premier !