Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ScalFMM
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
solverstack
ScalFMM
Commits
0b4570b3
Commit
0b4570b3
authored
May 16, 2014
by
PIACIBELLO Cyrille
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Old bug on QuickSort
parent
e282ccdf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
Src/Utils/FQuickSort.hpp
Src/Utils/FQuickSort.hpp
+26
-0
No files found.
Src/Utils/FQuickSort.hpp
View file @
0b4570b3
...
...
@@ -76,6 +76,32 @@ protected:
return
left
;
}
/* A local iteration of qs */
static
void
QsLocal
(
SortType
array
[],
const
CompareType
&
pivot
,
IndexType
myLeft
,
IndexType
myRight
,
IndexType
&
prefix
,
IndexType
&
sufix
){
IndexType
leftIter
=
myLeft
;
IndexType
rightIter
=
myRight
;
while
(
true
){
while
(
CompareType
(
array
[
leftIter
])
<=
pivot
&&
leftIter
<
rightIter
){
++
leftIter
;
}
while
(
leftIter
<=
rightIter
&&
pivot
<
CompareType
(
array
[
rightIter
])){
--
rightIter
;
}
if
(
rightIter
<
leftIter
)
break
;
Swap
(
array
[
leftIter
],
array
[
rightIter
]);
++
leftIter
;
--
rightIter
;
}
prefix
=
leftIter
-
myLeft
;
sufix
=
myRight
-
myLeft
-
prefix
+
1
;
}
/* The sequential qs */
static
void
QsSequentialStep
(
SortType
array
[],
const
IndexType
left
,
const
IndexType
right
){
if
(
left
<
right
){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment