e7d4b4deac667aa2c934567be2bd81e94d840c3f
3 private int int_array
[];
4 private int array_size
;
5 private int heap_head_index
;
7 private void setSize(int size
) {
11 private int getSize() {
15 private void setHeadIndex(int index
) {
16 heap_head_index
= index
;
19 private int getHeadIndex() {
20 return heap_head_index
;
24 int_array
= new int[size
];
29 public void empiler(int value
) {
31 int_array
[heap_head_index
] = value
;
34 System
.out
.println("La pile est pleine");
38 public int depiler() {
41 return int_array
[heap_head_index
];
47 public boolean plein() {
48 return (getHeadIndex() >= getSize());
51 public boolean vide() {
52 return (getHeadIndex() == 0);
55 public void afficher() {
56 for (int i
= 0; i
< getSize(); i
++) {
57 System
.out
.println("element " + i
+ " " + int_array
[i
]);
61 public static void main(String
[] args
) {
62 Pile heap
= new Pile(5);
72 System
.out
.println("Heap index " + heap
.getHeadIndex());
73 System
.out
.println("Heap head value " + heap
.depiler());
74 System
.out
.println("Heap index " + heap
.getHeadIndex());
75 System
.out
.println("Heap head value " + heap
.depiler());
76 System
.out
.println("Heap index " + heap
.getHeadIndex());
77 System
.out
.println("Heap head value " + heap
.depiler());
78 System
.out
.println("Heap index " + heap
.getHeadIndex());
79 System
.out
.println("Heap head value " + heap
.depiler());
80 System
.out
.println("Heap index " + heap
.getHeadIndex());
81 System
.out
.println("Heap head value " + heap
.depiler());
82 System
.out
.println("Heap index " + heap
.getHeadIndex());
83 System
.out
.println("Heap head value " + heap
.depiler());
84 System
.out
.println("Heap index " + heap
.getHeadIndex());