Develop a program that will maintain an ordered linked list of positive whole numbers. Your program will provide for the following options: a. Add a number b. Delete a number c. Search for a number d. Display the whole list of numbers At all times, the program will keep the list ordered (the smallest number first and the largest number last).

Answers

Answer 1

Answer:

#include <iostream>

using namespace std;

struct entry

{

int number;

entry* next;

};

void orderedInsert(entry** head_ref,entry* new_node);

void init_node(entry *head,int n)

{

head->number = n;

head->next =NULL;

}

void insert(struct entry **head, int n)

{

entry *nNode = new entry;

nNode->number = n;

nNode->next = *head;

*head = nNode;

}

entry *searchNode(entry *head, int n)

{

entry *curr = head;

while(curr)

{

if(curr->number == n)

return curr;

curr = curr->next;

}

}

bool delNode(entry **head, entry *ptrDel)

{

entry *curr = *head;

if(ptrDel == *head)

{

*head = curr->next;

delete ptrDel;

return true;

}

while(curr)

{

if(curr->next == ptrDel)

{

curr->next = ptrDel->next;

delete ptrDel;

return true;

}

curr = curr->next;

}

return false;

}

void display(struct entry *head)

{

entry *list = head;

while(list!=NULL)

{

cout << list->number << " ";

list = list->next;

}

cout << endl;

cout << endl;

}

//Define the function to sort the list.

void insertionSort(struct entry **h_ref)

{

// Initialize the list

struct entry *ordered = NULL;

// Insert node to sorted list.

struct entry *current = *h_ref;

while (current != NULL)

{

struct entry *next = current->next;

// insert current in the ordered list

orderedInsert(&ordered, current);

// Update current

current = next;

}

// Update the list.

*h_ref = ordered;

}

//Define the function to insert and traverse the ordered list

void orderedInsert(struct entry** h_ref, struct entry* n_node)

{

struct entry* current;

/* Check for the head end */

if (*h_ref == NULL || (*h_ref)->number >= n_node->number)

{

n_node->next = *h_ref;

*h_ref = n_node;

}

else

{

//search the node before insertion

current = *h_ref;

while (current->next!=NULL &&

current->next->number < n_node->number)

{

current = current->next;

}

//Adjust the next node.

n_node->next = current->next;

current->next = n_node;

}

}

int main()

{

//Define the structure and variables.

char ch;int i=0;

entry *newHead;

entry *head = new entry;

entry *ptr;

entry *ptrDelete;

//Use do while loop to countinue in program.

do

{

//Define the variables

int n;

int s;

int item;

char choice;

//Accept the user choice

cout<<"Enter your choice:"<<endl;

cout<<"a. Add a number"<<endl

<<"b. Delete a number"<<endl

<<"c. Search for a number"<<endl

<<"d. Display the whole list of numbers"<<endl;

cin>>choice;

//Check the choice.

switch(choice)

{

//Insert an item in the list.

case 'a' :

// cin>>item;

cout<<"Enter the element:"<<endl;

cin>>item;

//To insert the first element

if(i==0)

init_node(head,item);

//To insert remaining element.

else

{

ptr = searchNode(head,item);

//Check for Duplicate data item.

if(ptr==NULL)

{

insert(&head,item);

}

else

{

cout<<"Duplicate data items not allowed";

cout<<endl<<"EnterAgain"<<endl;

cin>>item;

insert(&head,item);

}

}

insertionSort(&head);

i=i+1;

break;

//Delete the item from the list

case 'b' :

int numDel;

cout<<"Enter the number to be deleted :"<<endl;

cin>>numDel;

//Locate the node.

ptrDelete = searchNode(head,numDel);

if(ptrDelete==NULL)

cout<<"Element not found";

else

{

if(delNode(&head,ptrDelete))

cout << "Node "<< numDel << " deleted!\n";

}

break;

//Serach the item in the list.

case 'c' :

cout<<"Enter the element to be searched :";

cout<<endl;

cin>>s;

ptr = searchNode(head,s);

if(ptr==NULL)

cout<<"Element not found";

else

cout<<"Element found";

break;

//Display the list.

case 'd' :

display(head);

break;

default :

cout << "Invalid choice" << endl;

break;

}

//Ask user to run the program again

cout<<endl<<"Enter y to countinue: ";

cin>>ch;

}while(ch=='y'||ch=='Y');

return 0;

}

output:

Develop A Program That Will Maintain An Ordered Linked List Of Positive Whole Numbers. Your Program Will

Related Questions

Consider the following JavaScript code fragment:var greeting = function ( name ) {console.log ( name )}The best answer for what is wrong with this code is:Group of answer choices

