Design Pattern
Design Pattern
Trie using a Linked Structure
Implemented an efficient Trie data structure to add and search words. Optimized the search functionality to find words containing specific contiguous letters (e.g., "ar") in O(n) time using strict Object-Oriented Programming (OOP) principles.
Binary Search Tree
The Tree contains Student objects. A student object contains first name, last name, red id, and GPA.
Implemented Patterns on Tree:
Internal Iterator
Strategy pattern
Null Object pattern
Visitor pattern
Internal Iterator: The iterator accepts a lambda and evaluates the lambda on all of the elements in the tree.
Strategy Pattern: Implemented three strategies. One to sort by Red Id.Another is to sort by the last name and then by the first name if the two last names are equal.For the third strategy, first round the GPA to the nearest integer. Then sort by rounded GPA and when equal use Red Id.
Null Object pattern: Add a null node to your tree to eliminate the need to check for null references or pointers in your tree.
Visitor pattern: Implemented two visitors, One to count the number of null nodes. Another is to compute the longest path in the tree and the average path length in the tree.
Etoy Program
A turtle object that moves on the 2D plane. At the start of a program we can add labels points on the plane.We will support the turtle moving and turning.
Goal is to create a small language that kids can use to program the turtle. We will not implement the graphics part of the program, even though that is a key part of EToys, Scratch and Turtle graphics. We are just interested in the section of the program that interprets the language
Interpreter Pattern: To take the turtle program and represent the program as abstract syntax trees which we can execute.
Successfully executed and Unit tested, ensuring the turtle reached the correct positions as specified in the programs.