The error is found at b. *list = new double[n];. The code fragment is trying to dynamically allocate an array of n doubles, but there is an error in how the array is being declared and assigned.
The error is that the variable 'list' is not a pointer, but it's trying to use the 'new' operator to dynamically allocate memory for the array, which is only used for pointer types. To fix this error, we can add a pointer operator (*) before the variable 'list' to make it a pointer. This allows us to use the 'new' operator to dynamically allocate memory for the array. So the correct answer is b. *list = new double[n];
Learn more about code, here https://brainly.com/question/497311
#SPJ4
Using the appropriate formatting, which of the following is a merge field that would contain information about the recipient?
Address Block
<< Address Block >>
<< Street >>
<< Greeting >>
The shipment of the items will not be handled by the accounting or finance teams. a pre-defined merging field that contains the recipient's name and a "greeting" like "Dear"
What is formatting?The presentation or appearance of your essay is referred to as formatting. Layout is another term for formatting. Headings, regular paragraphs, quotations, and bibliographic references are the four text types that the majority of essays use. Both endnotes and footnotes are acceptable.
Additionally, you need to think about the fonts you choose and page numbers. The general design of a text or spreadsheets is referred to as format or document format. For instance, the alignment of text in many English papers is to the page's left. To emphasise information, a user might set the text's format to bold. The format of a file is how it is stored on a computer.
To know more about formatting visit:
https://brainly.com/question/21934838
#SPJ1
50. List any three sources of graphics that can be used in Microsoft word.
Answer:
1. Shapes: Microsoft Word includes a variety of pre-designed shapes that can be easily inserted into a document, such as circles, squares, arrows, and stars.
2. Clipart: Microsoft Word includes a large collection of clipart images that can be inserted into a document to add visual interest. These images can be searched for and inserted using the "Insert" menu.
3. Images: Microsoft Word also allows you to insert your own images, such as photographs or illustrations, into a document. These images can be inserted by using the "Insert" menu and selecting "Picture" from the options.
CPU are measurements used to compare performance between processors.
a. stats
b. records
c. benchmarks scores
CPU measures are used to compare processor performance in benchmark results.
There are three stages, each of which is determined by the CPU:
A block of memory known as level 1 cache is integrated into the CPU chip itself and used to store data or commands that have recently been utilised.
Although it is on the same CPU chip as Level 1 cache, Level 2 cache is a little further away and hence requires a little more time to reach.
Although the CPU takes longer to access Level 3 cache, it is bigger than Level 2 cache.
It is simpler to choose the ideal CPU for the type of job you do if you look at some performance benchmarks. CPU benchmarks are tests that evaluate the performance of various CPUs. Running software applications created particularly to test the limits of CPU performance produces benchmarks.
Learn more about CPU here:
https://brainly.com/question/29775379
#SPJ4
Accumulating Totals in a Loop
Summary
In this lab, you add a loop and the statements that make up the loop body to a Java program that is provided. When completed, the program should calculate two totals: the number of left-handed people and the number of right-handed people in your class. Your loop should execute until the user enters the character X instead of L for left-handed or R for right-handed.
The inputs for this program are as follows: R, R, R, L, L, L, R, L, R, R, L, X
Variables have been declared for you, and the input and output statements have been written.
Instructions:
Ensure the file named LeftOrRight.java is open.
Write a loop and a loop body that allows you to calculate a total of left-handed and right-handed people in your class.
Execute the program by clicking Run and using the data listed above and verify that the output is correct.
// LeftOrRight.java - This program calculates the total number of left-handed and right-handed
// students in a class.
// Input: L for left-handed; R for right handed; X to quit.
// Output: Prints the number of left-handed students and the number of right-handed students.
import java.util.Scanner;
public class LeftOrRight
{
public static void main(String args[])
{
Scanner s = new Scanner(System.in);
String leftOrRight = ""; // L or R for one student.
int rightTotal = 0; // Number of right-handed students.
int leftTotal = 0; // Number of left-handed students.
// This is the work done in the housekeeping() method
System.out.println("Enter L if you are left-handed, R if you are right-handed or X to quit.");
leftOrRight = s.nextLine();
// This is the work done in the detailLoop() method
// Write your loop here.
// This is the work done in the endOfJob() method
// Output number of left or right-handed students.
System.out.println("Number of left-handed students: " + leftTotal);
System.out.println("Number of right-handed students: " + rightTotal);
System.exit(0);
} // End of main() method.
} // End of LeftOrRight class.
I must therefore finish a programme that adds up all left- and right-handed users as part of my homework assignment.
Why do programmers use loops?Application of programming: Loops enable programmers to condense what could otherwise be hundreds of code lines into just a few. This increases the likelihood that the programme will function as intended because they may create the code once or reuse it as often as necessary.
What functions do a loop?Programming structures called loops repeat a set of commands until a predetermined condition is satisfied. Loops make it possible to perform a process repeatedly without having to repeatedly write the same (perhaps lengthy) instructions.
To know more about loop visit:
https://brainly.com/question/14390367
#SPJ4
Why is trunking important to VLAN configuration?
It is possible to extend a VLAN throughout the network via VLAN trunking. Trunk connections are required to guarantee that VLAN signals are correctly separated
so that each may reach its designated destination when numerous VLANs are implemented throughout a network.
A network architecture known as trunking, which is often used in IT and telecommunications, effectively transfers data across several entities without the usage of one-to-one lines. A network trunk essentially transports various streams of signals to the appropriate areas, just like a tree trunk provides water to every branch and leaf. Trunking in networking often refers to link aggregation or virtual local area network (VLAN) trunking, a procedure that is essential to VLAN configuration, for managed services providers (MSPs). VoIP services, which some MSP clients may also be interested in, are particularly referred to as IP trunking.
A trunk is a single communication route that enables many entities at one end to communicate with the right entity at the other
Learn more about VLAN here:
https://brainly.com/question/14530025
#SPJ4
from the given program and application
The following apps that run on mobile or Android Devices are named as follows:
PicsArt Photo EditorInst. agramPicCollageSnapc. hatCameraCamera360 Selfie EditorPhoto Grid Collage MakerSnapSeedMonkey.Which of the above-named apps is a preferred app for computer-generated art and why?
Snapc. hat is the most popular smartphone app on the list above.
Snapc. hat's clean, modern user interface allows you to explore with a variety of artistic styles. The updated style and layout eliminate distractions and allow for easy visual viewing of a large range of presets, allowing you to obtain ideal results faster than ever before.
Learn more about mobile apps:
https://brainly.com/question/11070666
#SPJ1
Which of the following problems is undecidable? (A) Membership problem for CFGs(B) Ambiguity problem for CFGs.(C) Finiteness problem for FSAs.(D) Equivalence problem for FSAs.
The correct answer is (D) Equivalence problem for FSAs. of the following problems is undecidable.
A set is closed under an operation if we obtain an element from the set when we act on an element of the set using that operator. Here, CFG creates a CFL, and the set is made up of all CFLs. There is no specific algorithm for reducing the ambiguity in grammar since it is undecidable. A issue poses a yes-or-no inquiry on some input. If there is a software that always stops and always provides the right response, the issue can be solved.A generic algorithm operating on a Turing computer that resolves the halting issue for all conceivable program-input pairings is logically impossible, as Alan Turing demonstrated in 1936. As a result, Turing machines are incapable of solving the halting problem.
To learn more about FSAs click the link below:
brainly.com/question/29212173
#SPJ4
will i3 pull 3220
and 6 GB of RAM windows 10 without lags?
It is to be noted that a Core i3 CPU (or processor) with 6GB of RAM running Windows 10 will most certainly be able to run without noticeable delays. However, the performance of the system will be determined by the exact tasks and apps that you will execute on it.
What is a Core i3 Processor?An i3 CPU is a low-end processor that will struggle to handle intense workloads or high-end games, but it should do simple activities like web surfing, word processing, and video playback without trouble. 6GB of RAM is also considered a little amount of memory; it may not be enough to run numerous apps at the same time, or to run heavy applications such as video editing software, but it should be plenty for simple activities.
It's crucial to remember that a computer's performance is influenced by numerous variables other than the CPU and RAM. Other elements, like as the storage drive, graphics card, and cooling system, can all contribute to the total system performance.
Learn mroe about processors:
https://brainly.com/question/28255343
#SPJ1
___match speed of the new processors with the speed of the current processor
CPU speed is equal to the difference between the speed of the new and the old CPUs.
Which CPU is the quickest?The 64 cores and 128 threads of AMD's Ryzen ThreadRipper 3990X desktop PC processor are predicted to make it the fastest CPU in the world by 2021. You can multitask and load pages rapidly thanks to the CPU's base clock and peak clock speeds of 2.9 GHz and 4.3 GHz, respectively.
What speed should a computer have in 2022?A good all-around CPU should have a base clock speed of roughly 3.0 GHz and a turbo boost of roughly 4.0 GHz for gaming and intermediate-level professional work. While for routine tasks, a 2.1GHz speed will handle most of them, including programming.
To know more about CPU visit:-
https://brainly.com/question/16254036
#SPJ4
which level of the osi model does a layer 2 switch operate at?
Answer:
data link layer
Explanation:
An online game developer has an issue with its most popular game and must take the server offline. The company posts an update on its social media page. How is this a positive use of social networking?
A. It shares the company’s plans with competitors, making it transparent and honest.
B. It allows the users to share their experiences with the game on a different platform while the site is down.
Answer:
I guess it is B
Explanation:
because it allows the user to share their experience
Identify how to
open a new
notepad and Type
the steps to
multiply two
numbers.
The way that one can use to open a new notepad and Type the steps to multiply two numbers is given below
What is notepad about?To open a new Notepad and type the steps to multiply two numbers, you can follow these steps:
Click on the Start menu (or press the Windows key on your keyboard)Search for "Notepad"Click on the Notepad application to open itOnce Notepad is open, you can start typing the steps to multiply two numbers. For example:Type the number you want to multiply, let's say 5Type the symbol * (asterisk)Type the second number you want to multiply, let's say 2Press EnterThe result will be displayed on the screenTo save the file, you can go to File > Save As, then choose a location and give the file a name with .txt extension.Press Save, and the file will be saved with the instructions on how to multiply two numbers.Alternatively, if you are using a newer version of windows you can press the Windows key + R and type "notepad" on the Run dialog box and press Enter.
Learn more about notepad from
https://brainly.com/question/24204718
#SPJ1
a requirement to begin designing physical files and databases is
A prerequisite for starting to create physical files and databases is normalized relations definitions of each attribute technology descriptions.
What is normalization's main objective?The basic goals of database normalization are to get rid of redundant data, reduce data update errors, and make the query process simpler. More specifically, normalization entails structuring data based on assigned attributes as part of a wider data model.
What are the 3 various normalization forms and how are they explained?Here are the different categories of Normal forms: An atomic value must be present for a relation to be in 1NF. If a relation is in 1NF and all of its non-key properties are completely dependent on the primary key, then it is in 2NF. A relation will be in 3NF if it is in 2NF and there is no transition dependency.
To know more about normalized relations visits :-
brainly.com/question/30052444
#SPJ4
what is your favorite game?
Answer:
royale high and the sims 4
Explanation:
royale high:
cool customization optionsseasonal eventslots of different games to level upcons:
community doesnt know if they should like or hate the devs because they have been releasing bad updates and constantly pushing off new school releasesims 4
somewhat good customization optionsyou can do whatever you wantcons:
no good packs have been released latelynot the most inclusive customization for simswhich sorting algorithm has the best asymptotic runtime complexity?
The sorting algorithm with the best asymptotic runtime complexity is O(n log n), which is the average and worst-case time complexity of comparison-based sorting algorithms such as Merge Sort and Heap Sort. Other sorting algorithms such as Bucket Sort and Radix Sort have a time complexity of O(n) but they have certain limitations and are not as widely used.
Asymptotic runtime complexity refers to the amount of time that an algorithm takes to complete as the input size grows indefinitely. It is typically represented using big O notation, which describes the upper bound of the growth of the algorithm's running time.
The most common time complexities are:
O(1), which means the algorithm takes constant time regardless of the input size.O(n), which means the algorithm's running time is directly proportional to the input size.O(n log n), which means the algorithm's running time increases logarithmically with the input size.Learn more about algorithm, here https://brainly.com/question/22984934
#SPJ4
the list below tracks customers renting videos. we sometimes need to delete customers by deleting the row containing that customer. if we delete the customer in row 2 (customer smith, david), we also erroneously delete the data for the movie named harvey. what is this term for this type of mistake?
The term for this type of mistake is called "cascading delete".
Cascading delete occurs when an operation to delete a row from a table also deletes related rows in other tables, which can lead to data loss or inconsistency.
In this case, deleting the customer in row 2 would also delete the data for the movie named Harvey, resulting in data loss. It is important to take precautions when deleting data to ensure that related data is not inadvertently deleted.
Cascading delete is a feature in relational databases that allows the deletion of a row in a parent table to automatically delete any corresponding rows in its related child tables. This ensures that any data associated with the deleted row in the parent table is also deleted in any related tables. Cascading delete is often used to maintain data integrity in a database and to ensure that related data is not left orphaned in the child tables. Cascading delete can be specified in the database table design or when creating foreign keys between tables.
Learn more about "cascading delete":
https://brainly.com/question/29105098
#SPJ4
how many different values can be represented using 4 bits?
16 different values can be represented using 4 bits. In digital electronics and computer science, a bit is a basic unit of information that can have two values, typically represented as 0 or 1.
The number of different values that can be represented using a certain number of bits is determined by 2 raised to the power of the number of bits. Bits are used to store and process data in computers and other digital devices, and they are the building blocks of all digital information. For example, the text of this message, the images and videos you see on your screen, and the music you listen to are all represented by a series of bits. They are also used in digital communications, such as data transmission over a network or the internet, where data is sent as a series of ones and zeroes.
In the case of 4 bits, the number of different values that can be represented is 2 raised to the power of 4, which is equal to:
2 x 2 x 2 x 2 = 16.
Therefore, 4 bits can represent 16 different values, ranging from 0 to 15 in decimal form.
Learn more about bit value, here https://brainly.com/question/14805132
#SPJ4
How to Fix ""Windows Resource Protection Could Not Perform the Requested Operation"" Error
To fix the “Windows Resource Protection Could Not Perform the Requested Operation” error, run the System File Checker tool and then repair any corrupted or missing files.
Begin by pressing the Windows key and R to open the Run window. Type “cmd” and press Enter to open the Command Prompt. Then, type “sfc /scannow” and press Enter to begin the scan.
The scan will check all protected system files, and replace corrupted files with a cached copy that is located in a compressed folder at %WinDir%\System32\dllcache. Once the scan is complete, restart your computer to see if the issue was resolved.
If it wasn’t, then open the Command Prompt again and type “DISM /Online /Cleanup-Image /RestoreHealth” and press Enter. This will begin a process that will repair any corrupted or missing files that are not able to be replaced by the System File Checker.
After the process is complete, restart your computer again to see if the issue was resolved.
For more questions like Windows error the link below:
https://brainly.com/question/30116597
#SPJ4
Which tag do you use to create a Paragraph in HTML?
*
A) body
B) p
C) h
D) li
Answer:
B: p because paragraph starts with P and <p>Hello World</p>.
Which of the following are electrical hazards shock explosions burns fire arc flash electrocution?
Electric shock, burns, electrocution (which can be lethal), and falls are the four basic categories of injuries. These accidents may occur in a number of ways: direct touch with circuit components or exposed electrified wires.
shock: The body's reaction to an electric current flowing through it. Burns are caused by the heat and harsh light that an arc flash or blast emits. Fire: Occurs with damaged switches, wires, and outlets. Explosions occur when electrical energy ignites explosives in the atmosphere. The primary risks associated with electricity are shock and burns from coming into touch with live components. Faults that might start fires or explosions; fires or explosions when electricity might be the source of ignition in a potentially explosive or flammable environment, such as in a spray paint booth.
To learn more about electrocution click the link below:
brainly.com/question/29861244
#SPJ4
How to fix "files required to play gta online could not be downloaded from the rockstar games service"?
Answer:
Check the Rockstar Games Service Status for server outages or scheduled maintenance. You can reset your router by unplugging it and leaving it unplugged for about 10 minutes. Restart the game client and check to see if your issue is resolved.
What information is in the data payload of the ethernet frame?
Media access control address and IP information, quality of service tags, time-to-live data and checksums.
What is an Ethernet frame’s payload?46 bytes, To summarize, Ethernet has a minimum frame size of 64 bytes, which includes an 18-byte header and a 46-byte payload. It likewise has a maximum frame size of 1518 bytes, with a payload size of 1500 bytes.
The payload is data. The payload is then enclosed in a packet that includes information such as the media access control address and IP address, quality of service tags, time-to-live data, and checksums.
The message to be sent is stored in the payload field. The trailer includes the error detection and repair bits. It is also known as a Frame Check Sequence (FCS). Flag: The beginning and conclusion of the frame are marked by two flags at either end.
To learn more about Ethernet to refer:
https://brainly.com/question/10396713
#SPJ4
Attaching structures end to end is called
Attaching structures end to end is called stacking.
Stack (data structure)In computer science, a stack is a collection of objects that uses the LIFO (Last In First Out) principle, that is, the data that was last brought in will be the first to come out of the stack. The stack can be implemented as a linked or continuous representation (with fixed tables).
Stack features TOP is the designation for the topmost element of a stack The TOP element is the last element added The TOP elements are known adding and removing elements is always implemented in the TOP LIFOStack utilization:
Arithmetic expression penalty (posfix) backtracking algorithm recursive algorithmStack operations:
InsertFirst() usually called Push (input E : typeelmt, input/output data : stack): adds an element to the stack DeleteFirst () usually called Pop (output E : typeelmt, input/output data : stack ) : deletes the stack of elements IsEmpty () : checks if the stack is empty or if there are elements IsFull () : checks whether the stack is full or not Delete () : delete all data Peek () : view the TOP dataLearn more about stack at https://brainly.com/question/30023163.
#SPJ4
Stacking structures is the practice of attaching one set of structures to another set of structures end-to-end.
Stacking structures refers to the process of attaching multiple structures end-to-end in order to create a larger, more complex structure. This can be done in a variety of ways, such as by physically connecting the structures together or layering them on top of each other. This technique is often used in construction, engineering, and architecture to create taller buildings, larger structures, or to add additional floors or levels to a building. It can also be used in other fields, such as computer science, where multiple layers of a neural network can be stacked to improve performance.
Learn more about stacking structures here: brainly.com/question/13152669
#SPJ4
1 Join Queries Assessment This database contains data about crimes repoted in the city of Chicago during 2018 1.1 Make a community-area neighborhood list. a. Show the side, community area name, and the name of the neighborhood. b. Sort the results by side then by community area name then by neighborhood
neighborhood on community area.area number = neighborhoo d.area number, then choose side, community area na, neighborhood from the community area inner join neighborhood Queries.
What kind of evaluation test would that be?types of assessment tests For instance, an IQ test is almost never omitted, and assessments frequently include personality and career tests as well. Next come the aptitude tests. Instead than focusing on traits like your personality or IQ, these tests are more concerned with your talents.
What is a SQL evaluation?In order to extract, combine, and alter data, the CRUD operations must be written for the live coding assignments used in the SQL online test to evaluate SQL skills. This test supports SQL queries in MySQL, MS SQL, and SQLite databases.
To know more about Queries visits :-
https://brainly.com/question/29304912
#SPJ4
Describe the medieval inquisition an the spanish inquisition, making sure to clarfiy the differences between the two
The defining design element of Gothic architecture is the pointed or ogival arch.
Describe the medieval inquisition an the spanish inquisition?The Medieval Inquisition, also known as the Papal Inquisition, was an inquisition created by the Church in the 13th century to hunt out heresy. Pope Gregory IX established it. Inquisitors were mostly drawn from the Dominican and Franciscan orders and served as both investigators and judges.
The Spanish Inquisition was a procedure created by the Spanish kings Ferdinand and Isabella in the late 15th century to uphold Catholic orthodoxy in Spain.Thee Spanish Inquisition (which began in 1478) investigated whether Jews and Muslims had converted to Catholicism correctly.
To learn more about medieval inquisition to refer:
https://brainly.com/question/29304913
#SPJ4
An online retailer offers next-day shipping for an extra fee. The retailer says that 95\%95%95, percent of customers who pay for next-day shipping actually receive the item the next day, and those who don't are issued a refund. Suppose we take an srs of 202020 next-day orders, and let xxx represent the number of these orders that arrive the next day. Assume that the arrival statuses of orders are independent.
The probability of getting exactly 19 orders out of 20 next day is (20)(0.95)¹⁹ * (0.05). It means it is a very low chance of happening as it is a very small value.
The probability of P(X = 19) that we calculated represents the likelihood of exactly 19 out of 20 orders arriving the next day, given the stated probability of success (0.95) for next-day shipping. It is a measure of how likely it is that a specific outcome (19 out of 20 orders arriving the next day) will occur, given the assumptions of the problem (95% success rate and independence of trials). It is a decimal value between 0 and 1, with 0 indicating an impossible outcome and 1 indicating a certain outcome.
P(X = 19) = (20 choose 19) * (0.95)¹⁹ * (0.05)¹
= (20) * (0.95)¹⁹ * (0.05)
= (20)(0.95)¹⁹ * (0.05)
So the probability of getting exactly 19 orders out of 20 next day is (20)(0.95)¹⁹ * (0.05)
An online retailer offers next-day shipping for an extra fee. The retailer says that 95% of customers who pay for
next-day shipping actually receive the item the next day, and those who don't are issued a refund. Suppose we
take an SRS of 20 next day orders, and let X represent the number of these orders that arrive the next day.
Assume that the arrival statuses of orders are independent,
Which of the following would find P(X = 19)?
Choose 1 answer:
(20)¹⁹ (0.95)(0.05)¹⁹
(20)(0.95)¹⁹ * (0.05)
(20) (0.95)(0.05)
Learn more about probability, here https://brainly.com/question/30034780
#SPJ4
Answer:
( 20/19)(0.95)^19 (0.05)
Explanation:
A simple machine increases the distance that a force needs to be applied from 3 meters to 27 meters, and the work done is 216 joules. How much force is applied?(1 point).
A simple machine raises the distance that a force must be applied from 3 metres to 27 metres, producing a work of 216 joules.
What in science is a force?In science, the term "force" has a particular definition. At this level, calling a force a push or a push is entirely appropriate. A power is not something an object "has in it" or that it "contains." One thing experiences a force from another.The idea of a force encompasses both living and non-living things.
What does a force unit mean?The unit of force deriving from Si is the newton, abbreviated N. The metre, a unit of length with the sign m, is one of the foundation units that relate to force.
To know more about force visit:
https://brainly.com/question/13191643
#SPJ4
Exercise 7.2.7: ArrayList of Even Numbers 6 points Create an ArrayList of only even numbers from 2-100. Hint: Use a loop! 7.2.7: ArrayList of Even Numbers import java.util.ArrayList; public class Evens { public static void main(String[] args) { printArray(evens); } 1 2 3 4. 5 6 7 8 9 10 11 12 13 14 15 - 16 17 18 - 19 20 21 22 23 //Don't alter this method! It will print your array in the console public static void printArray(ArrayList array) { System.out.println("Array:"); for(int name: array) { System.out.print(name } } + "); }
The ArrayList of Even Numbers code is 6 points. Here is how to make an array list from 2 to 100 that only contains even numbers:
import java.util.ArrayList;
public class Evens {
public static void main(String[] args) {
ArrayList<Integer> evens = new ArrayList<>();
for (int i = 2; i <= 100; i += 2) {
evens.add(i); }
printArray(evens); }
public static void printArray(ArrayList<Integer> array) { System.out.println("Array:");
for (int name: array) {
System.out.print(name + " "); } } }
Sun Microsystems initially introduced Java, a programming language and computer platform, in 1995. It has grown from its modest origins to power a significant portion of the digital world of today by offering the solid foundation upon which numerous services and applications are developed. Java is still used in cutting-edge goods and digital services that are being developed for the future.
Although the majority of contemporary Java programmes mix the Java runtime and application,
Learn more about Arraylist here:
https://brainly.com/question/17265929
#SPJ4
Think about your plans for after high school. How will your strengths benefit you? What can you do to perfect them? How do you think your weaknesses will make achieving success in college or in your career more challenging? What can you do to improve them?
Answer:
A person's strengths can benefit them in many ways after high school, depending on the individual's strengths. For example, if a person is strong in problem-solving, they may excel in careers that involve finding solutions to complex problems such as engineering or research. If a person is strong in communication, they may be well-suited for careers that involve public speaking or writing.
To perfect their strengths, a person can continue to develop and practice their skills by seeking out opportunities to use them in their coursework, internships, and volunteer or extracurricular activities. Additionally, individuals can seek out mentors or role models who are experts in the area of their strength and learn from them.
Weaknesses can make achieving success in college or in a career more challenging. For example, if a person struggles with time management, they may have difficulty meeting deadlines, which can negatively impact their academic or professional performance.
To improve their weaknesses, a person can take steps to address them, such as seeking out resources and tools to help them manage their time more effectively, or practicing time management techniques. Additionally, a person can seek out help and support from teachers, advisors, and mentors, who can provide guidance and advice on how to improve their weaknesses.
It's important to remember that everyone has strengths and weaknesses and that it's natural to have them. The key is to identify them and to use their strengths to overcome their weaknesses.
The Giving Tree of Errors 3.0 You are given a binary tree written as a sequence of parent child pairs. You need to detect any errors which prevent the sequence from being a proper binary tree and print the highest priority error. If you detect no errors, print out the lexicographically smallest 5-expression for the tree. Input Format Input is read from standard input and has the following characteristics:
• It is one line.
• Leading or trailing whitespace is not allowed. Each pair is formatted as an open parenthesis 'l', followed by the parent, followed by a comma, followed by the child, followed by a closing parenthesis')'. Example: (A,B)
• All values are single uppercase letters.
• Parent-Child pairs are separated by a single space.
• The sequence of pairs is not ordered in any specific way.
Input (A,B) (B,C) (A,E) (BD
The format to open parenthesis is #include <iostream>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
bool parseInputs(string, map<char, vector<char>>&, map<char, int>&, char&);
void printlexiSExpression(map<char, vector<char>>, char);
int main() {
string input;
getline(cin, input);
char root;
map<char, vector<char>> adjList; //Adjacency list of every parent to every child
map<char, int> numParents; //Map of all nodes to number of parents. Used for E4, E5 checks.
//Parse inputs and perform error checking
if (!parseInputs(input, adjList, numParents, root)) { //parseInputs returns false if error was found
return 0;
}
//If no errors found, printout lexicographically smallest S-Expression
printlexiSExpression(adjList, root);
return 0;
}
bool parseInputs(string input, map<char, vector<char>>& adjList, map<char, int>& numParents, char& root) {
char parent;
int index = 0;
bool E5Error = false;
//For every character in input string
for (int i = 0; i < input.length(); i++) {
if (input[i] != '(' && input[i] != ')' && input[i] != ',' && input[i] != ' ') { //If input[i] is a node
index++;
if (index % 2 == 1) { //input[i] is a parent node. Store it for use in next iteration.
//Input format check (E1)
if (i - 1 >= 0 && input[i-1] != '(') {
cout << "E1\n";
return false;
} else if (i + 1 < input.length() && input[i+1] != ',') {
cout << "E1\n";
return false;
}
//Store parent for use in next iteration
parent = input[i];
} else { //input[i] is a child node. Check for input errors, then add to adjacency list if error checks pass
//Input format check (E1)
if (i - 1 >= 0 && input[i-1] != ',') {
cout << "E1\n";
return false;
} else if (i + 1 < input.length() && input[i+1] != ')') {
cout << "E1\n";
return false;
}
//Check Duplicates (E2)
for (int j = 0; j < adjList[parent].size(); j++) {
if (adjList[parent][j] == input[i]) { //If there is already such a parent/child pair
cout << "E2\n";
return false;
}
}
//Check Binary tree violations (E3)
if (adjList[parent].size() == 2) { //If parent node already has 2 child
cout << "E3\n";
return false;
}
//Check Multiple parents (tree contains cycle) (E5)
numParents[input[i]]++;
numParents[parent];
if (numParents[input[i]] == 2) { //If node has 2 parents already
E5Error = true;
}
//Else (no violations), store to adjacency list
adjList[parent].push_back(input[i]);
index = 0;
}
} else if (i - 1 <= 0 && input[i] == ' ') { //If input[i] is not a tree node, then perform input format check for consecutive spaces (E1)
if (input[i] == ' ') {
cout << "E1\n";
return false;
}
}
}
//Multiple roots check (E4)
int numRoots = 0;
for (auto kv : numParents) {
if (kv.second == 0) { //If node has no parents, it has to be a root
root = kv.first; //Set root of tree for S-Expression printout later
numRoots++;
if (numRoots == 2) { //If tree has more than 1 root
cout << "E4\n";
return false;
}
}
}
//Cycle check (E5) printout. Perform this after E4's check to print errors in order (E5)
if (E5Error == true) {
cout << "E5\n";
return false;
}
//No errors
return true;
}
void printlexiSExpression(map<char, vector<char>> adjList, char current) {
cout << "(" << current;
int numChild = adjList[current].size();
if (numChild == 1) {
printlexiSExpression(adjList, adjList[current][0]);
} else if (numChild == 2) {
//Determine lexicographically smallest ordering
if (adjList[current][0] < adjList[current][1]) {
printlexiSExpression(adjList, adjList[current][0]);
printlexiSExpression(adjList, adjList[current][1]);
} else {
printlexiSExpression(adjList, adjList[current][1]);
printlexiSExpression(adjList, adjList[current][0]);
}
}
cout << ")";
}
To learn more about input
https://brainly.com/question/20295442
#SPJ4