4.4 Circular Queue in Data Structure | Circular Queue using Arrays in C | DSA Tutorials
ฝัง
- เผยแพร่เมื่อ 25 ส.ค. 2024
- In this lecture I have described circular queue implementation using arrays as well as analyzed the drawback of Linear Queue. I have written C program for implementation of queue using arrays.
DSA Full Course: https: • Data Structures and Al...
******************************************
See Complete Playlists:
C Programming Course: • Programming in C
C++ Programming: • C++ Complete Course
Python Full Course: • Python - Basic to Advance
Printing Pattern in C: • Printing Pattern Progr...
DAA Course: • Design and Analysis of...
Placement Series: • Placements Series
Dynamic Programming: • Dynamic Programming
Operating Systems: // • Operating Systems
DBMS: • DBMS (Database Managem...
**********************************************
Connect & Contact Me:
Facebook: / jennys-lectures-csit-n...
Quora: www.quora.com/...
Instagram: / jayantikhatrilamba
#jennyslectures
#datastructures
#circularqueue
#ugcnet
#course
I was searching here and there, and finally got a crystal clear concept of the circular queue.
This also made me realize the mistakes I have done in learning the Linear queue.🙏🏽
I have never understood an algorithm and simply liked it as this.
You are the best I've seen👌.
Congrats Prof Jenny on this work👏👏.
We need more Guru's like you because in college all they teach is how to complete the whole syllabus in a very efficient way.
You explain it clearly and practically. I understood the concept quickly that I didn't understand by our faculty prof. They just excel at taking salaries and teaching in traditional ways, which is invaluable for us.
Hats off to ya!
Ma’am you are honestly the best teacher thank you so much I am going to pass my course because of you much appreciation!!!!
I would like to thank you for all the efforts you put into your videos just to make the life of us(students) better,
i have been watching and following your videos for some time now and have seen that no one teaches the way you do and
thank you for helping us and making our concepts just like yours i.e,clear as crystal !!!
BY watching this video, I remembered one of my favorite teacher who teaches dedicatedly like really an expert. You are a professional dedicated and expert in teaching crystal clear concepts. Thank you so much mam.😇
Today I got it in 10 years 😁
Bhai partyyyyyyyyyyyyy🎉
@@vinayak186f3 he will give party after 10 more years
Brother/Sister do you have a job?
Poor you 😭
😂😂😂
You are the reason that i passed the exam. Thanks a lot, ma'am. 🙏🙏
I can't say thank you enough, this is the night before my exam and your video just helped me A LOT! I hope you doing well.
A request to all viewers... Please share this channel 🥺.. Her teaching skills deserves more views
U R the best teacher to teach this hard concepts easily . I have never seen this like lecture 😍🥰👌👌
Ma'am u are a wonderful teacher. I like how u explain concepts with all the possibilities of occurrences. Kuddos to ur dedication. Thankyou so much for these videos ma'am.
You are just superb ma'am!!!
I've been watching this DSA playlist and I've become a fan of yours.
Thank you so much ma'am for teaching me this valuable knowledge.
I never interested to learn DS. I am Java professional. But by seeing your insertion sort video first time by mistake immediately I subscribed your channel.. love your way of explanation.. are you a trainer or IT professional? Can I know please..
What a great video indeed mam! Thank you so so so much mam :) Anyone who is looking for there concepts to get cleared, this video is the way to go!
FINALLY I understood this after browsing over the internet and going through all my notes trying to figure out wth is this. thank you
Thank you Jenny! This video is so helpful and your explanations are detailed,, clear and concise. I love how you traced out each and every instance of the values as they went through the array. Keep up the great work!
Really your concepts are really clear. It's very easy to understand from your video
Ma'am your videos really help me in the exam time
As the result of it I have score 70% in my diploma exams held by bter Jodhpur really for are god to me.
Thanks a lot ma'am
Charismatic Personality. Clear Concepts. Respect one word for U Ma'am
I think I am watching this playlist for a month and I just want to comment on each video of yours that how a good teacher you are!!
Thank u so much ma'am!!
Modulo
3%5 = 0.6(ans)
Then take first digit of ans,and multiply with 5
0*5 = 0(ans2)
And subtract 3 with (ans2)
3-0 = 3
I hope everyone understand how to mod
Is it the process?
@@sambedansahooridul1237 no bro. All u need to understand is when you use % operator then the quotient cannot be a decimal number and the remainder is the the answer. For eg 2 % 5 = remainder obtained after dividing 2 by 5. So quotient is 0 and remainder is 2
i have a doubt if we enqueue more than 5 time then the rear goes to the zeroth position then and over write stack[0]
words are not enough to explain her expertise in this subject🙏
Ma'am you are literally अवतार of सरस्वती. Thank You so much for making me understand this crystal clear ❤️
Got it at once..... really great !!!!
My DSA GOD's🙏Jenny's Mam💖 & Neso Academy💓
Fantastic explanation 😍,even my professor will not explain in this manner.Thank u💞❣️
Thanks a lot ma'am you served as a last minute blessing for my board exams
include
#include
#include
#define size 5
int cq[size];
int front=0,rear=0;
void display()
{
int i;
printf("
The circular queue is : ");
if(front
Broooooooooooo wtf
👍
@@shantanusingh280 It seems like he made quite some errors in enqueue function. Have a go with this one, this code is working.
#include
#include
#include
#define N 5
int f=-1,r=-1;
void insert(int[],int);
void disp(int[]);
void del(int[]);
void main()
{
int q[N],ch,item;
do
{
printf("
1.Insert
2.Display
3.Delete
4.Exit
Enter your choice:");
scanf("%d",&ch);
switch(ch)
{
case 1:
printf("
Enter element to store on circular queue:");
scanf("%d",&item);
insert(q,item);
break;
case 2:
disp(q);
break;
case 3:
del(q);
break;
case 4:
exit(0);
default:
printf("
Invalid choice:");
}
}while(ch!=4);
getch();
}
void insert(int q[N],int item)
{
if((r+1)%N==f) //full condition
printf("
Overflow");
else if (f==-1 && r==-1) //for inserting first data into queue
{
f=0;
r=0;
q[r]=item;
}
else //if some data are already stored
{
r=(r+1)%N;
q[r]=item;
}
}
void del(int q[N]) //deletion
{
if(f==-1)
printf("
Underflow");
else if(f==r) //for deleting last element in queue
{
printf("
deleted item: %d",q[f]);
f=-1;
r=-1;
}
else //for deleting element which is not last lol
{
printf("
Deleted item:%d",q[f]);
f=(f+1)%N;
}
}
void disp(int q[N])
{
int i=f;
if(f==-1) //empty
printf("
Underflow");
else
{
while(i!=r)
{
printf("
%d",q[i]);
i=(i+1)%N;
}
printf("
%d",q[r]); //for displaying last value
}
}
@@iimoon777wrong, not working with your full condition in insertion
@@RahulGPT-A
#include
#include
#include
#define N 5
int f=-1,r=-1;
void insert(int q[N],int item)
{
if((r+1)%N==f || r==N-1 && f==0) //full condition
printf("
Overflow");
else if (f==-1 && r==-1) //for inserting first data into queue
{
f=0;
r=0;
q[r]=item;
}
else //if some data are already stored
{
r=(r+1)%N;
q[r]=item;
}
}
void del(int q[N]) //deletion
{
if(f==-1)
printf("
Underflow");
else if(f==r || f==-1) //for deleting last element in queue
{
printf("
deleted item: %d",q[f]);
f=-1;
r=-1;
}
else //for deleting element which is not last lol
{
printf("
Deleted item:%d",q[f]);
f=(f+1)%N;
}
}
void disp(int q[N])
{
int i=f;
if(f==-1) //empty
printf("
Underflow");
else
{
while(i!=r && r!=-1)
{
printf("
%d",q[i]);
i=(i+1)%N;
}
if(r!=-1)
printf("
%d",q[r]); //for displaying last value
}
}
void main()
{
int q[N],ch,item;
do
{
printf("
1.Insert
2.Display
3.Delete
4.Exit
Enter your choice:");
scanf("%d",&ch);
switch(ch)
{
case 1:
printf("
Enter element to store on circular queue:");
scanf("%d",&item);
insert(q,item);
break;
case 2:
disp(q);
break;
case 3:
del(q);
break;
case 4:
exit(0);
default:
printf("
Invalid choice:");
}
}while(ch!=4);
getch();
}
some weird it worked in a different application, how about now?
mam you are gifted from data structure god how can you make these confusion thing are very simple you teach the circular queues amazing you are the super teacher in the world of data structure
Your method of teaching is best.
I learned So much Part Of DSU from you Thanks Mam❤
Afterall You are Sooooo Beautiful😍
such a great explanation. code works perfectly. totally satisfied . thank you mam.
mam your classes are very helpfull and thankyou heartfully ,you are amazing with lectures.
Rear=rear+1%N is same as rear++%N.
Display function in for loop will be
For(i=front;i
Bro this solves display() function error....thanks a lot✌️
I learn lots of things today.
Thanks 👍 ma'm.
Mrs. Jenny , You #deserve the "The Best Professor Award".
Well done Jenny. You make me proud. You were always one of my favourite student in college
this is c language program and it's worked for me
#include
#define n 5
void enqueue(int);
void dequeue();
void peek();
void display();
int queue[n];
int front=-1;
int rear=-1;
int ch,num;
void main()
{
do
{
printf("
1.enqueue
2.dequeue
3.display
4.peek
enter choice: ");
scanf("%d",&ch);
switch (ch)
{
case 1: printf("
enter a number:");
scanf("%d",&num);
enqueue(num);
break;
case 2: dequeue();
break;
case 3: display();
break;
case 4: peek();
break;
default: printf("
invalid option");
}
} while(ch);
}
void enqueue(int num)
{
if((rear+1)%n==front)
{
printf("
overflow");
} else if (front==-1){
front=rear=0;
queue[rear]=num;
} else{
rear=(rear+1)%n;
queue[rear]=num;
}
}
void dequeue()
{
if(front==-1){
printf("
underflow");
} else if(front==rear){
printf("
dequeued element is %d and now queue is empty",queue[front]);
} else{
printf("
dequeued element is %d",queue[front]);
front=(front+1)%n;
}
}
void peek(){
if(front==-1){
printf("
queue is empty");}
else {
printf("
top most element is %d",queue[front]);
}
}
void display()
{
if(front==-1){
printf("
queue is empty");}
else{
for(int i=front;i!=rear;i=(i+1)%n){
printf("\t%d",queue[i]);
}
printf("\t%d",queue[rear]);
}
}
Thank you mam so much for explaining it in such a easy way... You are always helping me whenever I face difficulty in solving certain programs...☺️☺️
you are a genius in teaching
You are simply superb. Awesome way of teaching the DS.
Mam You are the best teacher in the world.Thank You so much.
Mam you teaching is so nice now I understand the concept practically so easily
Very HELPFUL, FINALLY UNDERSTOOD AFTER WATCHING THIS LECTURE 🎉
Amazing video mam, nice explanation....
but one modification or correction for Display
// Use do while
int i = f;
do{
System.out.print(a[i]+" ");
i = (i+1)%n;
}while(i != f);
System.out.println();
thanks
Mam, i just wanna say that i love you. You always save my life. I don't fckin know what my lecture gave to me when class but you explain it really well. Thankyou very much! I won't ever skip ur ads!
your efforts for teaching us is priceless mam.
Your hard work different from other.
Mam your teaching and explanation techniques are V.G
Thank you so much ma'am. It's really helpful. Your all playlist helps the most for every students.thanks a lot god bless you.
I was wondering how you teach things so welll....god bless u mam
super method of teaching mn to soch raha hun pehly q ni mila ap ka Chanel ♥️♥️♥️♥️♥️♥️♥️♥️♥️♥️♥️♥️♥️
One of the easiest way to solve complex programs.....Best part is focusing mainly on logic of functions and calling them one-by-one to show their functionality.
Ma'am a huge thanks. It helps me a lot and lot.
One Kind request. I only understood Longest Increasing Subsequence (LIS) by seeing your video only. Can you please do the same for Longest Palindromic Subsequence/ Substring?
I just love the pronunciation of EMPTY. And the video is great
that smile at 15:55, when u successfully explain something amazing.
Antha particularga ela chusaav bro nvu
Very easy way of writing code and easy explanation.
Thanks mam for making this video in 2019 due to which I can refer this if I dont understand in online college .
Thank you very much. You are a genius.
Mam, you are really helpful ♥️
I passed ds because of u mam
Ma'am you are an excellent teacher!! Thank you soo much!!
Keep making Videos because you are the best teacher.
I appreciate the fact that you guys gave me this recognition. Thanks.
Thank You, Maa'm. Your beautiful explanation helps me a lot. 🥰
ma'am ur videos are really very help full for me.I watched many videos but ur explainations are best i must say i got something really very helpul video
You're brilliant mam you're teaching style is very fantastic
Thank u so much maam for clearing the concepts in such a beautiful manner..💙..plzz post a video on dequeue also....plzz maam🙏🙏
How about making a video on Priority Queue (with array & linked list implementation)?
Thank you very much mam. Really u r helping many students to learn ds in an understanding way
every one is telling ma'am your video is good very helpful for us then please give me one like to this video . just telling in words is not good also who helped you .you people also help them .it gives motivation to teachers .
Wow you explained in such an amazing way.
You have superb teaching skills...
People like you are the hope for good education in india
Nice video mam.
We can use ( i != Rear+1) instead of writing printf outside the while loop.
Thanks for your comment ☺️ finally solved my error
bro it will not run the loop only for the first iteration.
Love your teaching andyour efforts. Thank you ma'am
ma'am please cover operation on queue, deques and priority queue please ma'am!
Ma'am can you please make a video on what exactly is time complexity? And what's time complexity of different different algorithms.
+1
O(1)
O(n)
Great lecture mam.
Thank u so much .… Finally I got it
Thank you mem it is really very helpful for me
Thank you so much ma'am... Your way of teaching is too good... Thanks alot ma'am...
mam tower of hanoi and best case worst case average case time complexcity video koro na akta.....khub helpful hobe...tomar video chara r kono you tube video bhoja jaina.. tumi khub bhalo explain koro...
love uh mam you save me & my time You are great person in the world..
It was the only topic that felt difficult to me but right now I really want to thank you mam for the explanation..... Doubts are clear now!!!!
Very Great All things cover Teaching method very nice
Ma'am you are an amazing teacher, keep up this great work ,may god bless you!!!
The front will be at the first location only. It won't point to other locations. The other values will be shifted when dequeued operation is performed.
Thank you very much madam to learn this hard concept very easily 🙏🏻🙏🏻
Thank you for your great and easiest explanation mam.
excellent presentation..good ..
Thank you for great explanation and putting so much effort mam 🙏
Perfectly explained!! so helpful!! I'd like to know what's the statement that deletes the element. Thanks
Thank u Ma'am
Thanku so so much mam ... 🙏🙏🙏 For explaining so simply and beautifully.. 💥💥
thank you, I found the video very helpful
Very Nice explanation
Your lecture are very benefitial. Thanks mam
no one does this better than her for sure
Very helpful
way of explanation was awesome ma'am
Time of programming other things : Harry bahi 😍
When last day exam preparation : Jenny 😎