Skip to content

Back-end code for Coursera course by University of California San Diego

Notifications You must be signed in to change notification settings

bisscay/DataStructures-Performance

Repository files navigation

DataStructures-Performance

Back-end code for Coursera course by University of California San Diego.

Week 1

Centers on environment set up, ensure you have a JDK 1.8 + with a supporting Eclipse IDE.

Setup can be tricky, consider your java path, jfx location and compiler compliance level.

The error prompts spice things up, google's your friend. *wink

Week 2

Focuses on implementations in the document package.

A view on String immutability, memory models, interned strings and regular expressions.

Document class

BasicDocument class

Week 3

Centers on performance (Asymptotic Analysis and Benchmarking), below is a plot comparing two classes in the document package.

BasicDocument in blue has a steeper linear slope performing poorly as the input scales, compared to EfficientDocument in red.

EfficientDocument

Benchmark Plot:

Week 3 Benchmark Image

Week 4

In Part 1, JUnit is used to adopt a test-driven approach in developing a doubly linked list using sentinels.

My Linked List Tester

My Linked List Class

In Part 2, a random MarkovTextGenerator is built. One key view is the space complexity advantage a StringBuilder has over immutable strings.

Markov Text Generator

Week 5

Part 1: Spell checking and more benchmarking

(Trie over TreeSet/Balanced BST, TreeSet over BST, BST over General Tree, LinkedList is a Tree in essence).

Implemented a dictionary of words, and compared the performance of using a Binary Search Tree over a LinkedList. The TreeSet in the Java API uses balanced BSTs to store keys facilitating more efficient insertion and retrieval.

The benchmark plot below shows the linked list implementation in red performing poorly when compared to the logrithmic plot of a balanced BST represented in yellow.

Benchmark Plot:

Week 5 Benchmark Image

Tries have a potential performance advantage over TreeSets(Balanced BSTs) as the structure of the stored key is used to navigate the search.

BST only take advantage of their order relevant to each other.

Linked List Implementation: DictionaryLL class

TreeSet Implementation: DictionaryBST class

Trie Implementation: AutoCompleteDictionaryTrie class

...

About

Back-end code for Coursera course by University of California San Diego

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published