[Data structure] I want to know the actual use of the queue and stack!!

Asked 2 years ago, Updated 2 years ago, 107 views

Hello! I am personally studying algorithms and data structures through studies

For list, such as single linked list, double linked list, etc.

I can understand why it is implemented differently even though it is the same list.

In the Q and Stack parts, there are relatively few examples of dating, so I don't know.

Is there any part of the stack that is normally implemented and used? The conclusion that the researchers came up with?can implement something like a priority operator using a stack of "computers" That's all. I want to know other examples.

Also, I saw an example of the priority queue being used to implement alignment or heap, and I am wondering if there are any actual cases of using common queues, circular queues, deque, etc

I thought about "scheduling in os" as an example of priority queue Of course, I don't think I'll actually use the queue, but is there any problem if I conclude that it can be "scheduling" as an example of using concept of priority queue??

algorithm data-structure

2022-09-22 21:39

1 Answers

Queues and stacks are the most commonly used data structures.

The implementation takes into account the performance of the operation, so you can think of a variety of methods.

Conceptually, the queue has the characteristics of first-in-first-out (if you use the first registered one), and the stack has the characteristics of first-in-first-out or second-in-first-out (if you use the last registered one first).

When you want to solve a problem, you can consider whether you want to queue or stack, depending on which of the characteristics above apply.

You'll use it a lot when you learn algorithms right now. In particular, it's a lot of work that requires you to determine the order in which to navigate a particular material. For example, the data structure you use depends on whether you meet a junction in a maze (for example, a fork in a maze), whether you solve each branch in order (width-first search-BFS-queue), and whether you have solved one branch first and the next (depth-first search-DFS-stack).

If you encounter situations in other practical problems that correspond to the concepts described above, the data structure will usually choose between a queue and a stack. It's just one way to store and retrieve data. In other words, you can think of a queue or a stack as a hammer or a screwdriver.

Finally, what we learn in data structure class is to understand the tools of extension to develop programs. There are many uses and methods to use, such as hammers, spanners, jangdori, flat-blade screw drivers, and cross-screw drivers, and the data structure is to learn the extensions necessary for programming.

In traditional solutions, there is a commonly used data structure, and if you understand the data processing characteristics required from the perspective of problem solving, you will decide which data structure should be used.

How to use the tools you learned should be judged according to the situation. You can solve the problem without having to use it the way others say (for example, hammering with a spanner... This is how you use it, "Is that right? It's more advanced to think over and over about "Was that choice the best?" than to ask "Was it wrong?"

The answer is a bit longer.


2022-09-22 21:39

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.