Submitted by heartin on Sat, 05/14/2016 - 09:07
Submitted by heartin on Fri, 05/13/2016 - 20:31
Please follow the below guidelines for answering questions.
-
Answer within the question bank itself, without changing the name.
-
Color your answers with blue color.
-
Color your execution results in yellow color. Sometimes you might be asked to first answer without trying out and then actually try compiling/executing it. This step is not mandatory.
Submitted by heartin on Sun, 05/08/2016 - 23:17
Problem:
Find the middle element of linked list in one Pass.
Approach:
You can use the runner technique.
Two pointers can be used and both will be running at separate speeds. One runner pointer can go in two steps at a time and other pointer can go in one step at a time. Second one will always cover half the distance as that of the other. When one reaches the end, other will be be middle.
Submitted by heartin on Sat, 04/30/2016 - 22:32
This is a quick summary of important keywords and reserved words that you should not be using as an identifier. Identifier is a name given to any class, method, interface, enum or variable that we create. There is also added quick notes section with few important keywords that may be useful for exam or interview preparations.
Keywords in Java
-
class, interface, enum(added in 5.0), package, import, new, this, super, return, void.
Submitted by heartin on Sat, 04/30/2016 - 21:55
Based on the scope in which the variable is declared, we can classify variables as Class variables, Instance Variables and Local variables.
Class variables (or static variables)
Class variables (or static variables) uses the static keyword. Class variables (or static variables) are declared within a class and outside all methods
Example: Static variable
class MyClass{
Pages