Skip to content
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

QuickSort implementation on undirected graph #14

Open
st235 opened this issue Mar 2, 2024 · 1 comment
Open

QuickSort implementation on undirected graph #14

st235 opened this issue Mar 2, 2024 · 1 comment

Comments

@st235
Copy link

st235 commented Mar 2, 2024

Hello everybody,

Can someone, please, explain to me a small quicksort implementation detail in the UndirectedGraph class.

In the method selectPivotIndex there is an early return block

	if (startIndex - endIndex <= 1)
		return startIndex;

It seems that this condition is always true. That's totally fine for the quicksort implementation as the pivot could be any element in between startIndex and endIndex, though the heuristic after this block would be obsolete. Is it correct?

@rohanmohapatra
Copy link
Owner

Ah now I get it, do you see a case where it is failing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants