Queue Using LL || LinkedList || coding ninjas || java

Published: 21 July 2023
on channel: LIFE CODING WITH JAVA
252
5

‪@java62‬ #Queue #Using #linkedlist #codingninjas
Queue Using LL
Send Feedback
Implement a Queue Data Structure specifically to store integer data using a Singly Linked List.
The data members should be private.
You need to implement the following public functions :
1. Constructor:
It initialises the data members as required.
2. enqueue(data) :
This function should take one argument of type integer. It enqueues the element into the queue and returns nothing.
3. dequeue() :
It dequeues/removes the element from the front of the queue and in turn, returns the element being dequeued or removed. In case the queue is empty, it returns -1.
4. front() :
It returns the element being kept at the front of the queue. In case the queue is empty, it returns -1.
5. getSize() :
It returns the size of the queue at any given instance of time.
6. isEmpty() :
It returns a boolean value indicating whether the queue is empty or not.
Operations Performed on the Stack:
Query-1(Denoted by an integer 1): Enqueues an integer data to the queue.

Query-2(Denoted by an integer 2): Dequeues the data kept at the front of the queue and returns it to the caller.

Query-3(Denoted by an integer 3): Fetches and returns the data being kept at the front of the queue but doesn't remove it, unlike the dequeue function.

Query-4(Denoted by an integer 4): Returns the current size of the queue.

Query-5(Denoted by an integer 5): Returns a boolean value denoting whether the queue is empty or not.
Sample Input 1:
7
1 17
1 23
1 11
2
2
2
2
Sample Output 1:
17
23
11
-1
Sample Input 2:
3
2
1 10
4
Sample Output 2:
-1
1
I try to solve very easy concept So please watch this video .
All java code with easy trick.
By "LIFE CODING WITH JAVA". all program free no any cost So please like ,subscribe, share and comment.
If you any doubt related to any video then comment me. As soon as I will help you .
my contact number: 6206472735..
#LIFE CODING WITH JAVA
@java62
#java
#coding
#with java
#for loops in java
#patterns in java
#while loops in java
#arrays in java
#dynamic in java
#linked list in java
#queue in java
#stack in java
#binary search in java
#merge search in java
#dsa in java
#recursion in java
#arraylist in java
#function in java
#all oops concept in java
#queue
#explain all concept related to java
#history of java
#only java course
#full stack web development
#coding ninjas all questions


On this page of the site you can watch the video online Queue Using LL || LinkedList || coding ninjas || java with a duration of hours minute second in good quality, which was uploaded by the user LIFE CODING WITH JAVA 21 July 2023, share the link with friends and acquaintances, this video has already been watched 252 times on youtube and it was liked by 5 viewers. Enjoy your viewing!