Coding Interview in Java - Top four things to follow
As a Developer, we all have to go through coding interview for any level job. So here we will seen how we can crack coding interviews.
Point to prepare before going to coding interview in Java :
- Java in-built classes and its methods
- Java collection framework and its hierarchy
- Data structure and algorithms
- Follow coding standards
1. Java in-built classes and its methods
Java have so many in-built classes and its method like, String, StringBuffer, StringBuilder, Array, etc.
These classes and its methods is so useful in our every coding life. So before coding interview, we must have to gain knowledge about classes and its frequently used methods.
- String : length(), split(), charAt(), indexOf(), equals(), trim().
- Array : sort(), length (not a method).
- Math : abs(), pow(), max(), min().
- System
- Scanner
These are just a few examples of Java in-built classes and their
methods. Java has a rich set of classes and libraries to help us to perform a variety of tasks.
2. Java collection framework and its hierarchy
Collection is must to know in Java. We can not imagine java language without collection framework.
Learn more about collection framework and its hierarchy :
Some of the main components of the Java Collection Framework include:
Interfaces : The framework includes several key interfaces, including Collection, List, Set, Map, SortedSet, SortedMap, and Queue.
Classes : The framework also includes several implementation classes, such as ArrayList, LinkedList, HashSet, TreeSet, HashMap, and TreeMap.
Algorithms : The framework provides a set of algorithms for sorting, searching, and manipulating collections, such as sort(), reverse(), shuffle(), and min().
Iterators : The framework provides an efficient way of iterating through collections with the Iterator interface and its implementation classes.
Learn more about Iterator in Java :
3. Data structure and Algorithms
Arrays and Strings:
- Common string operations such as reversal, palindrome check, string compression, etc.
- Sorting algorithms like Bubble Sort, Insertion Sort, Quick Sort, and Merge Sort.
- Searching algorithms like Linear Search and Binary Search.
- Array data structure such as Dynamic Array, ArrayList, and 2D Array.
Linked Lists:
- Singly Linked List, Doubly Linked List, and Circular Linked List.
- Linked List operations such as insertion, deletion, reversal, and merging of two linked lists.
Stacks and Queues:
- Stack operations such as push, pop, peek, and isEmpty.
- Queue operations such as enqueue, dequeue, and isEmpty.
Trees:
- Types of trees such as Binary Tree, Binary Search Tree, AVL Tree, and Heap.
- Tree operations such as insertion, deletion, traversal, and searching.
- Applications of trees like searching for a specific node, finding the minimum or maximum node, and creating a balanced tree.
Graphs:
- Types of Graphs such as Undirected Graph, Directed Graph, Weighted Graph, and Unweighted Graph.
- Graph algorithms such as DFS, BFS, Dijkstra's Algorithm, and Prim's Algorithm.
Recursion:
- Understanding the concept of Recursion and how it can be used to solve problems in a simpler manner.
- Common Recursion problems like Tower of Hanoi, Fibonacci Series, and Backtracking.
4. Follow coding standards
Naming conventions : Use descriptive and meaningful names for variables, methods, and classes. Java uses CamelCase for variables, methods, and classes.
Indentation and White Space : Use proper indentation to make the code more readable. Follow consistent white spacing and line breaks.
Use of Braces : Always use braces for the control statements, even for single-line statements.
These are some of the basic standards to follow while coding in Java.
Comments
Post a Comment