-
Notifications
You must be signed in to change notification settings - Fork 1
Feedback #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
github-classroom
wants to merge
145
commits into
feedback
Choose a base branch
from
main
base: feedback
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feedback #1
Changes from all commits
Commits
Show all changes
145 commits
Select commit
Hold shift + click to select a range
df239d1
Setting up GitHub Classroom Feedback
github-classroom[bot] 780db61
struct: gradle init
homka122 24c34c5
struct: update .gitignore
homka122 6b4f63f
struct: get initial structure of files
homka122 d455921
struct: add license
homka122 523f8ba
feat: created an abstract node class
Demon32123 4a3b059
feat: created an abstract search tree class
Demon32123 95addd4
fix: сorrected methods insertNode, removeNode, createNode
Demon32123 b397449
feat: created a binary search tree node class
Demon32123 8ceb961
feat: created a AVL-Tree node class
Demon32123 a2d7ba2
fix: the order of the AVL-Tree node class attributes has been changed
Demon32123 d712b38
fix: classes AVL, BST and RBT nodes have been corrected
Demon32123 a18c27d
feat: сreated a binary search tree class
Demon32123 cfdd4ce
feat: сreated a AVL-Tree class
Demon32123 7471277
feat: сreated class red black tree node
Demon32123 d9aefd5
feat: сreated class red black tree
Demon32123 d077d9b
fix: corrected omissions in serch tree class and formatted code
Demon32123 5cae855
refactor: move RBTreeColor to seperate file
homka122 8abb345
refactor: add comments to methods of SearchTree
homka122 85b70bb
fix: traversal method's argument must be function
homka122 0b3bccd
refactor(BST): changed comment to method insertNode
far1yg d2dccc2
feat(BST): add method insertNode
far1yg 5727bfe
feat(BST): add constructors
far1yg 783a863
feat(BST): add method createNode
far1yg 8d9cf1b
feat(AVL-T): implemented method createNode
Demon32123 59ed960
feat(AVL-T): Implemented insertNode method along with auxiliary methods
Demon32123 2819604
feat(BST): add private method searchParentNode
far1yg f6a25f0
refactor(BST): remove ; in method insertNode
far1yg 71f5833
refactor(BST): remove ; in method createNode
far1yg 36db2a2
feat(BST): add private method getMinSubtree
far1yg d2a8972
feat(BST): add method removeNode
far1yg 3e2314e
refactor(BST): refactor method createNode
far1yg c5d66c8
refactor(BST): refactor method insertNode
far1yg 6fc787c
feat(BST): add method identifyChild, correct method removeNode
far1yg bbd3978
Merge pull request #4 from spbu-coding-2023/feature/bstree
far1yg 619020e
feat: add method search
far1yg 439e822
feat: implement searchNode method
homka122 add2326
feat: implement set with single key method
homka122 9e39564
fix: spell mistake
homka122 84f1abe
refactor(AVL-T): balancing has been moved to a separate method rebala…
Demon32123 41e2366
feat: implement postOrderTraversal
homka122 396c5a9
Merge pull request #5 from spbu-coding-2023/feature/searchTree/Homka
homka122 5f42f37
feat(RBT): implement createNode method
homka122 ddd5d3f
feat(RBT): implement rotation methods
homka122 8a415a3
feat(RBT): implement insertNode method
homka122 dd80525
feat(RBT): implement insertFix method
homka122 3213846
refactor(RBT): refactor insertFix method
homka122 0b67dce
feat(RBT): implement throwError() method
homka122 3f58a4d
refactor(RBT): refactor rotation methods
homka122 b78d2f6
fix(RBT): remove useless method that I did just for fun and forgeted …
homka122 8a2a2ac
feat(RBT): inherit constructors from SearchTree
homka122 9e0c75f
fix(RBT): fix bug in insertFix
homka122 3d8d788
refactor(RBT): refactor RBTree class, remove semicolons
homka122 b8c74a8
feat(RBT): add rbTransplant method
homka122 dc8f1f8
feat(RBT): implement removeNode method
homka122 5a5c4de
refactor(RBT): make minimum and removeNode prettier
homka122 dd6cf3e
feat(RBT): implement deleteFix method
homka122 359a1d9
refactor(RBT): delete useless method that throw error
homka122 d465c67
refactor(RBT): make names of methods prettier
homka122 3abdc84
refactor(AVL-T): implemented removeNode method along with auxiliary m…
Demon32123 1711e3c
feat: add method inOrderTraversal
far1yg 2711d2b
feat: add method predecessor
far1yg 9f36f12
feat: add method successor
far1yg 28f266a
feat: add method getMin
far1yg 012efc3
feat: add method getEntities
far1yg 5c94f1a
refactor: add empty line in methods getMin and inOrderTraversal
far1yg de5a3da
Merge branch 'main' into feature/searchTree/Nastya
homka122 aeb46ac
Merge pull request #8 from spbu-coding-2023/feature/searchTree/Nastya
homka122 d7a1184
feat: implements getKeys and getValues methods
homka122 379679f
refactor(AVL-T): added lines for easier code readability
Demon32123 c282e91
refactor(AVL-T): used ready-made variables for easy readability of th…
Demon32123 08fe10b
fix(AVL-T): fixed infinite loop bug in minValueNode
Demon32123 9eb8a43
Merge pull request #7 from spbu-coding-2023/feature/avltree
homka122 9dfde18
fix: change return type in method getEntities
far1yg bc3a9a5
fix: fix getValues and getKeys methods
homka122 904838f
Merge pull request #6 from spbu-coding-2023/feature/rbtree
homka122 cfb0356
feat: added set method for arrays
Demon32123 5af73f9
feat: added setIfEmpty method
Demon32123 8a08e5f
feat: added setIfEmpty method for arrays
Demon32123 6d632df
feat: added remove method
Demon32123 0ce04fa
feat: added remove method for arrays
Demon32123 fa83af8
feat: added getMax method
Demon32123 d51ebfa
feat: added clear method
Demon32123 f68a761
feat: added preOrderTraversal method
Demon32123 c5019db
refactor: optimized methods set, setIfEmpty, remove
Demon32123 361dbb5
Merge pull request #9 from spbu-coding-2023/feature/searchTree/Dima
homka122 0f3e410
test: add some basic tests
homka122 849c079
test: add jacoco support
homka122 48d8a53
test(RBT): add constructors tests
homka122 415270f
test: add test for BSTree
far1yg e0b74c7
test: add insert test and change remove test for BSTree
far1yg 6ba30e8
test:fix removeNode method in BSTree
far1yg 6c1184a
test(BST): refactor tests of method insertNode
far1yg 224c37a
refactor(RBT): make insertNode more readable and add comments
homka122 252a2aa
test(RBT): add helper methods for tests
homka122 336584a
test(RBT): add set tests
homka122 8a86df2
test(RBT): add universal set test
homka122 086ae28
test(RBT): add more set tests
homka122 253038b
test(RBT): add remove tests
homka122 7c88442
refactor(RBT): make methods prettier, add comments
homka122 ab6fb80
ci: add tests ci
homka122 2920dd9
ci: add tests ci
homka122 bc3d40a
test(BST): refactor tests of method createNode
far1yg c63ac83
test(BST): add tests of method removeNode
far1yg 613284c
test(BST): fix method removeNode
far1yg c1d3d17
Create README.md
homka122 60a1678
Merge pull request #11 from spbu-coding-2023/test
homka122 802c057
test(RBT): add more random values
homka122 e8a7c63
Create docs.md
homka122 ef36bf7
Move docs to another files and fix urls
homka122 09adfd6
test(BST): fix removeNode method
far1yg bbf901d
test(BST): add test for remove method
far1yg 4375e88
Merge pull request #12 from spbu-coding-2023/BSTtest
far1yg f3e3d3c
refactor(BST): make removeNode method prettier
homka122 4accdb8
test(AVL): add tests for set in AVL-Tree
Demon32123 07c3b2d
test(STree): add getting test
far1yg 3a96a74
test(STree): add search test
far1yg dd0fb8e
test(STree): add traversal tests
homka122 035fa06
test(AVL): add tests for remove in AVL-Tree
Demon32123 a1f921e
Merge pull request #13 from spbu-coding-2023/STreetest
homka122 e731a11
Merge pull request #14 from spbu-coding-2023/AVLtest
homka122 b10fe3e
test(BST): refactor remove tests
far1yg 7d58692
refactor: make method inOrderTraversal more prettier
far1yg 1764f72
refactor: delete empty line in method inOrderTraversal
far1yg 8748774
fix(STree): fix bug in method predecessor
far1yg e9220f8
test(STree): add cases in successor and predecessor tests
far1yg 2c26904
test(STree): refactor getting tests
far1yg 9f20685
test(STree): add cases in successor and predecessor tests
far1yg f70e08e
test(STree): add remove tests and refactor search tests
far1yg 2691d72
test(STree): add setting tests, add check in remove and search tests
far1yg dd776bd
test(STree): add setIfEmpty tests
far1yg 0a9ab71
test(STree): add Constructors tests
far1yg ccb1090
test(STree): add resently keys tests
far1yg f234f69
test(STree): group test of methods set
far1yg 6cc7249
test(STree): add case to constructor test
far1yg 74a11c2
test(STree): make setting, remove tests prettier
far1yg 05b6698
Merge pull request #15 from spbu-coding-2023/refactor/Nastya
homka122 2f431ef
fix(AVL-T): fix remove method in AVLTree
Demon32123 3e34279
fix(AVL-T): add new tests in remove test
Demon32123 ec9a09b
Merge pull request #16 from spbu-coding-2023/fix/Dima
homka122 8ab036c
refactor(STree): change if to when in method searchNode
far1yg 30f48a3
refactor(BST): change if to when in methods insertNode, identifyChild…
far1yg c6be325
test(STree): make set test in empty tree prettier
far1yg 810d36b
test(BST): use simplier way to create a tree to test
far1yg 3554f69
Merge pull request #17 from spbu-coding-2023/refactor/Nastya
far1yg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # | ||
| # https://help.github.com/articles/dealing-with-line-endings/ | ||
| # | ||
| # Linux start script should use lf | ||
| /gradlew text eol=lf | ||
|
|
||
| # These are Windows script files and should use crlf | ||
| *.bat text eol=crlf | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| name: Kotlin CI With Gradle | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ "main", "test" ] | ||
| pull_request: | ||
| branches: [ "main", "test" ] | ||
|
|
||
| jobs: | ||
| build: | ||
|
|
||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Set up JDK 17 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: '21' | ||
| distribution: 'temurin' | ||
|
|
||
| - name: Build with Gradle Wrapper | ||
| run: ./gradlew build | ||
|
|
||
| - name: Launch tests | ||
| run: ./gradlew :lib:test | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # Ignore Gradle project-specific cache directory | ||
| .gradle | ||
|
|
||
| # Ignore Gradle build output directory | ||
| build | ||
|
|
||
| .idea |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| Copyright 2024 Dmitry Sheiko, Anastasiia Kuzmina, Ilhom Kombaev | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| ## NamelessKitty.kt - library that appreciate your data ✨ | ||
|
|
||
| **NamelessKitty.kt** is library that help you work with your data by simple interface, using binary search trees under the hood. | ||
|
|
||
| <img src="https://github.com/spbu-coding-2023/trees-3/assets/39369841/2384c62a-a6c7-4fba-a2dc-02ee91b57d79" width="128"/> | ||
|
|
||
| ## ⚡️Quick start | ||
|
|
||
| ```kotlin | ||
| import tree.RBTree | ||
|
|
||
| fun main() { | ||
| val rbt = RBTree<Int, String>() | ||
|
|
||
| rbt.set(1, "Hello world") | ||
|
|
||
| println(rbt.search(1)) | ||
| } | ||
| ``` | ||
|
|
||
| Yes, that is really simple. \ | ||
| We Love KISS. | ||
|
|
||
| ## ✨ Features | ||
| - **Null-safety code** - We didn't use anything that could break your code | ||
| - **18 public methods** - Thanks to Dima | ||
| - **Simple interface** - Our library is easy to use and we proud of it | ||
| - **Easy to expand** - We provide simple abstact class that allow you create new type of trees and use it for your tasks | ||
| - **Generic types** - Use whatever you want types. We handle with it. | ||
|
|
||
| ## 👀 Examples | ||
|
|
||
| #### 📖 **Add array of data** | ||
| ```kotlin | ||
| import tree.RBTree | ||
|
|
||
| fun main() { | ||
| val data = arrayOf(122 to "Homka", 21 to "Dima", 25 to "Nastya") | ||
| val dataKeys = data.map { it.first }.toTypedArray() | ||
|
|
||
| val rbt = RBTree<Int, String>(data) | ||
| rbt.set(data) | ||
| rbt.remove(dataKeys) | ||
| } | ||
| ``` | ||
|
|
||
| #### 📖 **Print all data in ascending order** | ||
| ```kotlin | ||
| import tree.RBTree | ||
|
|
||
| fun main() { | ||
| val data = arrayOf(122 to "Homka", 21 to "Dima", 25 to "Nastya") | ||
|
|
||
| val rbt = RBTree(data) | ||
|
|
||
| rbt.inOrderTraversal { | ||
| println("key: ${it.first}, value: ${it.second}") | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| #### 📖 **Put only first incoming data** | ||
| ```kotlin | ||
| import tree.RBTree | ||
|
|
||
| fun main() { | ||
| val data = arrayOf(1 to "Homka", 2 to "Dima", 3 to "Nastya", 1 to "Homka") | ||
|
|
||
| val rbt = RBTree(data) | ||
|
|
||
| data.forEach { | ||
| val previousValue = rbt.setIfEmpty(it.first, it.second) | ||
|
|
||
| if (previousValue != null) { | ||
| println("Data with key: ${it.first} already exists and contain: ${previousValue}") | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## 🐤 Docs | ||
| [docs.md](https://github.com/spbu-coding-2023/trees-3/blob/main/docs.md) | ||
|
|
||
| ## 🐹 Gitbub stars | ||
| We love stars (ok, just me). I would be very pleased if you put a star on our project. \ | ||
|  | ||
|
|
||
| ## Contacts | ||
| - [Dmitry Sheiko](https://github.com/Demon32123) | ||
| - [Anastasiia Kuzmina](https://github.com/far1yg) | ||
| - [Homa Kombaev](https://github.com/homka122) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| ## 🐤 Docs | ||
| - We have three types of tree: BST, AVL, RBT | ||
| - Each tree has constructor that accept: | ||
| - Nothing (Empty tree) | ||
| - Key and Value | ||
| - Array of Pairs of Key\Value | ||
| - Each tree has these methods: | ||
| - `set(key: K, value: V): V?` \ | ||
| Stores the value for the given key. Return previous value. | ||
|
|
||
| - `set(pairs: Array<Pair<K, V>>): MutableList<V?>` \ | ||
| Stores the values for the given keys. Return previous values. | ||
|
|
||
| - `setIfEmpty(key: K, value: V): V?` \ | ||
| Stores the value for the given key if there is no pair with that key. Return previous value. | ||
|
|
||
| - `setIfEmpty(pairs: Array<Pair<K, V>>): MutableList<V?>` \ | ||
| Stores the values for the given keys if there is no pair with that key. Return previous values. | ||
|
|
||
| - `remove(key: K): V?` \ | ||
| Remove the value for the given key. Return previous value. | ||
|
|
||
| - `remove(keys: Array<K>): MutableList<V?>` \ | ||
| Remove the values for the given keys. Return previous values. | ||
|
|
||
| - `search(key: K): V?` \ | ||
| Return the value for the given key. | ||
|
|
||
| - `getKeys(): List<K>` \ | ||
| Returns a complete list of keys. | ||
|
|
||
| - `getValues(): List<V>` \ | ||
| Returns a complete list of values. | ||
|
|
||
| - `getEntities(): List<Pair<K, V>>` \ | ||
| Returns a complete list of pairs key value. | ||
|
|
||
| - `getMin(): Pair<K?, V?>` \ | ||
| Returns pair with the minimum key. | ||
|
|
||
| - `getMax(): Pair<K?, V?>` \ | ||
| Returns pair with the maximum key. | ||
|
|
||
| - `successor(key: K): Pair<K?, V?>` \ | ||
| Returns the pair with next ascending key. | ||
|
|
||
| - `predecessor(key: K): Pair<K?, V?>` \ | ||
| Returns the pair with previous ascending key | ||
|
|
||
| - `clear()` \ | ||
| Remove all keys in a tree. | ||
|
|
||
| - `preOrderTraversal(action: (Pair<K, V>) -> (Unit))` \ | ||
| Apply [action] on all pairs by preorder tree traversal. | ||
|
|
||
| - `inOrderTraversal(action: (Pair<K, V>) -> (Unit))` \ | ||
| Apply [action] on all pairs by inorder tree traversal. | ||
|
|
||
| - `postOrderTraversal(action: (Pair<K, V>) -> (Unit))` \ | ||
| Apply [action] on all pairs by postorder tree traversal. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # This file was generated by the Gradle 'init' task. | ||
| # https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format | ||
|
|
||
| [versions] | ||
| commons-math3 = "3.6.1" | ||
| guava = "32.1.3-jre" | ||
| junit-jupiter-engine = "5.10.0" | ||
|
|
||
| [libraries] | ||
| commons-math3 = { module = "org.apache.commons:commons-math3", version.ref = "commons-math3" } | ||
| guava = { module = "com.google.guava:guava", version.ref = "guava" } | ||
| junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit-jupiter-engine" } | ||
|
|
||
| [plugins] | ||
| jvm = { id = "org.jetbrains.kotlin.jvm", version = "1.9.20" } |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| distributionBase=GRADLE_USER_HOME | ||
| distributionPath=wrapper/dists | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip | ||
| networkTimeout=10000 | ||
| validateDistributionUrl=true | ||
| zipStoreBase=GRADLE_USER_HOME | ||
| zipStorePath=wrapper/dists |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Покрытие бы посчитать где-нибудь, как-нибудь... (или у вас есть где-то спрятанное и это я слепец -_-)