Tutor profile: Vamshi G.
Subject: Java Programming
How can Java use "multiple" inheritance even though it is technically does not allow multiple inheritance?
Through the use of multiple interfaces. Have any Java class implement more than one interface, recreating the multiple inherited hierarchy as every interface implemented by said class gives it the traits of the interface (or the pseudo-super class here) for each one.
Why is it best to use the midpoint riemann sum rather than a left or right?
Depending on the curvature of the graph, a left or right Riemann sum can either over or underestimate the amount of area calculated for each interval, which leads to larger error margins. The midpoint Riemann accounts for this somewhat by looking at both the left and right of an interval point, which usually negates any distortion in the amount of area calculated, making it the most useful out of the three for actual calculations.
Subject: C++ Programming
Why are arrays better than linked lists when pertaining to caching?
Arrays are contiguous in memory and thus retrieving an array will load all the contents of an array onto the same page, preventing fewer memory accesses to main memory allowing for much faster performance. In contrast, creating linked list objects does not guarantee this as each object can be on a different page, which leads to slower real world performance in comparison.
needs and Vamshi will reply soon.