Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abc
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
abc
Commits
c2b2e992
Commit
c2b2e992
authored
Feb 19, 2012
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added QuickSort based on 3-way partitioning.
parent
596bbbe6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
15 deletions
+15
-15
src/misc/util/abc_global.h
+5
-5
src/misc/util/utilSort.c
+10
-10
No files found.
src/misc/util/abc_global.h
View file @
c2b2e992
...
...
@@ -327,11 +327,11 @@ static inline int Abc_PrimeCudd( unsigned int p )
// sorting
extern
void
Abc_MergeSort
(
int
*
pInput
,
int
nSize
);
extern
int
*
Abc_MergeSortCost
(
int
*
pCosts
,
int
nSize
);
extern
void
Abc_QuickSort1
(
word
*
pData
,
int
nSize
,
int
fDecre
ment
);
extern
void
Abc_QuickSort2
(
word
*
pData
,
int
nSize
,
int
fDecre
ment
);
extern
void
Abc_QuickSort3
(
word
*
pData
,
int
nSize
,
int
fDecre
ment
);
extern
void
Abc_QuickSortCostData
(
int
*
pCosts
,
int
nSize
,
int
fDecre
ment
,
word
*
pData
,
int
*
pResult
);
extern
int
*
Abc_QuickSortCost
(
int
*
pCosts
,
int
nSize
,
int
fDecre
ment
);
extern
void
Abc_QuickSort1
(
word
*
pData
,
int
nSize
,
int
fDecre
ase
);
extern
void
Abc_QuickSort2
(
word
*
pData
,
int
nSize
,
int
fDecre
ase
);
extern
void
Abc_QuickSort3
(
word
*
pData
,
int
nSize
,
int
fDecre
ase
);
extern
void
Abc_QuickSortCostData
(
int
*
pCosts
,
int
nSize
,
int
fDecre
ase
,
word
*
pData
,
int
*
pResult
);
extern
int
*
Abc_QuickSortCost
(
int
*
pCosts
,
int
nSize
,
int
fDecre
ase
);
ABC_NAMESPACE_HEADER_END
...
...
src/misc/util/utilSort.c
View file @
c2b2e992
...
...
@@ -473,10 +473,10 @@ int Abc_QuickSort1CompareDec( word * p1, word * p2 )
return
1
;
return
0
;
}
void
Abc_QuickSort1
(
word
*
pData
,
int
nSize
,
int
fDecre
ment
)
void
Abc_QuickSort1
(
word
*
pData
,
int
nSize
,
int
fDecre
ase
)
{
int
i
,
fVerify
=
0
;
if
(
fDecre
ment
)
if
(
fDecre
ase
)
{
qsort
(
(
void
*
)
pData
,
nSize
,
sizeof
(
word
),
(
int
(
*
)(
const
void
*
,
const
void
*
))
Abc_QuickSort1CompareDec
);
if
(
fVerify
)
...
...
@@ -658,10 +658,10 @@ void Abc_QuickSort3Dec_rec( word * pData, int l, int r )
Abc_QuickSort3Dec_rec
(
pData
,
i
,
r
);
}
void
Abc_QuickSort2
(
word
*
pData
,
int
nSize
,
int
fDecre
ment
)
void
Abc_QuickSort2
(
word
*
pData
,
int
nSize
,
int
fDecre
ase
)
{
int
i
,
fVerify
=
0
;
if
(
fDecre
ment
)
if
(
fDecre
ase
)
{
Abc_QuickSort2Dec_rec
(
pData
,
0
,
nSize
-
1
);
if
(
fVerify
)
...
...
@@ -676,10 +676,10 @@ void Abc_QuickSort2( word * pData, int nSize, int fDecrement )
assert
(
(
unsigned
)
pData
[
i
-
1
]
<=
(
unsigned
)
pData
[
i
]
);
}
}
void
Abc_QuickSort3
(
word
*
pData
,
int
nSize
,
int
fDecre
ment
)
void
Abc_QuickSort3
(
word
*
pData
,
int
nSize
,
int
fDecre
ase
)
{
int
i
,
fVerify
=
0
;
if
(
fDecre
ment
)
if
(
fDecre
ase
)
{
Abc_QuickSort2Dec_rec
(
pData
,
0
,
nSize
-
1
);
if
(
fVerify
)
...
...
@@ -706,20 +706,20 @@ void Abc_QuickSort3( word * pData, int nSize, int fDecrement )
SeeAlso []
***********************************************************************/
void
Abc_QuickSortCostData
(
int
*
pCosts
,
int
nSize
,
int
fDecre
ment
,
word
*
pData
,
int
*
pResult
)
void
Abc_QuickSortCostData
(
int
*
pCosts
,
int
nSize
,
int
fDecre
ase
,
word
*
pData
,
int
*
pResult
)
{
int
i
;
for
(
i
=
0
;
i
<
nSize
;
i
++
)
pData
[
i
]
=
((
word
)
i
<<
32
)
|
pCosts
[
i
];
Abc_QuickSort3
(
pData
,
nSize
,
fDecre
ment
);
Abc_QuickSort3
(
pData
,
nSize
,
fDecre
ase
);
for
(
i
=
0
;
i
<
nSize
;
i
++
)
pResult
[
i
]
=
(
int
)(
pData
[
i
]
>>
32
);
}
int
*
Abc_QuickSortCost
(
int
*
pCosts
,
int
nSize
,
int
fDecre
ment
)
int
*
Abc_QuickSortCost
(
int
*
pCosts
,
int
nSize
,
int
fDecre
ase
)
{
word
*
pData
=
ABC_ALLOC
(
word
,
nSize
);
int
*
pResult
=
ABC_ALLOC
(
int
,
nSize
);
Abc_QuickSortCostData
(
pCosts
,
nSize
,
fDecre
ment
,
pData
,
pResult
);
Abc_QuickSortCostData
(
pCosts
,
nSize
,
fDecre
ase
,
pData
,
pResult
);
ABC_FREE
(
pData
);
return
pResult
;
}
...
...
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