Answers

Answer:

name is a reserved word in JS and cannot be used as an identifier

Explanation:

From the group of answer choices provided the only one that may be a problem would be using the word name as a parameter. Although name is not a reserved word per say in JS it is in HTML, and since JS targets HTML it could cause some errors. This however does not prevent this code from running correctly. JS does not require semicolons anymore, and the opening and closing braces for a body of code does not need to be on their own lines. Also, variable names are not Strings and do not need to be inside quotes, even for console.log()

If every company is now a technology company, then what does this mean for every student attending a business college

Answers

Answer:

Explanation:

There are all sorts of possibilities for, say, inserting new technologies into existing processes. But most of these improvements are incremental. They are worth doing; in fact, they may be necessary for survival. No self-respecting airline, for instance, could do without an application that lets you download your boarding pass to your mobile telephone. It saves paper, can't get lost and customers want it.

But while it's essential to offer applications like the electronic boarding pass, those will not distinguish a company. Electronic boarding passes have already been replicated by nearly every airline. In fact, we've already forgotten who was first.

The term __________ denotes data that is being stored on devices like a universal serial bus (USB) thumb drive, laptop, server, DVD, CD, or server. The term __________ denotes data that exists in a mobile state on the network, such as data on the Internet, wireless networks, or a private network. A. data in transit, data on record B. data at rest, data in transit C. data in transit, data at rest D. data on record, data in motion

Answers

Answer:

B. data at rest, data in transit

Explanation:

A database management system (DBMS) can be defined as a collection of software applications that typically enables computer users to effectively and efficiently create, store, modify, retrieve, centralize and manage data or informations in a database. Thus, it allows computer users to efficiently retrieve and manage their data with an appropriate level of security.

Generally, a database management system (DBMS) acts as an intermediary between the physical data files stored on a computer system and any software application or program.

Data at rest refers to a form of data that is stored on devices such as; a universal serial bus (USB) thumb drive, laptop, server, DVD, CD, or server.

Data in transit is simply any data that exists in a mobile or dynamic state on the network, such as data on the Internet, wireless networks, or a private network.

You have two microservices that need to communicate with each other without holding up a thread on either end. One service will receive an ID and return a message once the job is complete.
Which communication framework should be used?
A.) Have a shared database that allows both
applications to read and write to the tables to share the data instead of having to communicate
B.) Use asynchronous messaging to send and receive messages between each microservice
C.) Abandon the microservice architecture so no interaction is needed
D.) Create a third service to handle the interaction between the services
E.) Use a RESTful architecture for both, send the ID through a POST, and ping the service with a GET until a response is available

Answers

Answer: E. Use a RESTful architecture for both, send the ID through a POST, and ping the service with a GET until a response is available.

Explanation:

Since there are two microservices that need to communicate with each other without holding up a thread on either end, the communication framework should be used is a RESTful architecture for both, send the ID through a POST, and ping the service with a GET until a response is available.

REST is a software architectural style which is used in defining the set of rules that be used for the creation of web services. The REST architecture allows requesting systems to be able to access and manipulate web resources.

In the right situations, the use of multi-threads can allow for application speedup. Provide a small code example that illustrates how threads can be used to arrive at an appropriate result. Identify if there is a point where too many threads might impact performance of the application. g

Answers

Answer:

Explanation:

Threads allow an applications to run faster because they allow various tasks to run at the same time instead of doing one at a time and having to wait for one to finish before starting the next task. However, if too many threads are running at the same time, or a thread has a very large task or requires another task to finish before finishing its own then this can drastically impact performance. Mainly because too many resources are being used at a single moment. The following code is a small example of how threads work in Python.

import threading

import time

def thread_function(name):

   print("Thread {name}: starting")

   time.sleep(2)

   print("Thread {name}: finishing")

thread1 = threading.Thread(target=thread_function, args=(1,))

thread1.start()

time.sleep(1)

thread2 = threading.Thread(target=thread_function, args=(2,))

thread2.start()

thread2.join()

what is the python ?​

Answers

Answer:

Python is an interpreted high-level general-purpose programming language. Python's design philosophy emphasizes code readability with its notable use of significant indentation. 

This is my Opinion.

Python is an interpreted high-level general-purpose programming language. Python's design philosophy emphasizes code readability with its notable use of significant indentation.

Hope this helps you :)

An engineer is configuring AMP for endpoints and wants to block certain files from executing. Which outbreak control method is used to accomplish this task

Answers

Question Completion with Options:

A. device flow correlation

B. simple detections

C. application blocking list

D. advanced custom detections

Answer:

