Queue Data Structure & Operations (Linked List Based) | C Programming Example

preview_player
Показать описание
How to implement a queue data structure in C using a linked list as the underlying data structure, including a library of functions that implement the operations enqueue, dequeue, peek, size and is empty.

Also see these videos on concepts used in this video...

Рекомендации по теме
Комментарии
Автор

Oooh baby! DS&A time.

Anyone discovering this channel for the first time, it’s a great resource.

lawniczakjohn
Автор

well thought-out narrative with a comprehensive and clear presentation.

dimitrioskalfakis
Автор

I appreciate the effort you put to teach us! Thank you sir!

martinnyagah
Автор

I appreciate the coding sources, If ı miss something which is important, ı can get it from the source code's subtitle. Thank you Mr. Kevin.

yigitcoban
Автор

You are the best. Thanks for all the help you provide.

Neberdine
Автор

returning null from qequeue() causes a warning with clang (idk about gcc). to fix it, just return 0 instead.

beholdenspore
Автор

This is an amazing video.
Thanks for your efforts.

fbi
Автор

Inside the while loop in the destroy_queue function, you created a temp variable which I think is unnecessary, because currentNode is enough to traverse. Consider this code and correct me if I'm wrong.
while (currentNode !=NULL){

free(queue->head);
queue->head=currentNode;
} // end of while
I know the difference may not be noticeable, but I think less variables are better.
Love your vids! Have a blessed day.

saad-jad
Автор

Hey, I love your tutorials, thanks a lot for you work, pointers and data structures haven been a bit difficult for me to learn but your explanations always help me understand them with ease.

I have a question: At the beginnning when you were defining the Node struct, you defined " typedef struct Node " and then typed "Node" again after the closing curly bracket. Why was the first "Node" needed? Since right after at the Queue struct definition you only set "Queue" once, after the closing curly bracket.

Also, inside the Node struct definition, you used " struct Node *next; " to define the pointer to the next value in the list, and I was wondering if the "struct" word was needed for that, since you already had defined an alias for that struct. Couldn't that line have been just " Node *next; "? Or can we not use aliases when working with pointers?

Thanks a lot again!

Matheusk
Автор

Can you please create a video on implementation of queue using array (or stack)

theayushagrawal
Автор

What happens if I don't use malloc to create the queue?

ivanraulsanchezdiaz
Автор

In enqueue, queue->tail->next = newNode; this should be wrong because tail points to NULL at that time. It should be a segmentation fault.

jjfan
Автор

Why not memset() to initialize the structure?

memset(queue, 0, sizeof(queue));

This ensures all bits are zero.

Don't tell me it is "unsafe". I know how to count! Many functions are only unsafe if you're stupid.

paradoxicalcat
Автор

Why do you talk like that? “Kudidastructure” 🤣

thesmug