Комментарии:
Striver Supremacy .
Ответитьus
Ответитьis this a circular queue?
ОтветитьUnderstood 💯💯💯
ОтветитьWouldn’t that be i%n instead of front %n
ОтветитьUnderstood
Ответитьunderstood
Ответить```
class Queue {
int *arr;
int f, r, count, size;
public:
Queue(int maxSize = 5000) {
size = maxSize;
f = r = count = 0;
arr = new int[size];
}
bool isEmpty() {
return count == 0;
}
void enqueue(int data) {
if (count == size) {
return;
}
r = r % size;
arr[r] = data;
count ++;
r ++;
}
int dequeue() {
if (count == 0) {
return -1;
}
f = (f + 1) % size;
count--;
return arr[f-1];
}
int front() {
if (count == 0) {
return -1;
}
return arr[f%size];
}
};
```
U are the Best!!!
Ответитьunderstood.
Ответитьevery time i see your videos i feel so much motivated. THANK YOU....
Ответитьu are the bestttt
Ответитьvector<int> q;
int front,rear,cnt,size;
// int *arr;
MyCircularQueue(int k) {
q = vector<int>(k,0);
front = 0,rear = -1,cnt = 0,size = k;
}
bool enQueue(int value) {
if(cnt==size) return false;
rear = (rear+1)%size;
q[rear] = value;
cnt++;
return true;
}
bool deQueue() {
if(cnt==0) return false;
front = (front+1)%size;
cnt--;
return true;
}
int Front() {
if(isEmpty()) return -1;
return q[front];
}
int Rear() {
if(isEmpty()) return -1;
return q[rear];
}
bool isEmpty() {
return !cnt;
}
bool isFull() {
return cnt==size;
}
please like if you find my code useful
understood!!
ОтветитьNice explanation your videos are really good...please keep on making such videos.
ОтветитьUnderstood
ОтветитьUnderstood
Thanks!
Isn't this the implementation of circular queue?
ОтветитьHello bhaiya,
I have one question... please reply...
I am a B.Sc(c.s) Student.
Please help me to know can I get a job(above 5 lpa).
I learnt enough C++ and completed DSA and going to start web development and also 3 star at codechef.
I can learn anything for job after Graduation.
Please help to me tell that can I get or I have to do MCA.
Bro your work is great but make some lightings proper and camera position like Anuj Bhaiya
ОтветитьBhaiya maths physics chemistry bhaut weak kya engineering kar lu ga please tell
ОтветитьRaj bhaiya iam starting coding but iam really feeling it tough,can u guide me please?How can I contact u?
ОтветитьStriver bhai op 🙌
ОтветитьCan you please make a video on sleeping patterns for programmers?
ОтветитьNice one bhai
ОтветитьBhaiya kya bond wali company me jana chahiye to 2 saal ka bond sign karaye? With 4.5 lpa
ОтветитьBro hats off for your hard work….liked the video for your teaching style
ОтветитьNycc videoo plzz upload more interesting concept
ОтветитьBro book allocation wala vdeo acha tha
ОтветитьAah how easily u make concepts easier !! Hats off !
ОтветитьHI Striver, i guess there may be a mistake in the implementation for a corner case.
when the front or rear goes above the size n, it has to be reassigned back with modulo n, rather than keeping it like that.
fornt = (fornt +1) %n;
because in case if front reaches INT_MAX, it automatically resets to 0 which may give a wrong value, which isn't intended
If we follow dsa from x path and then practice sde sheet by striver bahiya enough to crack dsa part of any company
ОтветитьYour assumption get correct this teaching style is very understandable. I saw your this 1st video board with teaching and I liked this 👍👍
ОтветитьUnderstood sir. .🙏
ОтветитьUnderstood bro....White board pr aur ache se smj aa rha hai..💯
ОтветитьThank you sir please stack and queues pura kar dena please 😅🙊
Ответитьwas waiting for this..
ОтветитьSir abhi kl hi to aaya tha ye video phir se kyo??
ОтветитьThank you
Ответить