Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Programming in C Based on the control transfer, the algorithms are categorized in the following three types. (i) Deterministic: Deterministic algorithm is based on either

Programming in C Based on the control transfer, the algorithms are categorized in the following three types. (i) Deterministic: Deterministic algorithm is based on either to follow a 'yes' path or 'no' path based on the condition. In this type of algorithm when control comes across a decision logic, two paths 'yes and 'no' are shown. Program control follows one of the routes depending upon the condition. Example: Testing whether a number is even or odd. Testing whether a number is positive or negative. (ii) Non-deterministic: In this type of algorithm to reach to the solution, we have one of the multiple paths. Example: To find a day of a week. (iii) Random algorithm: After executing a few steps, the control of the program transfers to another step randomly, which is known as a random algorithm. Example: A random search Another kind of an algorithm is the infinite algorithm. Infinite algorithms: This algorithm is based on better estimates of the results. The number of steps required would not be known in advance. The process will be continued until the best results emerged. For final convergence more iterations would be required. Example: To find shortest paths from a given source to all destinations in the network. 1.17?FLOWCHARTS A flowchart is a visual representation of the sequence of steps for solving a problem. It enlightens what comes first, second, third, and so on. A completed flowchart enables you to organize your problem into a plan of actions. Even for designing a product a designer many times has to draw a flowchart. It is a working map of the final product. This is an easy way to solve the complex designing problems. The reader follows the process quickly from the flowchart instead of going through the text. A flowchart is an alternative technique for solving a problem. Instead of descriptive steps, we use pictorial representation for every step. It shows a sequence of operations. A flowchart is a set of symbols, which indicates various operations in the program. For every process, there is a corresponding symbol in the flowchart. Once an algorithm is written, its pictorial representation can be done using flowchart symbols. In other words, a pictorial representation of a textual algorithm is done using a flowchart. We give below some commonly used symbols in flowcharts. Start and end: The start and end symbols indicate both the beginning and the end of the flowchart. This symbol looks like a flat oval or is egg shaped. Figure 1.18 shows the symbol of Start/stop. Only one flow line is combined with this kind of symbol. We write START, STOP or END in the symbols of this kind. Usually this symbol is used twice in a flowchart, that is, at the beginning and at the end. Start Stop Write a program to return the value from main() . Explanation: The above program produces no output. The main() should return a value of either 0 or 1. Some operating systems check the return value of main(). If main() returns 0, i.e. program executed successfully; else for other value OS assumes the opposite. If user fails to put the return statement, the compiler would not complain. 1.13?AdvantagesMofMC (i) It contains a powerful data definition. The data type supported are characters, alphanumeric, integers, long integer, floats and double. It also supports string manipulation in the form of character array. (ii) C supports a powerful set of operators. (iii) It also supports powerful graphics programming and directly operates with hardware. Execution of program is faster. (iv) An assembly code is also inserted into C programs. (v) C programs are highly portable on any type of OS platforms. (vi) System programs such as compilers, operating systems can be developed in C. For example, the popular operating system UNIX is developed in C. (vii) The C language has 32 keywords and about 145 library functions and near about 30 header files. (viii) C works closely with machines and matches assembly language in many ways. 1.14?HeaderMFiles stdio.h: Standard input and output files. All formatted and unformatted functions include file operation functions defined in this file. The most useful formatted printf() and scanf() are defined in this file. This file must be included at the top of the program. Most useful functions from this header files are printf(), scanf(), getchar(), gets(), putc() and putchar(). conio.h: Console input and output. This file contains input and output functions along with a few graphic-supporting functions. The getch(), getche() and clrscr() functions are defined in this file. math.h: This file contains all mathematical and other useful functions. The commonly useful functions from this files are floor(), abs(), ceil(), pow(), sin(), cos() and tan(). The list of commonly used header files are given

imageimageimage

You are managing a network of computers. Every computer in this network needs to access a core database, which contains data necessary for basic operating system functions. You can store a copy of the database in each computer, but this requires you to maintain all these copies. You can store just one copy in one specified computer, but then other computers need to request accesses through the network, which may cause considerable network congestion. After some thought, you decide to select some computers from this network, such that they satisfy the following. I. You store a copy of the database on each of the selected computers. II. Each computer that is not selected has a direct link to at least one of the selected computers. Now the question is, can we select k computers such that the above criteria are satisfied?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Statistics For Business And Economics

Authors: James T. McClave, P. George Benson, Terry Sincich

13th Edition

134506596, 978-0134506593

More Books

Students also viewed these Computer Network questions

Question

=+b) State the hypotheses.

Answered: 1 week ago