This repository contains implementation and discussion notes (intuition, applications, analysis)
of some fundamental data structures and algorithms in Computer Science.
It is aligned with CS2040s syllabus taught by
Prof Seth at NUS.
The work here is continually being developed by CS2040s Teaching Assistants(TAs) and ex-2040s students, under the guidance of Prof Seth. It mostly covers lecture content and discussion notes. Future plans include deeper discussion into the tougher parts of tutorials and even practice problems / puzzles related to DSA.
The project's structure is optimised for IntelliJ IDEA as per the course's preferred IDE. Gradle is used for development.
- Adelson-Velskii and Landis (AVL) Binary Search Tree
- Disjoint Set / Union Find
- Quick Find
- Weighted Union
- Path compression
- Hashing
- Heap
- Max heap implementation
- Linked List
- LRU Cache
- Minimum Spanning Tree
- Queue
- Segment Tree
- Stack
- Segment Tree
- Trie
- Bubble Sort
- Binary Search
- Counting Sort
- Cyclic Sort
- Insertion Sort
- Knuth-Morris-Pratt (KMP algorithm)
- Merge Sort
- Quick Sort
- Radix Sort
- Selection Sort
- Basic structures
- Binary Search
- Peak Finding
- Template
- Sorting
- Bubble
- Insertion
- Selection
- Merge
- Quick
- Hoare's (this version is the one shown in lecture!)
- Lomuto's
- Paranoid
- 3-way Partitioning
- Counting Sort (found in tutorial)
- Radix Sort (found in tutorial)
- Trees
- Binary search tree
- AVL-tree
- Trie
- B-Tree
- Segment Tree (Not covered in CS2040s but useful!)
- Red-Black Tree (WIP)
- Orthogonal Range Searching
- Interval Trees (WIP)
- Binary Heap (Max heap)
- Disjoint Set / Union Find
- Quick Find
- Weighted Union (with path compression)
- Hashing
- Chaining
- Open Addressing
- Bloom filter (WIP)
- Basic graphs (WIP)
- Depth-first search
- Breadth-first search
- Graphs (WIP)
- Bellman-ford
- Dijkstra
- Directed acyclic graphs algorithms
- Post-order DFS
- Kahn's
- Floyd Warshall
- Minimum spanning tree
If you are a CS2040s student, your IDEA configurations should already be compatible with this project structure. So, feel free to clone and use it as you see fit. Note, below configuration is as per CS2040s PS1 set-up guide.
- Choose Java Version 11.0.XX for Project SDK. You can download it here
- Create account and login if necessary
- Make sure to download the correct one compatible with your hardware
- Download IntelliJ (Community Edition) here if you do not have it.
- Fork the repo and clone it on your local device
- Launch IntelliJ on your device and under the
Projects
tab, and clickopen
. Navigate to where the local repo is cloned- Configure to Java SDK (if not done) by first heading to
File
on the top-left panel, - Click on
Project Structure...
- Apply the desired Java SDK in the
SDK:
dropdown. Remember to clickApply
.
- Configure to Java SDK (if not done) by first heading to
- You can test if everything is properly set-up with the command:
./gradlew clean test
All files should be compiled and all testcases should pass.
The resources here can be directly viewed from GitHub interface, but it is advisable for you to fork and clone it to your local desktop, especially if you wish to tweak or play with custom inputs. There is a folder where you can import and run the algorithms/structures here for your own input. See here.
While our team of TAs and students have diligently verified the correctness of our code, there might still be some discrepancies or deviation from lecture content (perhaps due to new changes). In which case, you are strongly advised to raise it up to us or consult your TA regarding any suspicions on the use of the information shared here.
See the team!