Basic CS-Data Structures [Redpine Infotech Placement]: Sample Questions 4 - 4 of 4

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 4

Describe in Detail Essay▾

In which data structure recursion can be used?

Edit

Explanation

Define Stack Applications
  • Stacks and queues can use data structure recursion.
  • Stacks and queues allow elements to be popped and pushed.
  • Each recursion removes one element from stack or queue and perform the function.
  • Recursion is a special case of nested functions where calls are to the same function, or the same function is called in a cyclic manner.
  • Most recursions use the call stacks because it is simpler to write and read.
  • The call stack usually has limited space, is more expensive perform-wise, and program can run out of space since the call stack is not managed by the program.
  • Big stacks are thus declared explicitly and allocate on the heap.