Question
Which data structure is most suitable for implementing
recursion?Solution
A stack is the most suitable data structure for implementing recursion. This is because recursive calls need to store the state of the current function execution before jumping into the next function call. Stacks follow the Last In, First Out (LIFO) principle, which perfectly suits the recursive function call structure. Why Other Options are Wrong: b) A queue follows First In, First Out (FIFO), which doesn’t support the nature of recursion. c) Linked lists can be used for dynamic memory but are not suitable for managing function calls in recursion. d) Arrays have a fixed size and do not inherently support LIFO behavior. e) Hash tables are for storing key-value pairs and have no role in recursion.
When do spring tides occur?
Two sound waves have frequencies 256 Hz and 260 Hz. The beat frequency is:
A car travels 300 m in 20 seconds. What is its average speed?
The magnetic field inside a long straight solenoid is:
An example of longitudinal waves (in a gas medium) is:
In a logic gate, the output is 1 only when at least one input is 1. This gate is:
Which instrument is primarily used to measure the relative density of liquids by utilizing the principle of buoyancy?
A ray of light is incident on a transparent medium at an angle of 60°. The reflected ray of light is found to be completely Q.4 polarized. Then, the r...
A particle is fired with initial speed 30 m/s and lands back at same horizontal level. If its horizontal range is equal to 4.5 times the vertical height...
An object moves towards a convex lens of focal length 20 cm with a velocity of 5 cm/s. When the object is at 30 cm from the lens, find the rate at which...