Question

Array list, linked list, Stack, Queue, Binary tree, Hash table At least one application example combining...

Array list, linked list, Stack, Queue, Binary tree, Hash table

At least one application example combining data structure and algorithm should be given.

1 0
Add a comment Improve this question Transcribed image text
Answer #1

1.Array list :-

ArrayList is a part of collection framework and is present in java.util package. It provides us with dynamic arrays in Java. Though, it may be slower than standard arrays but can be helpful in programs where lots of manipulation in the array is needed. This class is found in java.util package.

Advantages:

  • ArrayList inherits AbstractList class and implements List interface.
  • Java ArrayList allows us to randomly access the list.
  • ArrayList can not be used for primitive types, like int, char, etc. We need a wrapper class for such cases.

Applications -

Arraylist class implements List interface and it is based on an Array data structure. It is widely used because of the functionality and flexibility it offers. Most of the developers choose Arraylist over Array as it’s a very good alternative of traditional java arrays. ArrayList is a resizable-array implementation of the List interface. It implements all optional list operations, and permits all elements, including null.

2.linked list:-

A linked list is a linear data structure, in which the elements are not stored at contiguous memory locations. The elements in a linked list are linked using pointers.

In simple words, a linked list consists of nodes where each node contains a data field and a reference(link) to the next node in the list.

Advantages

  1. There is no external fragmentation with linked allocation.
  2. Any free block can be utilized in order to satisfy the file block requests.

Disadvantages

  1. Random Access is not provided.
  2. Pointers require some space in the disk blocks.

Application -

Linked List allocation solves all problems of contiguous allocation. In linked list allocation, each file is considered as the linked list of disk blocks. However, the disks blocks allocated to a particular file need not to be contiguous on the disk. Each disk block allocated to a file contains a pointer which points to the next disk block allocated to the same file.

3.Stack:-

Stack is a linear data structure which follows a particular order in which the operations are performed. The order may be LIFO(Last In First Out) or FILO(First In Last Out).

Application-

There are many real-life examples of a stack. Consider an example of plates stacked over one another in the canteen. The plate which is at the top is the first one to be removed, i.e. the plate which has been placed at the bottommost position remains in the stack for the longest period of time. So, it can be simply seen to follow LIFO(Last In First Out)/FILO(First In Last Out) order.

4.Queue :-

A Queue is designed in such a way so that the elements added to it are placed at the end of Queue and removed from the beginning of Queue. The concept here is similar to the queue we see in our daily life, for example, when a new iPhone launches we stand in a queue outside the apple store, whoever is added to the queue has to stand at the end of it and persons are served on the basis of FIFO (First In First Out),

Applications:-

1) When a resource is shared among multiple consumers. Examples include CPU scheduling, Disk Scheduling.
2) When data is transferred asynchronously (data not necessarily received at same rate as sent) between two processes. Examples include IO Buffers, pipes, file IO, etc.

5. Binary Tree :-

A tree whose elements have at most 2 children is called a binary tree. Since each element in a binary tree can have only 2 children, we typically name them the left and right child.

A Binary Tree node contains following parts.

  1. Data
  2. Pointer to left child
  3. Pointer to right child

Application-

One reason to use trees might be because you want to store information that naturally forms a hierarchy. For example, the file system on a computer.

Binary Search Tree is a tree that allows fast search, insert, delete on a sorted data. It also allows finding closest item

6.Hash table :-

Hashing is an important Data Structure which is designed to use a special function called the Hash function which is used to map a given value with a particular key for faster access of elements. The efficiency of mapping depends of the efficiency of the hash function used.

Applications-

Suppose we want to design a system for storing employee records keyed using phone numbers. And we want following queries to be performed efficiently:

  1. Insert a phone number and corresponding information.
  2. Search a phone number and fetch the information.
  3. Delete a phone number and related information.
Add a comment
Know the answer?
Add Answer to:
Array list, linked list, Stack, Queue, Binary tree, Hash table At least one application example combining...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT