diff --git a/hws/09_bplus_trees/README.md b/hws/09_bplus_trees/README.md index 6c7425c..2823b92 100644 --- a/hws/09_bplus_trees/README.md +++ b/hws/09_bplus_trees/README.md @@ -2,7 +2,7 @@ # Homework 9 — Online Shopping -In this assignment you will develop a program to manage the products for an online shopping platform, let's call this program New York Shopping. Please read the entire handout before starting to code the assignment. +In this assignment you will develop a program which implements and uses a B+ tree to manage the products for an online shopping platform, let's call this program New York Shopping. Please read the entire handout before starting to code the assignment. It is highly recommended that before you begin coding, you practice constructing a couple of B+ trees by hand and then checking your work with [this online visualization tool](https://www.cs.usfca.edu/~galles/visualization/BPlusTree.html). @@ -10,6 +10,22 @@ It is highly recommended that before you begin coding, you practice constructing - Practice implementing and using B+ tree data structures. +## Background + +### Range-based Searches + +Range-based searches refer to queries or searches where the desired result set encompasses a range of values within a certain criteria rather than just a single value. In other words, instead of searching for an exact match, range-based searches retrieve all values that fall within a specified range. For example, in an online shopping context, a range-based search might involve querying for all products (of some category) whose prices are within a specific range, such as between $50 and $100. + +Range-based searches are commonly used in various applications such as databases, search engines, data analytics, and more, where it's necessary to retrieve a subset of data that meets certain criteria rather than a single specific value. Efficiently executing range-based searches is crucial for optimizing performance and scalability in many systems. + +### Why B+ Trees? + +B+ trees is a preferred choice for systems where range-based searches are common operations. This is due to two properties of B+ trees: + +Ordered Structure: B+ trees maintain a sorted order of keys in their internal nodes. This property enables efficient range queries because adjacent keys are stored together, making it easy to find and traverse ranges of values. + +Balanced Tree: B+ trees are balanced, meaning the height of the tree remains relatively low, leading to efficient search operations. This balance ensures that the time complexity for search, insert, and delete operations remains logarithmic with respect to the number of elements in the tree. + ## Supported Commands Your program will be run like this: @@ -35,11 +51,16 @@ For all products fall into that price range, sort them based on the rating in a In this assignment, you are required to manage products using a B+ tree. There is no other requirement on what data structures you can use and what data structures you can not use. -Use good coding style when you design and implement your program. Organize your program into functions: don’t put all the code in main! Be sure to read the [Homework Policies](https://www.cs.rpi.edu/academics/courses/spring24/csci1200/homework_policies.php) as you put the finishing touches on your solution. Be sure to make up new test cases to fully debug your program and don’t forget to comment your code! Use the provided template [README.txt](./README.txt) file for notes you want the grader to read. -You must do this assignment on your own, as described in the [Collaboration Policy & Academic Integrity](https://www.cs.rpi.edu/academics/courses/spring24/csci1200/academic_integrity.php) page. If you did discuss the problem or error messages, etc. with anyone, please list their names in your README.txt file. +Use good coding style when you design and implement your program. Organize your program into functions: don’t put all the code in main! Be sure to read the [Homework Policies](https://www.cs.rpi.edu/academics/courses/spring24/csci1200/homework_policies.php) as you put the finishing touches on your solution. Be sure to make up new test cases to fully debug your program and don’t forget to comment your code! Use the provided template [README.txt](./README.txt) file for notes you want the grader to read. You must do this assignment on your own, as described in the [Collaboration Policy & Academic Integrity](https://www.cs.rpi.edu/academics/courses/spring24/csci1200/academic_integrity.php) page. If you did discuss the problem or error messages, etc. with anyone, please list their names in your README.txt file. **Due Date**: 04/11/2024, Thursday, 10pm. +## FAQs + +q1: How shall I choose the "b" of my B+ tree, since each node on the B+ tree can have at most b children. + +a1: It is your choice, choosing a different "b" may affect the performance of your program, and you should experiments with different "b"s. A larger "b" generally leads to fewer levels in the tree and faster operations, but it may increase the cost of splitting and merging nodes. + ## Rubric 20 pts @@ -51,7 +72,6 @@ You must do this assignment on your own, as described in the [Collaboration Poli - No credit (significantly incomplete implementation) (-6) - Putting almost everything in the main function. It's better to create separate functions for different tasks. (-2) - Function bodies containing more than one statement are placed in the .h file. (okay for templated classes) (-2) - - Missing include guards in the .h file. (Or does not declare them correctly) (-1) - Functions are not well documented or are poorly commented, in either the .h or the .cpp file. (-1) - Improper uses or omissions of const and reference. (-1) - At least one function is excessively long (i.e., more than 200 lines). (-1)