We can also use hashing to avoid building a graph. The idea is to first find the starting point. A starting point would never be on ‘to’ side of a ticket.
In order Successor in Binary Search Tree – Binary Search Tree – In order successor of a node is the next node in In order traversal of the Binary Tree.
Java Algorithm – Write a program function to detect loop in a linked list – Linked List – Given a linked list, check if the the linked list has loop or not.
Java Programming – LinkedList in java – Linked List – In Java, LinkedList class implements the list interface.This class consists of the following
Given an unsorted array that may contain duplicates. Also given a number k which is smaller than size of array. Write a function that returns true
Time Complexity: Depends on what sorting algorithm we use. If we use Merge Sort or Heap Sort then (-)(nlogn) in worst case.
Java Algorithm – Write a function to reverse a linked list – Linked List – Given pointer to the head node of a linked list, the task is to reverse
Java Algorithm – Next Greater Element – Stack – Given an array, print the Next Greater Element (NGE) for every element. The Next greater
Given two Linked Lists, create union and intersection lists that contain union and intersection of the elements present in the given lists.
Given two arrays: arr1[0..m-1] and arr2[0..n-1]. Find whether arr2 is a subset of arr1 or not. Both the arrays are not in sorted order.