The outbreak control method that is used to accomplish the task of configuring AMP for endpoints and to block certain files from executing is:

C. application blocking list

Explanation:

The application blocking list creates a list of application files, which the AMP continuously tracks and analyzes to compare the file activities with previous cyber attacks.  Specifically, the AMP for Endpoints is a cloud-managed endpoint security solution, which provides a retrospective alert to prevent cyber-security threats, and rapidly detects, contains, and remediates malicious files on the endpoints.

continuously tracks and analyzes files and file activities across your systems, and compares these events to what preceded or happened in past attacks. If a file exhibits malicious behavior, the AMP provides you with a retrospective alert which enables you to stop a potential threat from succeeding.

11111 Power 2 sovle ​

Answers

123,454,321. you just multiply 11111 by itself

Given the following array definition, write a constant declaration named ArraySize that automatically calculates the size in bytes, of the array:
newArray DWORD 10,20,30,40,50
a) arraysize=(S-newArray)
b) arraysize#(S-new,Array)/2
c) arraySize- (S-newArray)/4
d) arraySize- (S-arraySize)

Answers

Answer:

ArraySize = ($ - newArray)

Explanation:

Given

Array name: newArray

Type: DWORD

Required

The size of the array in bytes

The following formula is used to calculate the size of an array in assembly language.

Variable = ($-Array name)

So, we have:

ArraySize = ($ - newArray)

Where ArraySize is the variable that holds the size of newArray (in bytes)

31. Explain what the program does. Write out the output 20 PRINT "Hellooo00000000000, world!" 30 PRINT "I'm learning about commands in BASIC." 40 PRINT 'This text is being printed via the PRINT commarrd. 2 209​

Answers

o_num = input ("Please enter the amount of \"o\": ")

zero_num = input ("Please enter the amount of zeros: ")

i = 0

while i < o_num and i < zero_num:

repeat_o = "Hell" + o_num

repeat_zero = repeat_o + zero_num

i+=1

print (repeat_zero)

Marco travels often and does not have consistent wireless Internet service. He frequently uses his mobile phone service to provide Internet access to his tablet.

Which network type is Marco using?


LAN


PAN


WAN


MAN

Answers

Answer:

PAN

Explanation:

For wireless devices like laptops, tablets, wireless desktops, and cellphones to communicate, a wireless LAN normally has a Wi-Fi router or wireless access point. A wireless LAN is essentially a LAN that doesn't use cables. Thus, option B is correct.

What are the PAN  network type is Marco using?

The computer network that links computers and other devices within a specific person's range is known as a personal area network (PAN). PAN stands for personal area network and gives a network range within a person's range, often within a range of 10 meters (33 feet).

A PAN is a network that primarily serves a tiny space, usually a single small room. It allows computer devices to share data and information with other nearby computers.

Therefore, Whereas in LAN, computers are connected via a network over a short distance, such as within a building, or in a single computer network made up of several computers.

Learn more about network type here:

https://brainly.com/question/29515062

#SPJ2

What Internet access method would be suitable for a business requiring a high bandwidth connection where no cabled options exist?

Answers

Answer:

Fiber Optic, it allows for speeds up to 1200 mbps

Explanation:

Which terms means device that converts one voltage to another ?

Answers

Answer:

I believe it is an adapter

Explanation:

An adapter or adaptor is a device that converts attributes of one electrical device or system to those of an otherwise incompatible device or system. Some modify power or signal attributes, while others merely adapt the physical form of one connector to another.

https://ref.surveyj.co/Oware111​

Answers

What is the link?

IS IT A HACKING LINK

Give three reasons to use a hard drive as mass storage.

Answers

Answer:

With that in mind, let's take a look at five places where hard drives shine.

Backups and Archives. ...

Media Libraries. ...

Large Capacity Storage. ...

NAS Drives and Security. ...

RAID Arrays. ...

Other Uses.

Write a recursive function named is_decreasing that takes as its parameter a list of numbers. It should return True if the elements of the list are strictly decreasing (each element in the array is strictly less than the previous one), but return False otherwise.

Answers

Answer:

c

Explanation:

Can someone compress this ipv6 address? 558c:0000:0000:d367:7c8e:1216:0000:66be

Answers

558c::d367:7c8e:1216:0:66be

Binary search is a very fast searching algorithm, however it requires a set of numbers to be sorted.

a. True
b. False

Answers

I’m sure the answer is true

Write a program that accepts the lengths of three sides of a triangle as an input from the user: A, B, C

Validate the user input so that the user can only enter positive values for sides A, B, C. All three must be true:

A > 0
B > 0
C > 0

Answers

Answer:

The program in Python is as follows:

