One of the most famous interview questions for beginners as well as Java developers with two-three years of experience is the difference between ArrayList and LinkedList. Before getting into differences, let’s understand the similarities between ArrayList and LinkedList so that ...

Floyd’s cycle-finding algorithm is a pointer algorithm that uses only two pointers, moving through the sequence at different speeds. It states the usage of Linked List in this algorithm and its output. The purpose is to determine whether the linked list ...

Introduction Concerning computer science, a sorting algorithm is used to arrange a given set of elements in a specific order. The most popularly used orders are numerical orders like ascending and descending order or lexicographical order in the case of ...

Depth-first search (DFS) is popularly known to be an algorithm for traversing or searching tree or graph data structures. The algorithm starts at the basis node (selecting some arbitrary node because the root node within the case of a graph) ...

A hash table is an unordered collection of key-value pairs, where each key is unique. Hash tables offer a combination of efficient lookup, insert and delete operations. They are used to implement map and set data structures in most common programming languages. In C++ and Java they are part of the ...

An equilibrium index of a sequence as we know it is an index into the sequence such that the sum of elements at lower indices is equal to the sum of elements at higher indices. For example, in a sequence ...

To put the elements in a particular order, sorting algorithms are used. The order can be anything from alphabetical to numerical, which can be ascending to descending. Consider a phone book directory, we may arrange the contacts on the basis ...

A maze is in the form of a 2D matrix in which some cells/blocks are blocked. One of the cells is termed as a source cell, from where we have to start. And another one of them is termed as ...

A Segment Tree is basically said to be an arrangement that permits answering range queries over an array effectively, while still being flexible enough to permit modifying the array. This includes finding the sum of consecutive array elements a[l…r], or ...

Introduction Binary search is the most widely used searching algorithm mostly in a sorted list. Its time complexity is O(long). The brute force way to search an element is searching through the entire list until the element is found. Did ...