FINISH print and freelist
#include<stdio.h>
#include <stdlib.h>
struct node {
int data;
struct node *next;
};
struct node* insert(struct node* list,int d );
struct node* del(struct node* list,int d );
void print( struct node *list);
void freeList(struct node* list);
void copy ( struct node *q, struct node **s );
int main( ) {
int number = 0, choice = 0;
struct node *pList=NULL;
struct node *nList = NULL;
while(choice!= 4)
{
printf("Do you want to (1)insert, (2)delete, (3)Copy (4)quit.\n");
scanf("%d", &choice);
printf("Your choice is %d\n", choice);
if (choice == 1)
{
printf("Enter the value to insert\n");
scanf("%d", &number);
pList = insert(pList, number);
printf("Items in linked list: ");
print(pList);
printf("\n");
}
else if (choice == 2)
{
printf("Enter the value to delete.\n");
scanf("%d", &number);
pList = del(pList, number);
printf("Items in linked list: ");
print(pList);
printf("\n");
}
else if (choice == 3)
{
if (nList)
freeList(nList);
copy(pList, &nList);
printf("Items in NEW linked list: ");
print(nList);
printf("\n");
}
else
{
break;
}
}
freeList(nList);
freeList(pList);
printf("\nBye..\n");
return 0;
}
void copy ( struct node *source, struct node **dest )
{
if(source != NULL)
{
*dest = malloc(sizeof(struct node));
(*dest)-> data = source -> data;
(*dest) -> next= NULL;
copy(source->next, &((*dest)->next));
}
}
struct node* insert(struct node *list,int item)
{
if(list == NULL || item <= list->data)
{
struct node * pNew = (struct node *) (malloc(sizeof(struct node)));
pNew->data = item;
pNew->next = list;
return pNew;
}
list->next = insert(list->next, item);
return list;
}
struct node* del(struct node *list, int item)
{
if(list == NULL)
return NULL;
if(list->data == item)
{
struct node* rest = list->next;
free(list);
return rest;
}
list->next = del(list->next, item);
return list;
}
void print(struct node *list)
{
}
void freeList(struct node* list)
{
}
In: Computer Science
Could you please write a working program "linkedlist.cpp" using recursive approach for the given files below
--------------------------------------------------------------------------------------------
// app.cpp
#include <iostream>
#include "linkedlist.h"
using namespace std;
void find(LinkedList& list, char ch)
{
if (list.find(ch))
cout << "found ";
else
cout << "did not find ";
cout << ch << endl;
}
int main()
{
LinkedList list;
list.add('x');
list.add('y');
list.add('z');
cout << list;
find(list, 'y');
list.del('y');
cout << list;
find(list, 'y');
list.del('x');
cout << list;
find(list, 'y');
list.del('z');
cout << list;
find(list, 'y');
return 0;
}
--------------------------------------------------------------------
// linkedlist.h
#ifndef _LINKED_LIST_
#define _LINKED_LIST_
#include <ostream>
class LinkedList
{
public:
LinkedList();
~LinkedList();
void add(char ch);
bool find(char ch);
bool del(char ch);
friend std::ostream& operator<<(std::ostream& out, LinkedList& list);
};
#endif // _LINKED_LIST_
In: Computer Science
One contributor to the cost of college education is the purchase of textbooks. Administrators at a private college are interested in estimating the average amount students spend on textbooks during the first four years at the college. A random sample of 200 students was taken showing a sample mean of X ̅ = $5,230. Suppose that past studies have indicated that the population standard deviation for the amount students spend on textbooks at this college is σ = $500.
a.Develop and interpret 90% confidence interval estimate of the population mean.
b.Develop and interpret 95% confidence interval estimate of the population mean.
c.Discuss what happens to the width of the confidence interval (margin of error) as the confidence level is increased?
In: Statistics and Probability
3. The scores for all students taking the ACT test in a recent year are normally distributed with a mean of 21.0 and a standard deviation of 4.7.
In: Statistics and Probability
|
Student |
||||||||||
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
|
|
Pre-test score |
70 |
62 |
63 |
61 |
56 |
52 |
71 |
63 |
64 |
67 |
|
Post-test score |
87 |
71 |
82 |
78 |
57 |
50 |
72 |
65 |
78 |
65 |
Do the assessment test results support the assertion that the students benefited from the course? Explain why?
Show your work
In: Statistics and Probability
Math class of differential equations adivse for students.
Imagine that you are invited
to speak on the first day of your class diffrential equation.to
give advice to entering students. Write at least three sentences
responding to one or two of the following, describing what you
would tell them.
In: Physics
In a study of government financial aid for college students, it becomes necessary to estimate the percentage of full-time college students who earn a bachelor's degree in four years or less. Find the sample size needed to estimate that percentage. Use a 0.04 margin of error and use a confidence level of 90%.
Complete parts (a) through (b) below.
a. Assume that nothing is known about the percentage to be estimated.
n= _____
(Round up to the nearest integer.)
b. Assume prior studies have shown that about 40% of full-time students earn bachelor's degrees in four years or less.
n= _____
(Round up to the nearest integer.)
In: Statistics and Probability
Are teacher evaluations independent of grades? After midterms, a random sample of 284 students was asked to evaluate teacher performance. The students were also asked to supply their midterm grade in the course being evaluated. In this study, only students with a grade of A, B, or C were included in the summary table. Use a 5% level of significance to test the claim that teacher evaluations are independent of midterm grades.
Mid Term Grades
| Evaluation | A | B | C | Row Total |
|---|---|---|---|---|
|
Positive |
53 | 33 | 18 | 104 |
| Neutral | 25 | 46 | 29 | 100 |
| Negative | 14 | 22 | 44 | 80 |
| column Total | 92 | 101 | 91 | 284 |
In: Statistics and Probability
In a study of government financial aid for college students, it becomes necessary to estimate the percentage of full-time college students who earn a bachelor's degree in four years or less. Find the sample size needed to estimate that percentage. Use a 0.04 margin of error and use a confidence level of 95%. Complete parts (a) through (c) below.
a. Assume that nothing is known about the percentage to be estimated. (Round up to the nearest integer.)
N=600
b. Assume prior studies have shown that about 60% of full-time students earn bachelor's degrees in four years or less.
(Round up to the nearest integer.)
In: Statistics and Probability
In a 1993 survey of 560 college students, 171 said that they used illegal drugs in the past year. In a more recent survey of 720 college students, 263 said that they used illegal drugs during the previous year. We want to know if the evidence supports the claim that the proportion of college students using illegal drugs has increased since 1993 at a 0.05 significance level.
1.Regardless of whether the requirements are met, conduct the appropriate hypothesis test. What is the value of the z test statistic, written to two decimal places?
2.What is the p-value for the z test statistic, written to three decimal places?
In: Statistics and Probability