A = int(input("A: "))

B = int(input("B: "))

C = int(input("C: "))

while A<=0 or B <= 0 or C <= 0:

   A = int(input("A: "))

   B = int(input("B: "))

   C = int(input("C: "))

print("Valid inputs")

Explanation:

Get input for A, B and C

A = int(input("A: "))

B = int(input("B: "))

C = int(input("C: "))

The loop is repeated until inputs for A, B and C are above 0

while A<=0 or B <= 0 or C <= 0:

Get input for A, B and C

   A = int(input("A: "))

   B = int(input("B: "))

   C = int(input("C: "))

Print valid inputs when user inputs are correct

print("Valid inputs")

Which statement is accurate to describe a spreadsheet versus an Excel workbook?
a) worksheets have one or more workbooks.
b) workbooks have one or more worksheets.
c) workbooks are the same as word documents.
d) worksheets always refer to real paper.

Answers

C is the correct answer

Consider an Erlang loss system. The average processing time is 3 minutes. The average inter-arrival time is 3 minutes. The number of servers is 3. What is r (sometimes referred to as the offered load)

Answers

Answer:

r = 1

Explanation:

Average processing time ( p ) = 3 minutes

Average inter-arrival time ( a ) = 3 minutes

number of servers ( m ) = 3

Determine the value of r

r ( offered load ) = p/a

                          = 3 / 3  = 1

∴ value of r ( offered load ) = 1

Output is the act of is the act of entering the data to the computer?​

Answers

Answer:

Output is the act of the computer display information based on your input

Explanation:

Funny thing is that output is the exact opposite of what you just described

Identify the statement about Windows tasks that is FALSE.


To launch an application, click the Windows icon, select "All Programs," and then click an application.


The boot process is the process for powering off a computer.


A common way to shut down the computer’s operating system is by using the Start menu.


Users log into their accounts on the Welcome screen, before Windows is ready to use.

Answers

The statement about Windows tasks that is FALSE is

The boot process is the process for powering off a computer.

According to the question, we are to discuss about Windows tasks and how it works as regards to the computer.

As a result of this we can see that  in launching an application;

we need to click on Windows iconselect "All Programs," click an application.

Therefore, The boot process is not the process for powering off a computer.

Learn more about Windows tasks .

https://brainly.com/question/1594289

The statement that is false is: The boot process is the process for powering off a computer, which is the second option. The boot process is actually the process of starting or powering on a computer, not powering it off.

The boot process refers to the sequence of events that occur when a computer is powered on or restarted. It is the process of starting up the computer's hardware and loading the operating system into memory so that it is ready for use. During the boot process, the computer's firmware (such as the BIOS or UEFI) performs a series of checks and tests to ensure that the hardware components are functioning correctly. It then searches for the operating system on connected storage devices, such as the hard drive or solid-state drive, and loads it into memory.

Learn more about the boot process here.

https://brainly.com/question/24355262

#SPJ6

__________ makes the hardware usable, while __________ commands it to perform specific tasks. a.) The operating system, RAM b.) The CPU, RAM c.) The application software, the hard disk d.) The operating system, the application software

Answers

Answer:

a then c

Explanation:

Without an operating system you just have a pile of metal, and the program contains code, which is just a series of commands

Answer:

d.) The operating system, the application software

AWS's EC2 is primarily considered which type? OA OB. Maas O Claas O D. None of the above O E. Serverless​

Answers

Answer:

IaaS (Infrastructure as a Service)

"Amazon takes the responsibility of networking, storage, server and virtualization and the user is responsible for managing the Operating System, middleware, runtime, data and application."

Suppose you and four of your friends are wirelessly connected with the home wireless router. [03] At this moment router is not transmitting data to the outgoing link and all of you want to browse internet and send packets of same size to the router. Consider the bandwidth of the outgoing link is20Mbps , packet size is 2500 bytes and the processing delay of each packet is
2μs . If your packet is queued at position eleven, calculate the delay after which your packet will be transmitted

Answers

format please? i cant understand

A network administrator needs 10 prevent users from accessing the accounting department records. All users are connected to the same Layer 2 device and access the internal through the same router. Which of the following should be Implemented to segment me accounting department from the rest of the users?

a. Implement VLANs and an ACL.
b. Install a firewall and create a DMZ.
c. Create a site-to-site VPN.
d. Enable MAC address filtering.

Answers

Answer:

C

Explanation:

definitely C you’re welcome

A technique that uses data that is labeled to train or teach a machine.
Reinforcement
Unsupervised
Supervised

Answers

Answer:

computer.

Explanation:

it uses data that is labeled to train.

