Question

In: Computer Science

Python What are the advantages and disadvantages of solving a problem that can be broken down...

Python

What are the advantages and disadvantages of solving a problem that can be broken down into repetitive tasks with recursion as opposed to a loop? Explain your answer.

Sometimes Graphical User Interfaces can be too cluttered. What is a good general rule of thumb for the number of elements on a page within a Graphical User Interface? Explain your answer.

Solutions

Expert Solution

Recursion:

The recursive function calls to itself and a terminate or base condition is specified which breaks the infinite execution of the recursive call. When the function call to itself then it works like a continue statement and the control goes to the starting of the function with updated argument value.

The stack data structure is used in recursion for storing the intermediate value when each function call is made.

In a recursive function, two cases are mentioned:

  1. Base condition
  2. Recursive call

Base condition:

A terminate condition or base condition is specified which breaks the infinite execution of the recursive call.

Recursive Call:

The function will call to itself and this is known as a recursive call.

Advantages:

  • The recursive function reduces the complexity of the code.
  • It can solve some problems in an easy way as compared to the iterative method.
  • It is better at tree traversal.

Disadvantages:

  • It uses more memory as compared to the iterative method.
  • It is is not implemented correctly then it can be very slow.
  • It uses more processor time and it is very difficult to trace an error.

Iterative or loop:

The iterative statement like for() loop, while() loop, do-while() loop, etc uses the iterative statement and allows the set of instructions to be repeatedly executed. These statement includes initialization, condition, and update the control variable and repeatedly executed until a certain condition is reached.

Difference between iterative and recursive program:

  • In a recursive program, the function call to itself and recursion is always applied to functions. In the iterative program, a group of statements or a single statement is executed repeatedly.
  • The stack data structure is used in recursion for storing the intermediate value when each function call is made but in the iterative program, the stack is not used.
  • Recursion is very dangerous as compare to the iteration because infinite recursion can crash our system.

When we should use recursion?

Recursion is more efficient than a regular loop when we solve a problem that can be broken down into smaller repetitive problems. When the iterative solution is too complex and has many possible branches then the recursion method is more efficient.

When we should use iterative method?

The stack data structure is used in recursion for storing the intermediate value when each function call is made. If the stack space is large enough then memory overflow may occur. If memory overflow is the major issue then we should use the iterative method.

OR

Graphical user interface is a subset of user interface which includes graphical elements such as windows,icons and buttons.Graphical user interface are exclusively controlled by mouse and keyboard.GUI allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, instead of text-based user interfaces, typed command labels or text navigation.

Advantages and disadvantages of GUI opposed to the command line:

>CLI stands for command line interface which is most difficult to use when compared to GUI.In CLI we use command prompt to enter our input where as in GUI we use input can be entered anywhere on the screen.

>CLI is text based interface which is used to interact with software and operating systems by typing commands from the command prompt.Examples :There are two main operating systems use CLI are DOS for windows and bash shell for linux and os.

>The users of GUI are provided with immediate visual feedback in many cases whereas in CLI there is no obvious feedback .So, most of the people prefer GUI which is easy to use than CLI.

>CLI can perform some tasks which are difficult  and cannot be performed by GUI.In terms of functionality CLI is preferred most than GUI.

>GUI is used in some cases where we can have minimum stress and to reduce mental work as it can simplfy tasks and makes results visible.

>CLI can be used for some cases where tasks are needed to be scriped and automated.To use this we need to have greater control over system functions.CLI utilizes less memory version.

>GUI has the higher ability to perform multiple tasks at the same time very easily where as CLI cannot perform with the same ease.GUI cannot have same level of functionality and granual control over systems as CLI.

>Precision is high in CLI and low in GUI.Custom changes can be employed in GUI where appearance cannot be changed in CLI.

>There are over 270 commands available for functions such as open,delete..These commands must be used correctly without mistakes.

>The disadvantages of GUI include :it is harder to implement and requires lot of memory,more hardware and software requirements are needed.

>GUI can be handled by a biggener where as CLI user must have some knowledge over commands and how to make use of it.

Sometimes graphical user interface can be too cluttered because of the layout designed.The designers might understand and have clear knowledge about their design but the other people cannot understand it.In that case a designer should think with others percpectives and make a good design which is easy to understand.

>The journey of the customers must be carefully navigated and focus on a single goal in order to meet the needs of a customer.

>For productive page, the designer must use spaces and highlighten the words which are important ,gaps between discriptions.The designer should not use more than three colours in a single layout.

>HAving too much text can also make some GUI clutter.It might overwhelm your customers and distract them from taking the right action.

Good general rule of thumb for the number of elements on a page with graphical user interface:

>Rule of thumb is a general procedure based on experience or praactice.

>The general rule for designing a good GUI is:Match between the sytem and real world,i.e. the deisgner should design a layout whiuch is celan and clear where people can understand and make better use of it.For this, the designer must follow certain principles like Paying attention to the context and contrast,avoiding more whitespaces,never highlighten the background.

>Error prevention is also a major good rule of thumb.

i hope it helps..

If you have any doubts please comment and please don't dislike.

PLEASE GIVE ME A LIKE. ITS VERY IMPORTANT FOR ME


Related Solutions

what are the advantages and disadvantages of globalization, and can the current problem ( COVID 19)...
what are the advantages and disadvantages of globalization, and can the current problem ( COVID 19) be effect of globalization and global competition? show your argument?
What are the advantages and disadvantages of globalization, and can the current problem (COVID 19) be...
What are the advantages and disadvantages of globalization, and can the current problem (COVID 19) be effect of globalization and global competition? show your argument?
What are the advantages and disadvantages of globalization? The advantages and disadvantages of globalization can change...
What are the advantages and disadvantages of globalization? The advantages and disadvantages of globalization can change depending on whether or not they are being evaluated from a social or economic perspective. From an economic standpoint, globalization has provided ample opportunity for a number of American businesses to grow exponentially. Globalization has also had a large impact on how businesses are structured by altering supply chains which has arguably led to greater efficiency as well as lowering the cost of manufacturing...
The manipulation of the LIBOR can be broken down into three phases. What were these and...
The manipulation of the LIBOR can be broken down into three phases. What were these and how did they differ in terms of motivation and moral justification?
What are the advantages and disadvantages of brick-and-mortar stores? What are the advantages and disadvantages of...
What are the advantages and disadvantages of brick-and-mortar stores? What are the advantages and disadvantages of online stores? Which are there more of and how will this trend continue? Please answer in complete sentences with an overall total of 150 words or more.
(a) Total investment risk can be broken down into two types of risk. What are these...
(a) Total investment risk can be broken down into two types of risk. What are these two types of risk and which should NOT affect expected return? (b) A firm has a beta of 1.2. The expected market return is 12% and the risk-free rate is 2%. What should be the firm’s equity cost of capital?
What are some of the advantages and disadvantages of social networking and how it can be...
What are some of the advantages and disadvantages of social networking and how it can be used in career development? -Include specific examples of social media in your discussion. -Discuss the importance of mentors
What are advantages and disadvantages of Preferred Stock? Do they outweigh the advantages and disadvantages of...
What are advantages and disadvantages of Preferred Stock? Do they outweigh the advantages and disadvantages of Common Stock?
What are the advantages and disadvantages of IRR?
What are the advantages and disadvantages of IRR?
What are the advantages and disadvantages of the NMOS?
What are the advantages and disadvantages of the NMOS?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT