Intro To Queues in C# 2022 (Step-By-Step Breakdown)

  Рет қаралды 4,099

Teddy Smith

Teddy Smith

Күн бұрын

Queue in C# 2022 For Beginner (Step-By-Step Breakdown)
Linkedin: / teddy-smith-015ba61a3
Website: www.teddysmith.io
Github: github.com/teddysmithdev

Пікірлер: 11
@Kindergarden-fp6eo
@Kindergarden-fp6eo 14 күн бұрын
Thank you for your lesson
@SaitamaTheLegend
@SaitamaTheLegend Жыл бұрын
You forgot to make the enqueue circular. Only the dequeue is circular in your example.
@hymus8627
@hymus8627 Жыл бұрын
I have question in Dequeue method when front == maxSize you make front = 0 but what about rear ? rear is still there when we Dequeue all and front start at 0 again we done cant do anything more becuz if I Enqueue more after we dequeue all it error becuz rear is == maxsize if we enqueue more index will out of bound can we reset rear to -1 too ? like this if(front == maxSize) { front = 0; rear = -1; } or it cannot because something ? can you tell me ?
@TasFirinErkegi
@TasFirinErkegi 9 ай бұрын
you can
@candice3172
@candice3172 11 ай бұрын
Dude if i just learn your playlist do you think i can be job ready ? Obviously i will put effort and practice regularly.
@TasFirinErkegi
@TasFirinErkegi 9 ай бұрын
Doing the job is easy hard part is getting hired.
@ronjohnson123
@ronjohnson123 4 ай бұрын
theres alot more to most jobs then just understanding algorithms haha
@mariomandzukic8676
@mariomandzukic8676 10 ай бұрын
Man you are teaching ppl wrong in queueue you shoud do front%maxsize and rare%maxsize and so that you can populate empty spaces for instance you have 1-9 first 2 leave and you have first 2 empty spaces and you add 2 more you get exepction you cant put 11 things cuz oyu have 10 max size and with rare+1%maxsize you will populate first 2 spaces since 10%10 =0
@chadgregory9037
@chadgregory9037 2 жыл бұрын
Dude Bojangles > Chik
@TeddySmithDev
@TeddySmithDev 2 жыл бұрын
After they took away the cheddar Bo, I just can’t look bojangles the same anymore lol
@kvelez
@kvelez 7 ай бұрын
using System; namespace ConsoleApp1 { internal class Program { static void Main(string[] args) { Queue queue = new Queue(6); queue.Enqueue(1); queue.Enqueue(2); queue.Enqueue(3); queue.Enqueue(4); Console.WriteLine(queue.Peek()); Console.WriteLine(queue.IsEmpty()); Console.WriteLine(queue.IsFull()); while (!queue.IsEmpty()) { Console.WriteLine(queue.Dequeue()); } } } public class Queue { public int MaxSize { get; set; } public int[] QueueArray { get; set; } public int Front { get; set; } public int Rear { get; set; } public int ItemPointer { get; set; } public Queue(int size) { MaxSize = size; QueueArray = new int[size]; Front = 0; Rear = -1; ItemPointer = 0; } public void Enqueue(int item) { if (IsFull()) { Console.WriteLine("Queue is full. Cannot enqueue."); return; } Rear = (Rear + 1) % MaxSize; QueueArray[Rear] = item; ItemPointer++; } public int Dequeue() { if (IsEmpty()) { Console.WriteLine("Queue is empty. Cannot dequeue."); return -1; // Return a default value (you can choose another approach) } int temp = QueueArray[Front]; Front = (Front + 1) % MaxSize; ItemPointer--; return temp; } public int Peek() { if (IsEmpty()) { Console.WriteLine("Queue is empty. Cannot peek."); return -1; // Return a default value (you can choose another approach) } return QueueArray[Front]; } public bool IsEmpty() { return ItemPointer == 0; } public bool IsFull() { return ItemPointer == MaxSize; } } }
I Need Your Help..
00:33
Stokes Twins
Рет қаралды 143 МЛН
Bro be careful where you drop the ball  #learnfromkhaby  #comedy
00:19
Khaby. Lame
Рет қаралды 44 МЛН
Cat story: from hate to love! 😻 #cat #cute #kitten
00:40
Stocat
Рет қаралды 14 МЛН
Smart girl 😱🤢 LeoNata family #shorts
0:23
LeoNata Family
Рет қаралды 2 МЛН
#rockpaperscissors! #kidsfun
0:11
J House jr.
Рет қаралды 47 МЛН
How to sign the letter J?❤️
0:47
Signature_1m
Рет қаралды 50 МЛН
Sigma girl have a good heart #shorts #tiktok #sigmagirl
0:37
mountainlion5
Рет қаралды 18 МЛН