开发者

Practical example of data-structures in computer study? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 8 years ago.

Improve this question 开发者_Go百科

My Friend faced an interview of IT company where they asked him Give Practical example of each data structure how this data structure can be used in computer study ??

Data Structures

  1. Stack
  2. Queue,Circular Queue
  3. Linked List,Doubly Linked list,Circular Linked list
  4. Tree,Binary Search Tree
  5. Graph
  6. Map and others like searching and sorting

(for example in Operating system for maintaing process queue [Queue data structure is used]like this for all others)

Example Related to Software Implementation and Computer Science,Operating system etc.

hoping for positive response


Some examples:

  1. Stack - Undo functions use this to pop most recent action off top of stack, then second most recent, etc.
  2. Queue - Process Scheduling normally uses a queue (how processes or threads are accessed after the initial work varies though)
  3. Tree - Directory traversal
  4. Binary search tree - searching quickly for a given element
  5. Graph - stores data so that you can think of it as a mathematical "plane" where the data is plotted. It is effective at representing (possibly) very complicated relationship between data, since (if you look at the image in the link) multiple "links" can exist between more than two pieces of data, as opposed to a linked list where you can only have a link to your left and to your right.
  6. Hash map - Searching for certain blocks of memory (i.e. when using many pointers) Hashing occurs when you have, say, an address book on your computer. It might use a hash map so that when you enter John Smith, his phone number and other information are available. This is because there is a hashing function that points to a certain location in memory when "John Smith" is entered. It would be a headache entering a memory address every time you wanted to access some simple information.
  7. Linked List - singly linked list offers movement in one direction between elements, doubly linked list offers movement back and forth between elements, and Circular linked list offers Circular navigation of similar objects (processes are one example) Use this when you want to be able to navigate between elements, because each element is linked to the next one and the one before it (for circular. noncircular linked lists have a beginning and an end). Imagine your web browser...you click "back" to go to the previous page, and you can click "forward" to go to the next. You can think of this as a linear linked list. A photo slide show that goes to the next or previous photo and then eventually starts at the beginning can be thought of as a circular linked list. (They're not necessarily implemented like that but it's a good way to visualize it)

Edited as per OP's request for more info on last structures.


A queue is often used to save a group of data in an organized structure so that it is easily accessed immediately when needed since its a FIFO (First in first out). However; when filling information into that queue when that queue is FULL the rest of the information is lost. To combat this the circular queue is used, which overwrites the other elements so that recent data is NOT lost.

An example of this like you mentioned would be the queue of resources of a computer. Because a computer does not have infinite resources a queue has to be used in order to allocate resources to those that need it. For instance a process would request some resources and it would be thrown into the queue and be given a priority level, based on this information the OS would then make a decision how much resources it needs and how much time it will be given. In order to allow multiple processes to make use of this, any process that has processing that needs to be done will put in a request in that queue.

A linked list has many applications that its not really possible to simplify it into one one. For instance, you could link accounts (objects) through the queue of the nodes of a element in the linked list. In a linked list, a node has a previous and a next node. Which effectively links all the elements together so that they can be traversed. Depending on the style of the linked list, which allows forward traversal, backward traversal, or both directions. One thing to note is that a linked list can be dynamic in terms of size since all that needs to be done to add a new note is just attach it to the end of the list. However; in terms of performance the speed of that would be O(N) which means that the performance is heavily dependent on the size of the list.

I hope this helps.


  1. Stack - any recursive call
  2. Queue,Circular Queue - all the FIFO algo use this
  3. Linked List,Doubly Linked list,Circular Linked list - all the RDBMS
  4. Tree,Binary Search Tree - Where searching is required. Memory is stored in B tree
  5. Graph - google maps
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