Java Tutorial Series - Data Structures

Data structures were introduced to manage the huge amount of java in an order. Choosing the appropriate Data structure is the most important and difficult part for any programmer.  Big corporate companies require candidates who are having extensive knowledge in data structures. Having said that, none of the interview completes without data structures principles asked.

The Need of the Data structures -
As the applications are getting complex and the data is increasing significantly, there may come a time where everyone can face below problems -


  1. Processor Speed - New processors are getting introduced in the market, consider an example of Smartphones which are having cutting-edge competition in bringing a new processor each and every 6 months in the year because of growing data.
  2. Data Search - Consider an example if you are searching for a friend's name in Facebook, how it's algorithm beings you the results out of like millions of its users in fractions of seconds, that is where they have optimized their data structure to bring you the result as early as possible.
  3. Multiple requests - Consider an example of e-commerce websites where billions of transactions are occuring each minute, so to handle these many requests at a time, it is paramount to handle multiple requests using the concept of data structures.
So to overcome all the above problems, data structures were introduced to organize the data as per the user needs, such that they get the required results instantly.

Advantages of Data Structures - 

  1. Efficiency
  2. Re-usability
  3. Abstraction
Data Structure Classification
Data structures in Java

Linear Data Structure - A linear data structure is the one where all its elements are arranged in a liner order having successor and predecessors elements except for the first and the last element.

Types of Data structure are given below with little description - 

Arrays - An array is a collection of similar data types, it's index starts from 0. It can be one dimensional, two dimensional and multi-dimensional. It is Static.

Linked List - Linked list maintains a list in insertion order. It can have non-contiguous memory locations and each node of the list contains a pointer to its adjacent node.

Stack - A collection of plates in a wedding reception is being practiced in Stack, where insertion and deletion can take place at only one end. Ever came across CD's holder, if you want to take out and CD which is in between you have to go in an order, similar concept is implemented across Data structure of Stack. Another example is a deck of cards.

Queue - Like the name goes, insertion takes place at one end(rear) while the deletion occurs at another end(front). It follows the FIFO analogy.

Non-Linear Data Structure- The Data structure that doesn't follow any sequence or order is called Non-Linear Data Structure. Each element can be connected to two or more elements in a non-linear arrangement.

Trees - Trees are multilevel data structures with a hierarchical relationship among its elements known as nodes. The bottommost node is called the leaf node and the topmost node is called the root node. Each node consists of pointers to point adjacent nodes. It is kind of a parent-child relationship between various nodes in a hierarchy.

Graphs - Pictorial representation of the set of elements.

 Now since the different types of data structures are clear by detail description, we can now move on what operations can we perform on different data structures.

Operation on Data Structures -

Traversing
Insertion
Deletion
Searching
Sorting
Merging

Each of these operations requires algorithms, an algorithm complexity can be divided as per -

Time Complexity - Amount of time to complete the operation

Space Complexity - Memory utilized to complete the operation

All these operations and Data structure implementation will be covered in the different tutorial, We hope you now have a basic introduction of Data structures.

Keep Learning and Keep Sharing!




Comments

Popular posts from this blog

Azure Tutorials Series - Azure Networking

Coforge Interview Questions | Automation Testing profile

Testing in CI/CD