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
!1
David
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
David
david.carballo/poo2019numeric:David
into
master
Overview
0
Commits
30
Pipelines
0
Changes
2
Open
david.carballo
requested to merge
david.carballo/poo2019numeric:David
into
master
5 years ago
Overview
0
Commits
30
Pipelines
0
Changes
2
Expand
merge de david vers master
0
0
Merge request reports
Viewing commit
b654219e
Prev
Next
Show latest version
2 files
+
51
−
10
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
b654219e
Ecriture de .peek(), pop(), et addAll() pour le BinaryHeap
· b654219e
tanguy.dietrich
authored
5 years ago
src/main/java/ch/hepia/structure/BinaryHeap.java
+
29
−
0
Options
@@ -23,6 +23,35 @@ final public class BinaryHeap
this
.
sort
();
}
public
int
peek
()
{
return
this
.
get
(
0
);
}
public
int
pop
()
{
int
val
=
this
.
peek
();
this
.
set
(
0
,
0
);
for
(
int
i
=
0
;
i
<
this
.
depth
();
i
++)
{
this
.
sort
();
}
if
(
this
.
size
()>
0
)
{
this
.
lstBinaryHeap
.
remove
(
this
.
size
()-
1
);
this
.
taille
--;
}
return
val
;
}
public
void
addAll
(
List
<
Integer
>
lst
)
{
for
(
int
val:
lst
)
{
this
.
push
(
val
);
}
}
public
boolean
isEmpty
()
{
if
(
this
.
size
()==
0
)
Loading