Hi everyone, I took a stab at writing parallel BFS code using goroutines and the result isn’t great. I managed to write my approach but the time is inconsistent ( which kind of makes sense for cases where code doesn’t have to traverse the entire tree). So I passed a value that wouldn’t exist in the tree, so the control moves through the entire tree and the time came out worse than linear BFS.
Note: The problem statement is to check if a value exists in a tree or not using BFS.
I am looking for a review of the approach as well as any possible optimizations.
I don’t have any leads, except maybe my code spends a lot of time in the critical section.
link to the repo: GitHub - geekNero/Parallel-BFS
PS: I am new to golang