Computer Science Exercise: shape [★★★] Write a function same_shape : 'a tree -> 'b tree -> bool that determines whether two trees have the same shape, regardless of whether the values they carry at each node are the same. Hint: use a pattern match with three branches, where the expression being matched is a pair of trees. please use Ocaml for the coding
Q: What is the runtime of the hospital-resident or college admissions problem where residents/students ...
A: We now give a formal definition of HR. An instance I of HR comprises a set R ={r1, . . . , rn} of re...
Q: What is the meaning of the term "debugging"?
A: Introduction: Debugging is the act of finding and eliminating current and prospective flaws (often k...
Q: I'd like to send in a PowerPoint presentation to have the APA citations and references checked again...
A: Introduction: Include the name of the author (whoever presented the PowerPoint), the date it was del...
Q: Develop a program (based on if-else structure) to recommend the optimum range of air flow for a give...
A: C++code for selecting fuel type and giving the result as expected in output #include <iostream>...
Q: Given an array A = , if we run Hoare-Quicksort(A, 1, 5), how many key comparisons will be made? if w...
A: Pseudo code for Both is given below: If we assume the parameters passed as (a,1,5) it will cause out...
Q: The Business Implications Of These Results a. Explain how these detections impact the business, what...
A: The problems in a product impacts a business image both in long-term and the short-term.
Q: Dry Run the Following Pseudo Code and Sort the given values. Alg.: INSERTION-SORT(A) ...
A: Insertion sort is a straightforward sorted algorithm that works similarly to how you arrange cards i...
Q: A new architecture, with N layers, is proposed. User application at the top layer generates a messag...
A: Given, Total layer = N Message size = M At each layer H bytes of header is added. Second layer also ...
Q: Give me an example of f formatted string in python. Take all the data from the user.
A: i give the code in Python along with code and output screenshot
Q: What is the 17th decimal digit in the decimal representation of 14/11?
A: Division of integers: The division of integers are two types of results Give some fixed decimal dig...
Q: What are the distinctions between on-premises solutions and cloud solutions in terms of IT security?
A: Answer: As a consequence of significant cloud adoption, many suppliers have moved their focus from o...
Q: Do you think using Virtual reality is dangerous?,
A: Though Virtual Reality is getting famous these days, it has diverse reasons why it can be dangerous....
Q: Use the table below to list three syntax rule examples and three good programming practices (convent...
A: the first letter of a variable or a method should start with alphabets(a-z,A-Z).Numeric or special c...
Q: 1. Given the code below will this code run and compile? Support your answer. public abstract class M...
A: The code will not run and compile Explanation:- Abstract methods cannot have body so this will will...
Q: "Rule 1: If Priority(A)>Priority(B), A runs (B does not") was one of the first drafts of the rules f...
A: In a MLFQ (Multi Level Feedback Queue) scheduler, if we only go by the rule 1, and don't add more ru...
Q: Andersen Windows has created a window that has an WIFI connection and embedded sensors and homeowner...
A: This example shows that the company is getting ready to create the best customer experience, by prov...
Q: Follow the tutorial in zyBook chapter 9.7 to create your version of the Find Me app. This introduces...
A: Answer You may manage mobile devices within your company using the Google Workspace Directory API. T...
Q: READY CAREFULLY Java add comment to code, please write your test-cases on how you would test your ...
A: The answer is given below:-
Q: What will be the content of 'file.c' after executing the following program? #include int main() { F...
A: This is the minified version of the code written. So the code written in a correct way is as under: ...
Q: The password is stored in a file. If you want to keep anything safe, hash it rather than encrypt it....
A: - We need to talk about a password file.
Q: In your own words, based on your own understanding, without technical specifications; how does the C...
A: every single device from toys to satellite uses CPU(central processing unit). It perform calculation...
Q: OUTPUT : LYNNE, your total score is 19 and your average score is 3.8. SAMPLE RUN 2: INPUT : Enter st...
A: #include <iostream>using namespace std;void TEST(){ int a[5]; string x; int sum=0; ...
Q: C++ A program that combines the elements of a binary array into an unary array
A: code: #include<iostream>using namespace std;int main(){ int arr1[20],arr2[20], size1, size2, ...
Q: I'd like to send in a PowerPoint presentation to have the APA citations and references checked again...
A: Introduction: Include the name of the author (whoever presented the PowerPoint), the date it was del...
Q: Construct the FIRST and FOLLOW for the grammar A → BC | EFGH|H B →b E → e|E F» CE G→g H →h|e
A: The Answer is
Q: Give a big-Oh characterization in terms of n, of the running time of the following code fragments P...
A: Given :- Give a big-Oh characterization in terms of n, of the running time of thefollowing code frag...
Q: Consider the bit pattern 1000 1100 0000 0000 0000 0000 0000 0000 a) What decimal number does this ...
A: Here, we are given a 32 bit pattern and we are asked to represent in different integer formats. *M...
Q: Sort a array in JAVA using TreeSet data structure
A: An array is sorted using TreeSet data structure by using the descendingSet() method for returning a ...
Q: Using for loop, write a bash script that must go through all files stored in /etc directory. The loo...
A: The answer is given below:-
Q: Do you think using Virtual reality is dangerous?,
A: Answer: Yes, using Virtual reality is dangerous.
Q: We’ll call a number “glorious” if it is not divisible by any number from 10 to 50, inclusive. Write ...
A: #note: since programming language is not specified, we are providing answer in pythondef glorious(va...
Q: Computer Science
A: We will be building a Dice Game Project using HTML, CSS, and JavaScript. The Dice Game is based on a...
Q: Create a folder named LastName_FirstName(please write Dahanyoon (ex. Reyes_Mark) in your local Creat...
A: I have given java code to perform the given question.
Q: Question 8 Glven p=T and q=F. Find the truth value of the following expression: [pA(¬p → q)]→ ¬p O A...
A: As given, we need to find out the truth value of the given expression - [¬p∧(¬p→q)]→¬p, where p=F an...
Q: censor technology
A: To understand how internet censorship works, as well as how to circumvent such obstacles, we must fi...
Q: People who work with computers and humans use a lot of different ways to measure how well they work ...
A: Introduction: He addresses a vision articulated in his latest book Superminds a framework for reachi...
Q: What exactly is a Unit Test Case?
A: Introduction: Unit testing is a type of testing in which the smallest part of an individual unit/com...
Q: Question 1 In this question, you need to create an interface and an abstract class. For the interfac...
A: SUMMARY: -Hence, we discussed all the points.
Q: ABC company is an international manufacturing company that produces a variety of electronic products...
A: - We need to talk about tge information system that ABC company might use for the automation purpose...
Q: Further increases in connection speeds available to businesses and consumers from local Internet Ser...
A: predicted by _________ law
Q: Question 3 Analyze the time complexity of each block of code and give the big-O notation. 1) int n 8...
A: - Solving the first three problems. Kindly post the remaining separately. - We need to compute...
Q: What is the difference between DBMS and database.
A: Answer: A database is a collection of related pieces of data whose purpose is to solve an instituti...
Q: Write a program in S that computes the function f1(x) = 3x – 3. If you need any macros, please defin...
A: In this question, we are asked to write a program which display the solution of f1(x) f1(x) = 3 * x ...
Q: In this challenge, we'll implement an Account class along with two derived classes, Savings and Curr...
A: NOTE - I have used the Java programming language. Here I have created a class Account and in this, I...
Q: (10 pts) Assume a hash function H(m) which is collision resistant. This particular function maps a m...
A: Solution : Hash function A hash function is a mathematical function that converts a number-based...
Q: Four vulnerability intelligence sources are listed and described. Which seems to be the most potent?...
A: Intelligence sources (i) Bug traq: [Mailing list]:- Bug traq is a set of moderated mailing lists...
Q: What is Node.js and where does it store dependencies from the libraries used to build a Node.js appl...
A: The answer is
Q: Write the pyhton code that will assign the absolute value of -256 to the "Number" variable
A: Python program is the computer programming language, that can create the different programs which is...
Q: how would you use nap enforcement in your environment considering home users roaming laptops and out...
A: Nap basically stands for Network Access Protection. In this, company creates the privacy ...
Q: Computer Networking short question Why do HTTP, FTP, SMTP, and POP3 run on top of TCP rather than o...
A: The protocols, such as HTTP, FTP, SMTP, and POP3, requires the application data to be received, with...
Computer Science
Exercise: shape [★★★]
Write a function same_shape : 'a tree -> 'b tree -> bool that determines whether two trees have the same shape, regardless of whether the values they carry at each node are the same. Hint: use a pattern match with three branches, where the expression being matched is a pair of trees.
please use Ocaml for the coding
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- Regular expression to NFA to DFA conversion: Describes the process of taking a unique regular expression, converting that regular expression to an NFA, then converting the NFA into a DFA. Your regular expression must have at minimum two union, two concatenation, and two Kleene star operations. As followed, concatenations of single charaters can be condensed. Your regular expression cannot be a solved problem from any book. You should describe the regular expression with both processes to convert the regular expression to an NFA and the conversion of that NFA into a DFA.C++ A robot is initially located at position (0; 0) in a grid [?5; 5] [?5; 5]. The robot can move randomly in any of the directions: up, down, left, right. The robot can only move one step at a time. For each move, print the direction of the move and the current position of the robot. If the robot makes a circle, which means it moves back to the original place, print "Back to the origin!" to the console and stop the program. If it reaches the boundary of the grid, print \Hit the boundary!" to the console and stop the program. A successful run of your code may look like:Down (0,-1)Down (0,-2)Up (0,-1)Left (-1,-1)Left (-2,-1)Up (-2,0)Left (-3,0)Left (-4,0)Left (-5,0)Hit the boundary! or Left (-1,0)Down (-1,-1)Right (0,-1)Up (0,0)Back to the origin! About: This program is to give you practice using the control ow, the random number generator, and output formatting. You may use <iomanip> to format your output. You may NOT use #include "stdafx.h".A spell checker in a word processing program makes suggestions when it finds a word not in the dictionary. To determine what words to suggest, it tries to find similar words. One measure of word similarity is the Levenshtein distance, which measures the number of substitutions, additions, or deletions that are required to change one word into another. For example, the words spit and spot are a distance of 1 apart; changing spit to spot requires one substitution (i for o). Likewise, spit is distance 1 from pit since the change requires one deletion (the s). The word spite is also distance 1 from spit since it requires one addition (the e). The word soot is distance 2 from spit since two substitutions would be required. a. Create a graph using words as vertices, and edges connecting words with a Levenshtein distance of 1. Use the misspelled word “moke” as the center, and try to find at least 10 connected dictionary words. How might a spell checker use this graph? b. Improve the method…
- function [P, A] = rect(L, W) P= 2 (L+ W); A =L*W; end Above function is defined to find perimeter and area of a rectangle. If a rectangle has length 10 mm and width 7 mm then the correct way to get perimeter and area of a given rectangle by executing this function is Select one: a. [A, B] = rect(10, 7) b. rect(7, 10) c. [A, B] = rect(7, 10) d. rect(10, 7)Maze Runner Function - Implementation of this function is done in a1_partd.py We describe a maze as having row x col cells. For example if row was 3, and col was 4, then we would have a grid of cells as follows. We describe a wall by the two cell numbers the wall separates. If every single wall existed, there would be (row-1)(col) + (col-1)(row) walls. 0 | 1 | 2 | 3 4 | 5 | 6 | 7 8 | 9 | 10 | 11 A Maze class (which you do not need to implement) describes a maze as mentioned above. This class is defined in maze.py. It has methods that you can use to travel through the maze (i.e. figure out where you are, find a neighbour cell etc.) use a recursive maze runner function: def find_path(maze, from_cell, to_cell); The find_path function will find a path from cell number from_cell to cell number to_cell and will return it as a list containing all the cell numbers along the path, from the from_cell to the to_cell. You are allowed to use this function as a wrapper to a recursive function that…IN JAVA PROgramming Write a function that swaps the first pair (1st and 2nd characters) with the second pair (3rd and 4th characters) for every quadruplet substring. Examples swap Two ("ABCDEFGH") → "CDABGHEF" swapTwo ("AABBCCDDEEFF") → "BBAADDCCFFEE" swap Two ("munchkins") → "ncmuinhks" swap Two("FFGGHHI") → "GGFFHHI"
- Help with a lisp function (please post photos) A lisp function that generates a random day of the week, then displays a message saying that "Today is ... and tomorrow will be ...". For this purpose, create a global variable before the function containing the days of the week as a list. Then use the built-in function random first to generate a number between 0 and 6 (including). The expression (random) by itself generates a random integer. You can call it with one parameter to return a value within the range from 0 to the value of the parameter-1. For example, (random 10) will return a value between 0 and 9. Next, use the number generated at the previous step to retrieve the symbol for the day of the week from the list. Use the built-in elt function. We want the name of the day to appear capitalized. For this, extract the symbol-name of the day first, then apply the built-in function capitalize to it. Use the result in the princ function call, and do the same thing for the next day.…CCC '13 J1 - Next in line Canadian Computing Competition: 2013 Stage 1, Junior #1 You know a family with three children. Their ages form an arithmetic sequence: the difference in ages between the middle child and youngest child is the same as the difference in ages between the oldest child and the middle child. For example, their ages could be 5, 10 and 15, since both adjacent pairs have a difference of 5 years. Given the ages of the youngest and middle children, what is the age of the oldest child? Input Specification The input consists of two integers, each on a separate line. The first line is the age Y of the youngest child (0] ] has_perfect You are to write a function has "perfect (graph)" that takes in a BIPARTITE graph as its input, and then determintes whether or not the graph has a perfect matching. In other words, it will return the Boolean value True if it has one, and False if it does not. After compiling the above cell, you should be able to compile the following cell and obtain the desired outputs. print (has perfect({"A" : ["B", "C"], "B" : ["A", "D"], "C" : ["A", "D"], "D" : ["B", "C"]}), has perfect ( {"A" : ["B"], "B" : ["A", "D", "E"], "C" : ["E"], "D":["B"], "E": ["B","C","F"], "F":["E"]})) This should return True False Python PythonComplete the function ratio_similarity, which computes the ratio of "similarity" between two non-empty strings. The ratio is computed as follows: 2 (the number of matches of characters) / (total number of characters in both strings) The matches are determined in pairwise fashion. For example, consider the strings abcdef and abdce. The three characters at indexes 0, 1 and 4 match. Therefore, the similarity ratio is 2 * 3/(6 + 5) = 0.5454 .... Examples: Function Call string_similarity('abcdef', 'abdce') string_similarity('dragon', 'flagon') string_similarity('stony', 'stony') string_similarity('Stony Brook University', 'WolfieNet Secure') string_similarity('yabba dabba doo', 'bippity boppity boo') string_similarity('Wolfie the Seawolf', "What's...a Seawolf?") [ ] Return Value 3 4 5 # Test cases 6 print (string_similarity('abcdef', 'abdce')) 7 print (string_similarity('dragon' 1 'flagon')) 'stony')) 0.5454545454545454 0.6666666666666666 1.0 0.0 0.058823529411764705 0.4864864864864865 1…Nationality. Prove the function works by testing it 2. BLACKJACK: Sample two cards from a "deck of cards" (ace, 2-10, jack, queen, king). Find the total of the two cards (ace counts as 11 and facecards count as 10). If the total is 21 print "BLACKJACK!" otherwise print "Try again". Keep drawing pairs of two cards until you get blackjack. Set your seed to 30 at the start of this problem ? Write 2 that ohe to frame for NAe If NA is found it should replace NA with theCodeW For fun X C Solved https://codeworkou... 臺亂 CodeWorkout X272: Recursion Programming Exercise: Is Reverse For function isReverse, write the two missing base case conditions. Given two strings, this function returns true if the two strings are identical, but are in reverse order. Otherwise it returns false. For example, if the inputs are "tac" and "cat", then the function should return true. Examples: isReverse("tac", "cat") -> true Your Answer: 1 public boolean isReverse(String s1, String s2) { 2. if > 3. 4. else if > return true; return false; 5. 6. else { String s1first = String s2last return s1first.equals (s2last) && 51. substring(0, 1); s2, substring(s2.length() 1); 7. 8. 6. isReverse(s1.substring(1), s2.substring(0, s2.length() 1)); { 12} 1:11AM 50°F Clear 12/4/2021SEE MORE QUESTIONS