Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
poo2019numeric
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
Model registry
Operate
Environments
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
steven.liatti
poo2019numeric
Merge requests
!2
Tanguy
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Tanguy
david.carballo/poo2019numeric:Tanguy
into
master
Overview
0
Commits
28
Pipelines
0
Changes
1
Open
tanguy.dietrich
requested to merge
david.carballo/poo2019numeric:Tanguy
into
master
5 years ago
Overview
0
Commits
28
Pipelines
0
Changes
1
Expand
merge request de tanguy vers master
0
0
Merge request reports
Viewing commit
433883ea
Prev
Next
Show latest version
1 file
+
48
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
433883ea
Ecriture de quelque fonction basique
· 433883ea
tanguy.dietrich
authored
5 years ago
src/main/java/ch/hepia/structure/BinaryHeap.java
+
48
−
2
Options
@@ -5,9 +5,55 @@ import java.util.ArrayList;
import
java.util.function.DoubleFunction
;
import
java.util.function.Function
;
final
public
class
BinaryHeap
{
final
public
class
BinaryHeap
{
final
private
List
<
Integer
>
lstBinaryHeap
;
private
BinaryHeap
()
{
lstBinaryHeap
=
new
ArrayList
<
Integer
>();
}
public
void
push
(
int
value
)
{
}
private
int
getRightNodeIndex
(
int
index
)
{
return
(
2
*
index
)+
1
;
}
private
int
getLeftNodeIndex
(
int
index
)
{
return
(
2
*
index
)+
2
;
}
private
BinaryHeap
()
{
private
int
getParentNodeIndex
(
int
index
)
{
return
(
index
-
1
)
/
2
;
}
private
int
getRightNodeValue
(
int
index
)
{
return
this
.
get
(
this
.
getRightNodeIndex
(
index
));
}
private
int
getLeftNodeValue
(
int
index
)
{
return
this
.
get
(
this
.
getLeftNodeIndex
(
index
));
}
private
int
getParentNodeValue
(
int
index
)
{
return
this
.
get
(
this
.
getParentNodeIndex
(
index
));
}
private
int
get
(
int
index
)
{
return
this
.
lstBinaryHeap
.
get
(
index
);
}
private
void
set
(
int
index
,
int
val
)
{
this
.
lstBinaryHeap
.
set
(
index
,
val
);
}
}
Loading