Code Monkey home page Code Monkey logo

dataalgorithm's Introduction

dataAlgorithm

My implementation of common Java data structure and Algorithm Coding Interview Questions. This questions were gotten from https://java2blog.com/data-structure-and-algorithm-interview-questions-in-java/

Stack

Question 1:  Implement a stack using array.
Question 2: Implement a stack using Linked List.
Question 3:  Implement a stack using two queues.
Question 4 : Sort an stack using another stack

Queue

Question 5:  Implement Queue using Array in java.
Question 6:  Implement a stack using two queues .

Linked List

Question 7 : Implement singly linked list in java.
Question 8: How to reverse linked list in java.
Question 9: How to find middle element of linked list.
Question 10 : How to find nth element from end of linked list .
Question 11 : How to detect a loop in linked list. If linked list has loop, find the start node for the loop.
Question 12: How to check if linked list is palindrome or not?
Question 13 :  Find intersection of two linked lists?
Question 14 :  How to reverse a linked list in pairs?
Question 15 :  Implement Doubly linked list in java?

Array

Question 16 : Write java Program to Find Smallest and Largest Element in an Array.
Question 17 : Find missing number in the array.
Question 18 : Search an element in rotated and sorted array.
Question 19 : Find minimum element in a sorted and rotated array.
Question 20: Find second largest number in an array
Question 21 : Find the number occurring odd number of times in an array
Question 22 : Find minimum number of platforms required for railway station
Question 23 : Find a Pair Whose Sum is Closest to zero in Array
Question 24 : Given a sorted array and a number x, find the pair in array whose sum is closest to x
Question 25 : Find all pairs of elements from an array whose sum is equal to given number
Question 26: Given an array of 0’s and 1’s in random order, you need to separate 0’s and 1’s in an array.
Question 27 : Separate odd and even numbers in an array
Question 28 : Given an array containing zeroes, ones and twos only. Write a function to sort the given array in O(n) time complexity.
Question 29 : Find local minima in array
Question 30 : Sliding window maximum in java
Question 31 : Count number of occurrences (or frequency) of each element in a sorted array
Question 32 : Find subarrays with given sum in an array.
Question 33 : Find peak element in the array.
Question 34 : Find leaders in an array.
Question 35 : Count 1’s in sorted Binary Array.
Question 36 : Find first repeating element in an array of integers.
Question 37 : Check if Array Elements are Consecutive.
Question 38 : Permutations of array in java.
Question 39 : Rotate an array by K positions.
Question 40 : Stock Buy Sell to Maximize Profit.
Question 41 : Find maximum difference between two elements such that larger element appears after the smaller number.
Question 42 : Search in a row wise and column wise sorted matrix.
Question 43 : Largest sum contiguous subarray.
Question 44 : Find the Contiguous Subarray with Sum to a Given Value in an array.
Question 45 : Longest Common Prefix in an array of Strings in java.
Question 46 : Find all subsets of set (power set) in java.

String

Question 47 : How to reverse a String in java? Can you write a program without using any java inbuilt methods?
Question 48 : Write a java program to check if two Strings are anagram in java?
Question 49 : Write a program to check if String has all unique characters in java?
Question 50 : How to check if one String is rotation of another String in java?
Question 51 : How to find duplicate characters in String in java?
Question 52 : Find first non repeated character in String in java?
Question 53 : Find all substrings of String in java?
Question 54 : Find length of String without using any inbuilt method in java?
Question 55 : Write a program to print all permutations of String in java?

Binary Tree

Question 56 : How can you traverse binary tree?
Question 57 : Write an algorithm to do level order traversal of binary tree?
Question 58 :  Write an algorithm to do spiral order traversal of binary tree?
Question 59 : How can you print leaf nodes of binary tree?
Question 60 : How to count leaf nodes of binary tree.
Question 61 : How to print all paths from root to leaf in binary tree.
Question 62 : How to find level of node in binary tree
Question 63 : How to find maximum element in binary tree.
Question 64 : How to find lowest common ancestor(LCA) in binary tree.
Question 65 : How to do boundary traversal of binary tree.
Question 66 : How to print vertical sum of binary tree?
Question 67 : Count subtrees with Sum equal to target in binary tree?

Binary Search tree

Question 68 : What is binary search tree?
Question 69 : Can you write algorithm to insert a node in binary search tree.
Question 70 : Can you write algorithm to delete a node in binary search tree.
Question 71 :  How can you find minimum and maximum elements in binary search tree?
Question 72 : How to find lowest common ancestor(LCA) in binary search tree.
Question 73 : Find inorder successor in a Binary search Tree
Question 74 : Convert sorted array to balanced BST
Question 75 : Convert sorted Linked List to balanced BST
Question 76 : Check if a binary tree is binary search tree or not in java

Sorting

Question 77 : Write an algorithm to implement bubble sort?
Question 78 : Write an algorithm to implement insertion sort sort?
Question 79 : Write an algorithm to implement selection sort sort?
Question 80 : Can you write algorithm for merge sort and also do you know complexity of merge sort?
Question 81 : Do you know how to implement Heap sort?
Question 82 : Implement quick sort in java?
Question 83 : Implement shell sort in java?
Question 84 : Implement Counting sort in java?
Question 85 : What is binary search? Can you write an algorithm to find an element in sorted array using binary search?

Graph

Question 86 : Write algorithm to do depth first search in a graph.
Question 87 : Write algorithm to do breadth first search in a graph.
Question 88 : Explain Dijkstra algorithm from source to all other vertices.
Question 89 : Explain Bellman Ford algorithm to find shortest distance
Question 90 : Explain Kruskal’s algorithm for finding minimum spanning tree

Dynamic Programming

Question 91 : Given two String, find longest common substring.
Question 92 : Given two Strings A and B. Find the length of the Longest Common Subsequence (LCS) of the given Strings.
Question 93 : Given a matrix, we need to count all paths from top left to bottom right of MxN matrix. You can either move down or right.
Question 94 : Edit Distance Problem in java
Question 95: Coin change problem in java
Question 96 : Minimum number of jumps to reach last index

Miscellaneous

Question 97 : What is an algorithm and how to calculate complexity of algorithms.
Question 98 : Implement trie data structure in java.
Question 99 : Count Factorial Trailing Zeroes in java.
Question 100 : Largest Rectangular Area in a Histogram.
Question 101 : Check for balanced parentheses in an expression in java.
Question 102 : What is Memoization.

dataalgorithm's People

Contributors

ayoolamakinde avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.