Q.3. (a) Write an algorithm to convert infix to postfix expression and explain it with example (b) Write an algorithm to evaluate a postfix expression and explain it with example
Q: Question 3: Rewrite the program in Question 2 part a in Java and C#, run them, and compare the…
A: Given: Rewrite the program in Question 2 part a in java and c#, run them and compare the results.
Q: The Fibonacci series: 0, 1, 1, 2,3,5,8,13,21... begins with terms 0 and 1 and has the property that…
A: The program is written in C Language. Please find the source code and output in the following steps.
Q: Language C............ I"m having issues understanding this concept... floating point formating in…
A: Below is the complete solution with explanation in detail for the given question about…
Q: A bullet of mass m = 0.100kg travels down a rifle barrel from x = 0 to x = 0.600m subject to the…
A: MATLAB code given below
Q: 7. a) Design and draw your own pictoral iteration (like a simple fractal) and repeat the process for…
A: Here we went to design a pictorial iteration of our own choice and we must perform the four…
Q: fünction in pseudo-cod alculates the an iterative and a recur which ments of the sequence given on…
A: As we can see in above diagram every index value is sum of previous 2 index values. Means…
Q: 1. Modify the recursive Fibonacci program given in the chapter so that it prints tracing…
A: count3 = 0def recFib(n): global count3 if n == 3: count3 += 1 print(f"Computing fib({n})") if n…
Q: Computer Science A) If the values of c and d are given and the function Euclid(c,d) below is…
A: Code of Euclid GCD is in next Step.
Q: For each of the following applications, mention the data structure that will be most suitable to…
A: a) The data structure that's best suited to use for locating the shortest path between the source…
Q: q4) What is an Algorithm? a. An Algorithm is a Software Tool. b. An Algorithm is a step by step…
A: An algorithm is a step by step instructions to solve a particular task or function written in a…
Q: Define the set of signed integers using: i. Enumeration A recursive definition ii.
A: Given three questions are not interlinked. So, as per our company guidelines only one question will…
Q: NOTE: (what your answer will contain) 1. Use C PROGRAMMING LANGUAGE ONLY 2. Use RECURSION type of…
A: The program is written in C Language. Please find the source code and output in the following steps.…
Q: Question 19 (Algorithmic problem) Write a RECURSIVE function that, given a text (as a string),…
A: I have provided PYTHON CODE along with CODE SCREENSHOT and OUTPUT…
Q: For each of the following applications, mention the data structure that will be most suitable to…
A: A)The data structure that's best suited to use for locating the shortest path between the source and…
Q: Q3) Write a recursive function that reads from the keyboard a set of characters and prints them…
A: I have provided the answer based on C++ Programming. Detailed comments are included for a better…
Q: NOTE: (what your answer will contain) 1. Use C PROGRAMMING LANGUAGE ONLY 2. Use RECURSION type of…
A: The program is written in C Language. Please find the source code and output in the following steps.
Q: Problem D: Oinkway Pig Latin is a language constructed by transforming English words. The following…
A: The code for the above-given question is given below:
Q: velop a C program that computes the different roots in a quadratic equation, aX + bX2=0. r = -b…
A: Answers to both questions are given below.
Q: Q4) The volume V and surface area A of a sphere of radius r are given by: 4 V = ² A = 4m² Develop a…
A: In this question we have to write a MATLAB code to find the volume of a sphere and plot the…
Q: Consider the following statements with respect to Dynamic Programming algorithm design strategy. I.…
A: Introduction: Given , two statement related on Dynamic Programming algorithm design strategy. We are…
Q: What does computable mean? (May have more than one correct answer) A.) An algorithm is considered…
A: Option C is not correct as an algorithm can be computable without being the most efficient…
Q: 2. Write a program containing the recursive function that will find the following series of numbers…
A: I give the code in C(because you asked in C only) and also provide the output screenshot as well.
Q: NOTE (what your answer will contain) 1. Use CPROKGRAMMING LANGUAGE ONLY 2. Uae RECURSION type of…
A: Hey there, I am writing the required solution (code) below for the above stated question. First , I…
Q: and output should be like - firstly print the resulting profit table, and then print the all…
A: Summary: - At the end we will get the output.
Step by step
Solved in 2 steps
- subject theory of computer science Given the language, L = {abb, aabb, babb, aaabb, ababb, …………..}, which of the following is the correct the regular expression that can represent L. A.(a+b)*ab B.(aa)*(bb)*b C.(a*ba*) D.(a+b)*abbProblem B. Musical Key ConversionThe chromatic scale is a 12-note scale in music in which all notes are evenly spaced: that is, the ratio of the frequency between any two consecutive notes is constant. The notes are typically labeled in the following sequence: A, A#, B, C, C#, D, D#, E, F, F#, G, G# After G#, the labels loop back and start over with A (one octave higher). To convert between musical keys, you can shift all notes in a piece of music a constant number of steps along the scale above. For example, the sequence of notes E, E, F, G, G, F, E, D, C, C, D, E, E, D, D can be converted to another musical key by shifting everything up three steps: E, E, F, G, G, F, E, D, C, C, D, E, E, D, D G, G, G#, A#, A#, G#, G, F, D#, D#, F, G, G, F, F Notice that G was converted to A#, since going three steps up required us to loop off of the top of the scale back to the bottom: G -> G# -> A -> A#. Technically we should note that this would be A# of the next octave up, but we’ll…e. Problem 5. Devise a function that receives a string and computes how many asterisks are in the string with a recursive method. For instance, if the input is "Able was I ere ***Elba", the function should output 3. If the input is "Peanuts", the function should return 0. Approach: Let's assume the signature of our function is countAsterisks(s) where s is the input string. In the body of your function, check if s[0] is equal to an asterisk. If the string contains only a single character and it is an asterisk, return 1. If the string contains only a single character and it is not an asterisk, return 0. If the string is longer than one character, determine if the first character is an asterisk and count it if this is the case. Then, create a new string s1 that is the same as the input string s but without the first character. Recursively call countAsterisks (s1) and return the value returned from this recursive call, plus one (if there is an asterisk in s[0]). Also, writing any explicit…
- INTRODUCTION: In chemistry, neutralization occurs when an acid and a base react with each other. Most chemistry occurs in water (that is, is aqueous); under these circumstances, neutralization leads to water with no excess hydrogen or hydroxide ions present. Neutralization can most simply be expressed as acid + base → salt + water For example, HCl + NaOH → NaCl + H2O The stoichiometry of the reaction depends on how much hydrogen ion and hydroxide ion each reactant provides. In this case, each molecule of HCl provides one hydrogen ion, and each molecule of NaOH provides one hydroxide ion. The one hydrogen and one hydroxide ion combine to form one molecule of water. For this assignment, suppose that you have been presented with several solutions of hydrochloric acid (HCl) and some of the most popular bases for wastewater treatment: magnesium hydroxide (Mg(OH)2), calcium carbonate (CaCO3), calcium oxide (CaO), sodium bicarbonate (NaHCO3), sodium hydroxide (NaOH), and ammonia…Use Sage to program Exercise 5.In 1202 AD, Leonardo Pisano asked the following famous problem:A certain man had a pair of rabbits together in a certain enclosedplace, and one wishes to know how many are created from the pair inone year when it is the nature for of them in a single month to bearanother pair, and in the second month those born bear also. Becausethe abovewritten pair in the first month bore, you will double it. therewill be two pairs in one month. One of these, namely the first, bears inthe second month, and thus there are in the second month three pairs;of these in one month two are pregnant, and in the third month 2pairs of rabbits are born, and thus there are 5 pairs in the month;...Explain how the rabbits reproduce. Create a list F where F[x] is the number ofrabbits in month x. (so F[0]=1, F[1]=2) Find F[12]. Find F[100].Problem B Musical Key ConversionThe chromatic scale is a 12-note scale in music in which all notes are evenly spaced: that is, the ratio of the frequency between any two consecutive notes is constant. The notes are typically labeled in the following sequence: A, A#, B, C, C#, D, D#, E, F, F#, G, G# After G#, the labels loop back and start over with A (one octave higher). To convert between musical keys, you can shift all notes in a piece of music a constant number of steps along the scale above. For example, the sequence of notes E, E, F, G, G, F, E, D, C, C, D, E, E, D, D can be converted to another musical key by shifting everything up three steps: E, E, F, G, G, F, E, D, C, C, D, E, E, D, D G, G, G#, A#, A#, G#, G, F, D#, D#, F, G, G, F, F Notice that G was converted to A#, since going three steps up required us to loop off of the top of the scale back to the bottom: G -> G# -> A -> A#. Technically we should note that this would be A# of the next octave up, but we’ll…
- A geometric sequence is a sequence of numbers where each term after the first is found by multiplying the previous one by a fixed, non - zero number called the common ratio. For example, the sequences 2, 6, 18, . ... 3, 15, 75 , …. are a geometric sequences with common ratios 3 and 5 respectively. A geometric sequence is generally characterized by three numbers, the first term ‘ a’, the common ratio ‘ r’ and the number of terms ‘ n’. A geometric series is the sum of numbers in a geometric sequence. 2+ 6+ 18 and 3+ 15+ 75 are examples of geometric series with three terms each. The nth term of a geometric series with initial value ‘ a’ and common ratio ‘ r’ is given by: ?? = ???−1. While the sum of a geometric series is given by: ?(1-??−1) / 1-??−1 Create a class Geometric Series to model a Geometric series. Using friend function, overload the ‘~’ operator to find the nth term of the series. Likewise, overload the ‘!’ operator (using a friend function)…Design a function that accepts an integer argument and returns the sum of all the integers from 1up to the number passed as an argument. For example, if 50 is passed as an argument, thefunction will return the sum of 1, 2, 3, 4, . . . 50. Use recursion to calculate the sum.8. Let E = {0, 1}. Compute the language of the given regular expression. (a) L(10) (b) L(ɛ +0*)
- (a) List at least 8 distinct strings that are in S. You must use each recursive rule at least twice. (b) List at least 2 strings made up of only as and bs that are not in S.2, Towers of Hanoi Problem. (10 points) The Towers of Hanoi is a famous problem for studying recursion in computer science and searching in artificial intelligence. We start with N discs of varying sizes on a peg (stacked in order according to size), and two empty pegs. We are allowed to move a disc from one peg to another, but we are never allowed to move a larger disc on top of a smaller disc. The goal is to move all the discs to the rightmost peg (see figure). To solve the problem by using search methods, we need first formulate the problem. Supposing there are K pegs and N disk. Answer the following questions. (1) Determine a state representation for this problem. (4points) (2) What is the size of the state space? (3 points) (3) Supposing K=3, N=4, what is the start state by using your proposed state representation method and what is the goal state? (3 points)What input or parameter value impacts the number of times the recursive function will be called. • Give three specific examples of input/parameter values and, for each, state the number of times the recursive function will be called. • Devise a formula with respect to n that describes the number of times the recursive function will be called, where n is either the value passed or some property of the value passed (e.g. n might be the length of a string of the size of an array).