Update Data Structures for id translation
This commit is contained in:
parent
14fb001a15
commit
d6ae228530
@ -535,125 +535,117 @@ Menulis kode pada papan tulis atau kertas, bukan komputer. Uji dengan beberapa s
|
|||||||
## Struktur Data
|
## Struktur Data
|
||||||
|
|
||||||
- ### Arrays
|
- ### Arrays
|
||||||
- Implement an automatically resizing vector.
|
- Menerapkan vektor yang mengubah ukuran secara otomatis.
|
||||||
- [ ] Description:
|
- [ ] Deskripsi:
|
||||||
- [Arrays (video)](https://www.coursera.org/learn/data-structures/lecture/OsBSF/arrays)
|
- [Array (video)](https://www.coursera.org/lecture/data-structures/arrays-OsBSF)
|
||||||
- [UCBerkley CS61B - Linear and Multi-Dim Arrays (video)](https://youtu.be/Wp8oiO_CZZE?t=15m32s)
|
- [UC Berkeley CS61B - Array Linear dan Multi-Dim (video)](https://archive.org/details/ucberkeley_webcast_Wp8oiO_CZZE) (Mulailah menonton dari 15m 32s)
|
||||||
- [Basic Arrays (video)](https://archive.org/details/0102WhatYouShouldKnow/02_04-basicArrays.mp4)
|
- [Array Dinamis (video)](https://www.coursera.org/lecture/data-structures/dynamic-arrays-EwbnV)
|
||||||
- [Multi-dim (video)](https://archive.org/details/0102WhatYouShouldKnow/02_05-multidimensionalArrays.mp4)
|
- [Array Bergerigi (video)](https://www.youtube.com/watch?v=1jtrQqYpt7g)
|
||||||
- [Dynamic Arrays (video)](https://www.coursera.org/learn/data-structures/lecture/EwbnV/dynamic-arrays)
|
- [ ] Menerapkan vektor (array yang bisa berubah dengan ukuran otomatis):
|
||||||
- [Jagged Arrays (video)](https://www.youtube.com/watch?v=1jtrQqYpt7g)
|
- [ ] Berlatih coding menggunakan array dan pointer, dan matematika pointer untuk melompat ke indeks daripada menggunakan pengindeksan.
|
||||||
- [Jagged Arrays (video)](https://archive.org/details/0102WhatYouShouldKnow/02_06-jaggedArrays.mp4)
|
- [ ] Array data mentah baru dengan memori yang dialokasikan
|
||||||
- [Resizing arrays (video)](https://archive.org/details/0102WhatYouShouldKnow/03_01-resizableArrays.mp4)
|
- dapat mengalokasikan array int di bawah tenda, hanya saja tidak menggunakan fitur-fiturnya
|
||||||
- [ ] Implement a vector (mutable array with automatic resizing):
|
- start dengan 16, atau jika angka awal lebih besar, gunakan pangkat 2 - 16, 32, 64, 128
|
||||||
- [ ] Practice coding using arrays and pointers, and pointer math to jump to an index instead of using indexing.
|
- [ ] size() - jumlah item
|
||||||
- [ ] new raw data array with allocated memory
|
- [ ] capacity() - jumlah barang yang bisa ditampungnya
|
||||||
- can allocate int array under the hood, just not use its features
|
|
||||||
- start with 16, or if starting number is greater, use power of 2 - 16, 32, 64, 128
|
|
||||||
- [ ] size() - number of items
|
|
||||||
- [ ] capacity() - number of items it can hold
|
|
||||||
- [ ] is_empty()
|
- [ ] is_empty()
|
||||||
- [ ] at(index) - returns item at given index, blows up if index out of bounds
|
- [ ] at(index) - mengembalikan item pada indeks tertentu, meledak jika indeks di luar batas
|
||||||
- [ ] push(item)
|
- [ ] push(item)
|
||||||
- [ ] insert(index, item) - inserts item at index, shifts that index's value and trailing elements to the right
|
- [ ] insert(index, item) - menyisipkan item pada indeks, menggeser nilai indeks dan elemen tambahan ke kanan
|
||||||
- [ ] prepend(item) - can use insert above at index 0
|
- [ ] prepend(item) - dapat menggunakan sisipan di atas pada indeks 0
|
||||||
- [ ] pop() - remove from end, return value
|
- [ ] pop() - hapus dari akhir, nilai kembali
|
||||||
- [ ] delete(index) - delete item at index, shifting all trailing elements left
|
- [ ] delete(index) - hapus item pada indeks, menggeser semua elemen tertinggal ke kiri
|
||||||
- [ ] remove(item) - looks for value and removes index holding it (even if in multiple places)
|
- [ ] remove(item) - mencari nilai dan menghapus indeks yang menahannya (meskipun di banyak tempat)
|
||||||
- [ ] find(item) - looks for value and returns first index with that value, -1 if not found
|
- [ ] find(item) - mencari nilai dan mengembalikan indeks pertama dengan nilai itu, -1 jika tidak ditemukan
|
||||||
- [ ] resize(new_capacity) // private function
|
- [ ] resize(new_capacity) // fungsi pribadi
|
||||||
- when you reach capacity, resize to double the size
|
- saat Anda mencapai kapasitas, ubah ukurannya menjadi dua kali lipat
|
||||||
- when popping an item, if size is 1/4 of capacity, resize to half
|
- saat memunculkan item, jika ukurannya 1/4 dari kapasitas, ubah ukurannya menjadi setengah
|
||||||
- [ ] Time
|
- [ ] Waktu
|
||||||
- O(1) to add/remove at end (amortized for allocations for more space), index, or update
|
- O(1) untuk menambah/menghapus di akhir (diamortisasi untuk alokasi untuk lebih banyak ruang), indeks, atau pembaruan
|
||||||
- O(n) to insert/remove elsewhere
|
- O(n) untuk memasukkan/menghapus di tempat lain
|
||||||
- [ ] Space
|
- [ ] Ruang
|
||||||
- contiguous in memory, so proximity helps performance
|
- berdekatan dalam memori, jadi kedekatan membantu kinerja
|
||||||
- space needed = (array capacity, which is >= n) * size of item, but even if 2n, still O(n)
|
- ruang yang dibutuhkan = (kapasitas array, yaitu >= n)*ukuran item, tetapi meskipun 2n, tetap O(n)
|
||||||
|
|
||||||
- ### Linked Lists
|
- ### Linked Lists
|
||||||
- [ ] Description:
|
- [ ] Deskripsi:
|
||||||
- [ ] [Singly Linked Lists (video)](https://www.coursera.org/learn/data-structures/lecture/kHhgK/singly-linked-lists)
|
- [ ] [Singly Linked Lists (video)](https://www.coursera.org/lecture/data-structures/singly-linked-lists-kHhgK)
|
||||||
- [ ] [CS 61B - Linked Lists (video)](https://www.youtube.com/watch?v=sJtJOtXCW_M&list=PL-XXv-cvA_iAlnI-BQr9hjqADPBtujFJd&index=5)
|
- [ ] [CS 61B - Linked Lists 1 (video)](https://archive.org/details/ucberkeley_webcast_htzJdKoEmO0)
|
||||||
- [ ] [C Code (video)](https://www.youtube.com/watch?v=QN6FPiD0Gzo)
|
- [ ] [CS 61B - Linked Lists 2 (video)](https://archive.org/details/ucberkeley_webcast_-c4I3gFYe3w)
|
||||||
- not the whole video, just portions about Node struct and memory allocation.
|
- [ ] [Kode C (video)](https://www.youtube.com/watch?v=QN6FPiD0Gzo)
|
||||||
- [ ] Linked List vs Arrays:
|
- bukan keseluruhan video, hanya bagian tentang struct Node dan alokasi memori
|
||||||
- [Core Linked Lists Vs Arrays (video)](https://www.coursera.org/learn/data-structures-optimizing-performance/lecture/rjBs9/core-linked-lists-vs-arrays)
|
- [ ] Linked List vs Array:
|
||||||
- [In The Real World Linked Lists Vs Arrays (video)](https://www.coursera.org/learn/data-structures-optimizing-performance/lecture/QUaUd/in-the-real-world-lists-vs-arrays)
|
- [Daftar Tertaut Inti Vs Array (video)](https://www.coursera.org/lecture/data-structures-optimizing-performance/core-linked-lists-vs-arrays-rjBs9)
|
||||||
- [ ] [why you should avoid linked lists (video)](https://www.youtube.com/watch?v=YQs6IC-vgmo)
|
- [Di Dunia Nyata Linked List Vs Array (video)](https://www.coursera.org/lecture/data-structures-optimizing-performance/in-the-real-world-lists-vs-arrays-QUaUd)
|
||||||
- [ ] Gotcha: you need pointer to pointer knowledge:
|
- [ ] [mengapa Anda harus menghindari linked list (video)](https://www.youtube.com/watch?v=YQs6IC-vgmo)
|
||||||
(for when you pass a pointer to a function that may change the address where that pointer points)
|
- [ ] Gotcha: Anda perlu pengetahuan pointer ke pointer:
|
||||||
This page is just to get a grasp on ptr to ptr. I don't recommend this list traversal style. Readability and maintainability suffer due to cleverness.
|
(untuk saat Anda meneruskan pointer ke fungsi yang dapat mengubah alamat tempat pointer itu menunjuk)
|
||||||
- [Pointers to Pointers](https://www.eskimo.com/~scs/cclass/int/sx8.html)
|
Halaman ini hanya untuk memahami pointer ke pointer. Saya tidak merekomendasikan gaya traversal daftar ini. Keterbacaan dan pemeliharaan menderita karena kepintaran.
|
||||||
- [ ] implement (I did with tail pointer & without):
|
- [Pointer ke Pointer](https://www.eskimo.com/~scs/cclass/int/sx8.html)
|
||||||
- [ ] size() - returns number of data elements in list
|
- [ ] Implementasikan (saya lakukan dengan tail pointer & tanpa):
|
||||||
- [ ] empty() - bool returns true if empty
|
- [ ] size() - mengembalikan jumlah elemen data dalam daftar
|
||||||
- [ ] value_at(index) - returns the value of the nth item (starting at 0 for first)
|
- [ ] empty() - bool mengembalikan nilai true jika kosong
|
||||||
- [ ] push_front(value) - adds an item to the front of the list
|
- [ ] value_at(index) - mengembalikan nilai item ke-n (mulai dari 0 untuk yang pertama)
|
||||||
- [ ] pop_front() - remove front item and return its value
|
- [ ] push_front(value) - menambahkan item ke depan daftar
|
||||||
- [ ] push_back(value) - adds an item at the end
|
- [ ] pop_front() - hapus item depan dan kembalikan nilainya
|
||||||
- [ ] pop_back() - removes end item and returns its value
|
- [ ] push_back(value) - menambahkan item di akhir
|
||||||
- [ ] front() - get value of front item
|
- [ ] pop_back() - menghapus item akhir dan mengembalikan nilainya
|
||||||
- [ ] back() - get value of end item
|
- [ ] front() - dapatkan nilai barang depan
|
||||||
- [ ] insert(index, value) - insert value at index, so current item at that index is pointed to by new item at index
|
- [ ] back() - dapatkan nilai item akhir
|
||||||
- [ ] erase(index) - removes node at given index
|
- [ ] insert(index, value) - masukkan nilai pada indeks, maka item saat ini pada indeks tersebut ditunjuk oleh item baru pada indeks
|
||||||
- [ ] value_n_from_end(n) - returns the value of the node at nth position from the end of the list
|
- [ ] erase(index) - menghapus node pada indeks tertentu
|
||||||
- [ ] reverse() - reverses the list
|
- [ ] value_n_from_end(n) - mengembalikan nilai node pada posisi ke-n dari akhir daftar
|
||||||
- [ ] remove_value(value) - removes the first item in the list with this value
|
- [ ] reverse() - membalikkan daftar
|
||||||
|
- [ ] remove_value(value) - menghapus item pertama dalam daftar dengan nilai ini
|
||||||
- [ ] Doubly-linked List
|
- [ ] Doubly-linked List
|
||||||
- [Description (video)](https://www.coursera.org/learn/data-structures/lecture/jpGKD/doubly-linked-lists)
|
- [Deskripsi (video)](https://www.coursera.org/lecture/data-structures/doubly-linked-lists-jpGKD)
|
||||||
- No need to implement
|
- Tidak perlu diimplementasikan
|
||||||
|
|
||||||
- ### Stack
|
- ### Stack
|
||||||
- [ ] [Stacks (video)](https://www.coursera.org/learn/data-structures/lecture/UdKzQ/stacks)
|
- [ ] [Stack (video)](https://www.coursera.org/lecture/data-structures/stacks-UdKzQ)
|
||||||
- [ ] [Using Stacks Last-In First-Out (video)](https://archive.org/details/0102WhatYouShouldKnow/05_01-usingStacksForLast-inFirst-out.mp4)
|
- [ ] Tidak akan diterapkan. Menerapkan dengan array itu sepele
|
||||||
- [ ] Will not implement. Implementing with array is trivial.
|
|
||||||
|
|
||||||
- ### Queue
|
- ### Queue
|
||||||
- [ ] [Using Queues First-In First-Out(video)](https://archive.org/details/0102WhatYouShouldKnow/05_03-usingQueuesForFirst-inFirst-out.mp4)
|
- Queue (Antrean)
|
||||||
- [ ] [Queue (video)](https://www.coursera.org/learn/data-structures/lecture/EShpq/queue)
|
- [ ] [Queue (video)](https://www.coursera.org/lecture/data-structures/queues-EShpq)
|
||||||
- [ ] [Circular buffer/FIFO](https://en.wikipedia.org/wiki/Circular_buffer)
|
- [ ] [Circular buffer/FIFO](https://en.wikipedia.org/wiki/Circular_buffer)
|
||||||
- [ ] [Priority Queues (video)](https://archive.org/details/0102WhatYouShouldKnow/05_04-priorityQueuesAndDeques.mp4)
|
- [ ] Implementasikan menggunakan linked-list, dengan tail pointer:
|
||||||
- [ ] Implement using linked-list, with tail pointer:
|
- enqueue(value) - menambah nilai pada posisi di ekor
|
||||||
- enqueue(value) - adds value at position at tail
|
- dequeue() - mengembalikan nilai dan menghapus elemen yang paling baru ditambahkan (depan)
|
||||||
- dequeue() - returns value and removes least recently added element (front)
|
|
||||||
- empty()
|
- empty()
|
||||||
- [ ] Implement using fixed-sized array:
|
- [ ] Menerapkan menggunakan array berukuran tetap:
|
||||||
- enqueue(value) - adds item at end of available storage
|
- enqueue(value) - menambahkan item di akhir penyimpanan yang tersedia
|
||||||
- dequeue() - returns value and removes least recently added element
|
- dequeue() - mengembalikan nilai dan menghapus elemen yang paling baru ditambahkan
|
||||||
- empty()
|
- empty()
|
||||||
- full()
|
- full()
|
||||||
- [ ] Cost:
|
- [ ] Biaya:
|
||||||
- a bad implementation using linked list where you enqueue at head and dequeue at tail would be O(n)
|
- implementasi yang buruk menggunakan daftar tertaut di mana Anda mengantre di bagian depan
|
||||||
because you'd need the next to last element, causing a full traversal each dequeue
|
dan antrean di bagian ekor akan menjadi O(n) karena Anda memerlukan elemen di sebelah terakhir,
|
||||||
- enqueue: O(1) (amortized, linked list and array [probing])
|
menyebabkan traversal penuh setiap dequeue
|
||||||
- dequeue: O(1) (linked list and array)
|
- enqueue: O(1) (diamortisasi, daftar tertaut dan larik [probing])
|
||||||
- empty: O(1) (linked list and array)
|
- dequeue: O(1) (daftar dan larik tertaut)
|
||||||
|
- empty: O(1) (daftar dan larik tertaut)
|
||||||
|
|
||||||
- ### Hash table
|
- ### Hash table
|
||||||
- [ ] Videos:
|
- [ ] Video:
|
||||||
- [ ] [Hashing with Chaining (video)](https://www.youtube.com/watch?v=0M_kIqhwbFo&list=PLUl4u3cNGP61Oq3tWYp6V_F-5jb5L2iHb&index=8)
|
- [ ] [Hashing dengan Chaining (video)](https://www.youtube.com/watch?v=0M_kIqhwbFo&list=PLUl4u3cNGP61Oq3tWYp6V_F-5jb5L2iHb&index=8)
|
||||||
- [ ] [Table Doubling, Karp-Rabin (video)](https://www.youtube.com/watch?v=BRO7mVIFt08&index=9&list=PLUl4u3cNGP61Oq3tWYp6V_F-5jb5L2iHb)
|
- [ ] [Penggandaan Table, Karp-Rabin (video)](https://www.youtube.com/watch?v=BRO7mVIFt08&index=9&list=PLUl4u3cNGP61Oq3tWYp6V_F-5jb5L2iHb)
|
||||||
- [ ] [Open Addressing, Cryptographic Hashing (video)](https://www.youtube.com/watch?v=rvdJDijO2Ro&index=10&list=PLUl4u3cNGP61Oq3tWYp6V_F-5jb5L2iHb)
|
- [ ] [Open Addressing, Hashing Kriptografi (video)](https://www.youtube.com/watch?v=rvdJDijO2Ro&index=10&list=PLUl4u3cNGP61Oq3tWYp6V_F-5jb5L2iHb)
|
||||||
- [ ] [PyCon 2010: The Mighty Dictionary (video)](https://www.youtube.com/watch?v=C4Kc8xzcA68)
|
- [ ] [PyCon 2010: The Mighty Dictionary (video)](https://www.youtube.com/watch?v=C4Kc8xzcA68)
|
||||||
- [ ] [(Advanced) Randomization: Universal & Perfect Hashing (video)](https://www.youtube.com/watch?v=z0lJ2k0sl1g&list=PLUl4u3cNGP6317WaSNfmCvGym2ucw3oGp&index=11)
|
- [ ] [(Lanjutan) Pengacakan: Universal & Perfect Hashing (video)](https://www.youtube.com/watch?v=z0lJ2k0sl1g&list=PLUl4u3cNGP6317WaSNfmCvGym2ucw3oGp&index=11)
|
||||||
- [ ] [(Advanced) Perfect hashing (video)](https://www.youtube.com/watch?v=N0COwN14gt0&list=PL2B4EEwhKD-NbwZ4ezj7gyc_3yNrojKM9&index=4)
|
- [ ] [(Lanjutan) Hash sempurna (video)](https://www.youtube.com/watch?v=N0COwN14gt0&list=PL2B4EEwhKD-NbwZ4ezj7gyc_3yNrojKM9&index=4)
|
||||||
|
|
||||||
- [ ] Online Courses:
|
- [ ] Kursus Online:
|
||||||
- [ ] [Understanding Hash Functions (video)](https://archive.org/details/0102WhatYouShouldKnow/06_02-understandingHashFunctions.mp4)
|
- [ ] [Tabel Hash Inti (video)](https://www.coursera.org/lecture/data-structures-optimizing-performance/core-hash-tables-m7UuP)
|
||||||
- [ ] [Using Hash Tables (video)](https://archive.org/details/0102WhatYouShouldKnow/06_03-usingHashTables.mp4)
|
- [ ] [Struktur Data (video)](https://www.coursera.org/learn/data-structures/home/week/4)
|
||||||
- [ ] [Supporting Hashing (video)](https://archive.org/details/0102WhatYouShouldKnow/06_04-supportingHashing.mp4)
|
- [ ] [Masalah Buku Telepon (video)](https://www.coursera.org/lecture/data-structures/phone-book-problem-NYZZP)
|
||||||
- [ ] [Language Support Hash Tables (video)](https://archive.org/details/0102WhatYouShouldKnow/06_05-languageSupportForHashTables.mp4)
|
- [ ] tabel hash terdistribusi:
|
||||||
- [ ] [Core Hash Tables (video)](https://www.coursera.org/learn/data-structures-optimizing-performance/lecture/m7UuP/core-hash-tables)
|
- [Unggahan Instan dan Pengoptimalan Penyimpanan Di Dropbox (video)](https://www.coursera.org/lecture/data-structures/instant-uploads-and-storage-optimization-in-dropbox-DvaIb)
|
||||||
- [ ] [Data Structures (video)](https://www.coursera.org/learn/data-structures/home/week/3)
|
- [Tabel Hash Terdistribusi (video)](https://www.coursera.org/lecture/data-structures/distributed-hash-tables-tvH8H)
|
||||||
- [ ] [Phone Book Problem (video)](https://www.coursera.org/learn/data-structures/lecture/NYZZP/phone-book-problem)
|
|
||||||
- [ ] distributed hash tables:
|
|
||||||
- [Instant Uploads And Storage Optimization In Dropbox (video)](https://www.coursera.org/learn/data-structures/lecture/DvaIb/instant-uploads-and-storage-optimization-in-dropbox)
|
|
||||||
- [Distributed Hash Tables (video)](https://www.coursera.org/learn/data-structures/lecture/tvH8H/distributed-hash-tables)
|
|
||||||
|
|
||||||
- [ ] implement with array using linear probing
|
- [ ] Implementasikan dengan array menggunakan probing linier
|
||||||
- hash(k, m) - m is size of hash table
|
- hash(k, m) - m adalah ukuran tabel hash
|
||||||
- add(key, value) - if key already exists, update value
|
- add(key, value) - jika kunci sudah ada, perbarui nilai
|
||||||
- exists(key)
|
- exists(key)
|
||||||
- get(key)
|
- get(key)
|
||||||
- remove(key)
|
- remove(key)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user