7. System software is the set of software programs that helps run the computer and coordinates instructions between application software and hardware devices. It consists of the operating system (OS) and utility programs. How does the mindset of the designer affect the design of the operating system (e.g., Windows vs. Linux)

Answers

Answer:

Explanation:

The main goal when designing an operating system (OS) is to make sure that the system is as efficient and intuitive as possible. This is the mindset that designers have when creating the operating system. However, this also creates drastically different designs between designers, mainly because one design structure will feel much more natural and intuitive to one designer but not another. Since the designer's own personal taste/mindset drastically affects the design, most companies find their target audience and survey/test various designs. This is done in order to find what features and styles best fit the vast majority of the people.

A security analyst recommends implementing SSL for an existing web service. A technician installs the SSL certificate and successfully tests the connection on the server. Soon after, the help desk begins receiving calls from users who are unable to log in. After further investigation, it becomes clear that no users have successfully connected to the web server since the certificate installation. Which of the following is MOST likely the issue?
A. DA Incorrect firewall rules are blocking HTTPS traffic.
B. Users are still accessing the IP address and not the HTTPS address.
C. DC Workstations need an updated trusted sites list.
D Users are not using tokens to log on.

Answers

C- I think. I hope this helps you.
Other Questions
Which of the following he following events took place during Jeffersons term in office ? ( No links aloud ) d. Dinesh said to his friends, Who went to Muktinath for worshipping the God?" Dinesh asked his friends ...... What do the travel agent can someone help me get the answer to this Make p the subject of this formulae q-2p=p+4 After leaving school, Ms. Crandall catches another colleague in the parking lot. She expresses to him that while she can explain any of the concepts focal to teaching fourth-grade science, she is having trouble reaching her students. She just can't get them to see the link between the content matter and real-world application; therefore, she is having trouble keeping them motivated and on-task. In which area is Ms. Crandall experiencing difficulty Solve equation by using the quadratic formula help me with this... Mathew travels 42/50 meters in 26/30 minutes. Find the speed of Mathew in meters per second Carpenter Inc. had a balance of $88,000 in its quality-assurance warranty liability account as of December 31, 2020. In 2021, Carpenter's warranty expenditures paid were $453,000. Its warranty expense is calculated as 1% of sales. Sales in 2021 were $40.8 million. What was the balance in the warranty liability account as of December 31, 2021 Missionary salespeople are: Group of answer choices salespeople who process routine orders for products that are presold by the company sales support personnel who do not directly solicit orders but rather concentrate on performing promotional activities and introducing new products. salespeople who specialize in identifying, analyzing, and solving customer problems, but who do not actually sell products and services people on the selling team who are responsible for obtaining qualified leads. salespeople who identify prospective customers, provide customers with information, persuade customers to buy, close sales, and follow up on a customer's use of the product or service. The relative humidity is 60 percent, and the day is partly cloudy. What is the maximum temperature at which the team is allowed to practice in helmets, shoulder pads, and shorts? what did people want added to the constitution before they would approve it? Patty is the Plaintiff in a trial and Daryl is the Defendant. Patty and Daryl each call their witnesses, offer their evidence, and presents their side of the case. The parties rest and give their closing statements. The jury finds for Patty. Daryl disagrees with the verdict. Name one option that Daryl can do at this point of the post-trial process and what that option will do for him. Please help fill in the blanks !!!In the process of photosynthesis, _______ in autotrophs convert solar energy into chemical energy and store this 'food' for later use. The reaction for photosynthesis is: 6CO2(g) + 6H2O(l) + energy --> C6H12O6(s) + O2(g). In the process of ________, mitochondria in the cells of plants, animals and other multicellular organisms break down 'food' molecules to generate molecules of _______ . This is the source of energy for all cellular functions. The reaction for cellular respiration is: ________ATPchemosynthesischloroplastscellular respirationNADPH and FADH2C6H1206(s) + 02(g) -- CO2(g) + 6H20(I) + energy A microbiologist is conducting a research project on chemolithoautotrophs. This means that the investigator is examining certain aspects of a bacterium that is a purple nonsulfur bacteria which depends on light. uses light as its energy source and carbon for organic compounds. can oxidize inorganic molecules such as ammonia and sulfur for energy. can use the energy from sunlight to build organic molecules from carbon dioxide. obtains carbon from organic molecules. Match each line from a haiku to the motif it includes."the white of the moonflower""as the sound fades""autumn evening" Rewrite the fraction in the sentence below as a percentage. From 125 yards away, a marksman hit 11/20 of the targets last year. difference between good behaviour and bad behaviour 12,963 rounded to the nearest hundredth