### 3 Define the graph Data Structure?

It is a type of non-linear data structure that consists of vertices or nodes connected by edges or arcs to enable storage or retrieval of data. Edges may be directed or undirected.Â

### 4) Mention what are the types of Notation used for Time Complexity?

The types of Notations used for Time Complexity includes

**Big Oh:**It indicates “fewer than or the same as”

**Big Omega:**It indicates “more than or same as”

**Big Theta:**It indicates “the same as”

**Little Oh:**It indicates “fewer than”

**Little Omega:**It indicates “more than”

## Java Algorithms Interview Questions and Answers

Letâs take a look at some popular Java algorithms interview questions that you can practice for your tech interview:

**Q1. What are the different types of tree traversal algorithms?**

There are broadly four types of tree traversals, and each type has algorithms that help us achieve that type of traversal. The four types are inorder traversal, preorder traversal, postorder traversal, and level order traversal.

**Q2. What are some of the most used sorting algorithms?**

This is a commonly asked Java algorithms interview question. It tests your basic conceptual knowledge. Hereâs how you can answer this: Quicksort, merge sort, heap sort, and insertion sort are some of the most used sorting algorithms.Â

**Q3. What are some examples of greedy algorithms?**

Travelling Salesman problem, Knapsack problem, job scheduling problem, Prims, Kruskals, and Dijkstras Minimum Spanning Tree algorithms, Map coloring in Graphs, and Vertex cover in graphs are some examples that utilize greedy algorithms.

**Q4. Give some examples of divide and conquer algorithms.**

Binary Search, Merge Sort, Quick Sort, and Strassens Matrix Multiplication are some examples of divide and conquer algorithms.

**Q5. What is the fastest searching algorithm?**

Binary search is usually the fastest searching algorithm and is most widely used for efficient searching as well.

### 3 List the types of trees?

Data structure interview questions like this are very common and frequently asked

A tree is referred to as a generic tree if its hierarchy is not constrained. In the General Tree, each node can have an endless number of offspring, and all other trees are subsets of the tree.

The binary tree is a type of tree in which each parent has at least two offspring. The children are referred to as the left and right youngsters. This tree is more popular than most others. When specific limitations and features are given to a Binary tree, various trees such as AVL tree, BST (Binary Search Tree), RBT tree, and so on are also utilized.Â

Binary Search Tree (BST) is a binary tree extension that includes numerous optional constraints. In BST, a nodes left child value should be less than or equal to the parent value, while the correct child value should always be higher than or equal to the parents value.

The AVL tree is a self-balancing binary search tree. The term AVL is given in honor of the inventors Adelson-Velshi and Landis. This was the first tree to achieve dynamic equilibrium. Each node in the AVL tree is assigned a balancing factor based on whether the tree is balanced or not. The node kids have a maximum height of one AVL vine.

Red-black trees are another type of auto-balancing tree. The red-black term is derived from the qualities of the red-black tree, which has either red or black painted on each node. It helps to keep the forest in balance. Even though this tree is not perfectly balanced, the searching process takes just O (log n) time.

In this sort of tree with a node, N is the maximum number of children. A binary tree is a two-year tree since each binary tree node has no more than two offspring. A full N-ary tree is one in which the children of each node are either 0 or N.

A binary tree is a tree data structure made up of nodes, each of which has two offspring, known as the left and right nodes. The tree begins with a single node called the root.

Each node in the tree carries the following information:

A pointing device indicates the left kid.

An arrow pointing to the correct child