Sat Dec 29 10:02:40 PST 2018
If you have just started learning Java and came from C background then you might have noticed some difference between Java and C programming language e.g. String is an object in Java and not a NULL terminated character array. Similarly, there is is no sizeof() operator in Java. All primitive values have predefined size e.g. int is 4 bytes, char is 2 byte, short is 2 byte, long and float is 8 byte and so on. But if you are missing sizeOf operator then why not let's make it a coding task? If you are Ok, then your next task is to write a method in Java, which can behave like sizeOf() operator/function of C and returns size in bytes for each numeric primitive types i.e. all primitive types except boolean. This week?s task is to implement binary search in Java, you need to write both iterative and recursive binary search algorithm . In computer science, a binary search or half-interval search is a divide and conquer algorithm which locates the position of an item in ...