Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
allocation_dynamique
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PREMIERE
PROG_SEQ
allocation_dynamique
Commits
36e1d4bd
Commit
36e1d4bd
authored
3 years ago
by
abivarma.kandiah
Browse files
Options
Downloads
Patches
Plain Diff
Ex 7
parent
56fd67cf
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
header/tab_uni_malloc.h
+7
-0
7 additions, 0 deletions
header/tab_uni_malloc.h
src/main.c
+5
-0
5 additions, 0 deletions
src/main.c
src/tab_uni_malloc.c
+20
-0
20 additions, 0 deletions
src/tab_uni_malloc.c
with
32 additions
and
0 deletions
header/tab_uni_malloc.h
+
7
−
0
View file @
36e1d4bd
...
...
@@ -72,5 +72,12 @@ void CyclicSwapTab(int64_t *tab, int64_t tab_len, int64_t swap_times);
*/
int64_t
FindLowIndex
(
int64_t
*
tab
,
int64_t
tab_len
);
/**
@brief Tri par instertion Decroissant
@param [int] *tab, input table
@param [int] tab_len, table lenght
@return [void]
*/
void
TriInsertionDescent
(
int64_t
*
tab
,
int64_t
tab_len
);
#endif
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main.c
+
5
−
0
View file @
36e1d4bd
...
...
@@ -42,6 +42,11 @@ int main()
Swap
(
&
tab
[
FindLowIndex
(
tab
,
size
)],
&
tab
[
size
-
1
]);
PrintTableau
(
tab
,
size
);
//7.
TriInsertionDescent
(
tab
,
size
);
PrintTableau
(
tab
,
size
);
//8.
//Free the Malloc
free
(
tab
);
...
...
This diff is collapsed.
Click to expand it.
src/tab_uni_malloc.c
+
20
−
0
View file @
36e1d4bd
...
...
@@ -127,3 +127,23 @@ int64_t FindLowIndex(int64_t *tab, int64_t tab_len)
return
low_index
;
}
/**
@brief Tri par instertion Decroissant
@param [int] *tab, input table
@param [int] tab_len, table lenght
@return [void]
*/
void
TriInsertionDescent
(
int64_t
*
tab
,
int64_t
tab_len
)
{
for
(
int64_t
i
=
tab_len
-
2
;
i
>=
0
;
i
--
)
{
int64_t
tmp
=
tab
[
i
];
int64_t
pos
=
i
;
while
(
pos
<
tab_len
-
1
&&
tab
[
pos
+
1
]
>
tmp
)
{
tab
[
pos
]
=
tab
[
pos
+
1
];
pos
=
pos
+
1
;
}
tab
[
pos
]
=
tmp
;
}
}
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