D
D
DartNyan2016-02-28 19:46:50
Programming
DartNyan, 2016-02-28 19:46:50

How popular are recursive functions?

Hello.
Student, 1st year.
The question arose: How popular are recursions in real or commercial development?
Are they used at all?
For example, in an indirect form for processing the same sequences of actions.

Answer the question

In order to leave comments, you need to log in

6 answer(s)
E
evgeniy_lm, 2016-02-28
@evgeniy_lm

Recursive functions are not pop singers. they don't need to be popular.
But the programmer needs to learn what recursive functions are and use them for their intended purpose.

O
Orekhov Alexey, 2016-02-28
@PokimonFromGamedev

Yes, of course they are used.
I would say that everywhere and everywhere.
But there are also classes of problems that are usually solved in a recursive form. For example tree traversal.

M
mofecuju, 2016-03-04
@mofecuju

Student, 1st year.
The question arose: How popular are recursions in real or commercial development?
Are they used at all?
For example, in an indirect form for processing the same sequences of actions.

What?
Your question sounds like this: I can’t learn how to pronounce R correctly, but how popular is the letter R.
You can certainly find statistics on how often this letter occurs. But why?
Recursion is a tiny and basic building block of a program.
It can be used more or less. You can not use it for months - if there are no tasks suitable for it.
But when you need to apply it, it should not make it more difficult for you than finding the letter R on the keyboard.

S
Saboteur, 2016-02-28
@saboteur_kiev

"How popular are recursions in real or commercial development?"
The question is too student.
Recursion is common. Real or commercial development is conventional development. If the problem is easier to solve with recursion, then it is solved with recursion.
For example, popular sorting algorithms that are used everywhere use recursion.

U
uvelichitel, 2016-02-28
@uvelichitel

Recursively, it is extremely convenient to write methods of recursive data structures like

type tree:   //псевдокод
      payload: node
      left:    tree
      right:   tree

An ordinary tree, try writing linear get() and put() loops for it. Possibly, but troublesome and not intuitive. And recursive data structures are a daily practice.
The most popular recursive function is QuickSort, until recently the built-in sort of almost all programming languages. Hoare wrote the qsort algorithm recursively, which is how it is usually implemented. And GNU == GNU's Not Unix

D
dude2012, 2016-02-29
@dude2012

As an example of a tree:
1) Recursion is used to process files in a directory.
Files are processed first, then directories are processed recursively.
Well, not only files, but structures in general organized in a similar way.
2) Localization of controls. There are controls on the panel, among which there are other controls and panels. It is necessary to change the name of the control to the value from the dictionary.
3) Tags and objects in the document. (XML, etc.)
4) Automation of the work of the organizational structure, for example, Active Directory. There is an organization, there are departments in it, in the department there are people (bosses ..) and other departments ...
5) Various catalogs with subdirectories of goods .. (when the nesting is not rigidly set and there are a lot of levels)
In short, this is basic knowledge that is used quite often. Without his knowledge, it is difficult to become a specialist, and when it is needed it is difficult to say, maybe now, or maybe never.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question