translation: Add Python and Java code for EN version (#1345)

* Add the intial translation of code of all the languages

* test

* revert

* Remove

* Add Python and Java code for EN version
This commit is contained in:
Yudong Jin
2024-05-06 05:21:51 +08:00
committed by GitHub
parent b5e198db7d
commit 1c0f350ad6
174 changed files with 12349 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
/**
* File: queue.java
* Created Time: 2022-11-25
* Author: krahets (krahets@163.com)
*/
package chapter_stack_and_queue;
import java.util.*;
public class queue {
public static void main(String[] args) {
/* Initialize queue */
Queue<Integer> queue = new LinkedList<>();
/* Element enqueue */
queue.offer(1);
queue.offer(3);
queue.offer(2);
queue.offer(5);
queue.offer(4);
System.out.println("Queue queue = " + queue);
/* Access front element */
int peek = queue.peek();
System.out.println("Front element peek = " + peek);
/* Element dequeue */
int pop = queue.poll();
System.out.println("Dequeued element = " + pop + ", after dequeuing" + queue);
/* Get the length of the queue */
int size = queue.size();
System.out.println("Length of the queue size = " + size);
/* Determine if the queue is empty */
boolean isEmpty = queue.isEmpty();
System.out.println("Is the queue empty = " + isEmpty);
}
}