Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
alg-1-lab-assignments
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
20041679 .
alg-1-lab-assignments
Commits
f8c6ae50
Commit
f8c6ae50
authored
1 year ago
by
20041679
Browse files
Options
Downloads
Patches
Plain Diff
fix mergesort
parent
6a7040d3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
alglib/apps/playlist.c
+10
-10
10 additions, 10 deletions
alglib/apps/playlist.c
alglib/src/sort.c
+1
-1
1 addition, 1 deletion
alglib/src/sort.c
with
11 additions
and
11 deletions
alglib/apps/playlist.c
+
10
−
10
View file @
f8c6ae50
...
...
@@ -144,22 +144,22 @@ void playlist_sort(playlist_t playlist, playlist_sorting_criterion_t order_by)
* compar
* );
*/
// per l'ordinamento multi criterio può funzionare solo il merge sort perché
// è l'unico stabile tra i presenti
upo_merge_sort
(
playlist
->
entries
,
playlist
->
size
,
sizeof
(
*
(
playlist
->
entries
)),
compar
);
/*
* upo_
merge
_sort(
* upo_
quick
_sort(
* playlist->entries,
* playlist->size,
* sizeof(*(playlist->entries)),
* compar
* );
*/
// penso che per l'ordinamento multi criterio debba funzionare solo questo perché è l'unico
// stabile ma risultano alcune tracce messe dove non dovrebbero essere
upo_quick_sort
(
playlist
->
entries
,
playlist
->
size
,
sizeof
(
*
(
playlist
->
entries
)),
compar
);
*/
}
...
...
This diff is collapsed.
Click to expand it.
alglib/src/sort.c
+
1
−
1
View file @
f8c6ae50
...
...
@@ -84,7 +84,7 @@ static void upo_merge_sort_merge(
unsigned
char
*
curr1
=
(
unsigned
char
*
)
base1
+
i1
*
size
;
unsigned
char
*
curr2
=
(
unsigned
char
*
)
base2
+
i2
*
size
;
unsigned
char
*
currtmp
=
tmp
+
(
i1
+
i2
)
*
size
;
if
(
cmp
(
curr1
,
curr2
)
<
0
)
{
if
(
cmp
(
curr1
,
curr2
)
<
=
0
)
{
memcpy
(
currtmp
,
curr1
,
size
);
++
i1
;
}
else
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment