Program ending alone; Linked lists in C

Hello, I have two little problems in my code.

It closes twice, one when I'm going to print on the screen the elements of my linked lists and another when I'm going to insert the elements of a text file and insert them in the list.

Here are the most relevant features to solve this problem.

struct ender {
Character name[100];
streetcar[100];
chariot city[100];
character status[100];
unsigned long int cep;
struct ender * prox;
};

typedef struct ender end;

end * info

List body.

empty fingerprints (end * ini, int * index)
{
int i = 0;

end * p;

for (p = ini-> prox; i < *indice && p != NULL; p = p->prox)
if (isalpha (p-> name[0])) {
printf ("- registry% d:  n", i ++);
printf (" t Name:% s", p-> name);
printf (" t Street:% s", p-> street);
printf (" t City:% s", p-> city);
printf (" t State:% s  n", p-> state);
printf (" t CEP:% lu  n", p-> cep);
}
}

Print function /.

void le_arq_text (int * index, end * info)
{
int i = 0;
FILE * file;

* index = 100;
info = (end *) realloc (info, 100 * sizeof (end));
file = fopen ("database.txt", "r");
create_list (info);

end * read = info;

for <= *indice && read != NULL; i++, read = read->prox)
if I < 0){
            le_string_arquivo(read->name, 100, file);
le_string_file (read-> street, 100, file);
le_string_file (read-> city, 100, file);
le_string_file (read-> state, 100, file);
fscanf (file, "% ld", & read-> cep);
i ++;
read = free (read);
}
fclose (file);
}

Function that passes from the text file to the list /.
Below, the "create_list" and "free" functions mentioned in the le_arq_text function.

end * free (end * info)
{
end * new;

new = (end *) malloc (sizeof (end));
new-> prox = info-> prox;
info-> prox = new;

return again;

}

Free function, retrone the free cell from the list /.

void create_list (end * info)
{
info = (end *) malloc (sizeof (end));
info-> prox = NULL;
}

Create_list function, creates an empty list /.

I hope it was clear, thanks for all the help available.

c – Detection of blockages in the linked list of secure threads

I've recently had the duty to set up a unique secure link list for threads that locks items from hand to hand, which means that there is a unique lock for each item in the list. I implemented all the functions and tested them without having to deal with problematic thread situations and they all worked but I wanted to test whether there could be a stalemate or starvation situation. but I do not know how to do it and can I know by looking at my code if I could have a dead end or starvation? I'm not sure either that there should be so much locking and unlocking in the code. Any help or suggestion regarding my code? Is it subject to dead ends, famine or other problems? I will post my code below. Thank you in advance.

concurrent_list.h:

typedef struct node node;
typedef struct list list;

list * create_list ();
void delete_list (list * list);
void print_list (list * list);
void insert_value (list * list, int value);
void remove_value (list * list, int value);
void count_list (list * list, int (* predicate) (int));

concurrent_list.c:

    #understand 
 #understand 
 #understand 
 #understand 
 #include "competitor_list.h"

structured node {
int value;
next node *;
pthread_mutex_t lock; // hand on hand implies a lock for each node
};

list of structures {
knot * head;
};

// display the value of a node
void print_node (node ​​* node)
{
if (node)
{
printf ("% d", node-> value);
}

}

// create a new empty list
list * create_list ()
{
list * l = (list *) malloc (sizeof (list));

if (l == NULL) returns NULL;

l-> head = NULL;

return l;
}

// delete the complete list
void delete_list (list * list)
{
if (list == NULL) returns; // if the pointer in the list is NULL, do nothing

node * current = list-> head;

if (current == NULL) return; // if the list header is NULL then do nothing

pthread_mutex_lock (& ​​(current-> lock)); // locked list head

node * temp = current-> next;
knot * dummy;

if (temp == NULL) // remove the only item from the list
{
pthread_mutex_unlock (& ​​(current-> lock));
pthread_mutex_destroy (& (current-> lock));
free (current);
return;
}

pthread_mutex_lock (& ​​(temp-> lock)); // lock the successor of the head

while (1)
{
pthread_mutex_unlock (& ​​(current-> lock)); // unlock the current node
dummy = current;
current = temp; // current becomes his successor
pthread_mutex_destroy (& (dummy-> lock));
free (dummy); // dummy free because it's a pointer to current
temp = temp-> next; // current becomes his successor
if (temp == NULL) pause; // exit loop if we are at the end of the
listing
pthread_mutex_lock (& ​​(temp-> lock)); // lock the current successor
}

pthread_mutex_unlock (& ​​(current-> lock));
pthread_mutex_destroy (& (current-> lock));
free (current); // release the last item from the list
list-> head = NULL;
free (list); // release the list
}

// insert a function for a new value if a value already exists, then
nothing
void insert_value (list * list, int value)
{
if (list == NULL) returns; // if the pointer in the list is NULL, do nothing

node * new_node = malloc (sizeof (node)); // create a new node

if (new_node == NULL) returns; // check if the allocation fails

new_node-> value = value;

new_node-> next = NULL;

pthread_mutex_init (& (new_node-> lock), NULL); // initialize the fast mutex lock for the new node

pthread_mutex_lock (& ​​(new_node-> lock)); // lock the new node

if (list-> head == NULL) // new node is the first item in the list
{
new_node-> next = NULL;
list-> head = new_node;
pthread_mutex_unlock (& ​​(new_node-> lock));
return;
}

pthread_mutex_lock (& ​​(list-> head-> lock)); // lock the head of the list

node * temp;

if (list-> header-> value> = new_node-> value) // the new node comes before the list header
{
new_node-> next = list-> head;
temp = list-> head;
list-> head = new_node;
pthread_mutex_unlock (& ​​(list-> head-> lock));
pthread_mutex_unlock (& ​​(temp-> lock));
return;
}

other
{
// Locate the node before the insertion point //

knot * dummy;
node * current = list-> head;
temp = current-> next;

if (temp == NULL) // the new node comes after the list header
{
new_node-> next = current-> next;
current-> next = new_node;
pthread_mutex_unlock (& ​​(new_node-> lock));
pthread_mutex_unlock (& ​​(current-> lock));
return;
}

pthread_mutex_lock (& ​​(temp-> lock)); // lock the successor of the head

// perform the hand-to-hand course of the list
// and check if temp reaches the end of the list (NULL)

while (temp-> value < new_node->value)
{
pthread_mutex_unlock (& ​​(current-> lock));
current = temp;
temp = temp-> next;
if (temp == NULL) pause;
pthread_mutex_lock (& ​​(temp-> lock));
}

if (temp == NULL) // new node will be the last element in this case
{
current-> next = new_node;
new_node-> next = NULL;
pthread_mutex_unlock (& ​​(current-> lock));
pthread_mutex_unlock (& ​​(new_node-> lock));
return;
}

else // new node must be inserted in the list
{
dummy = temp;
new_node-> next = current-> next;
current-> next = new_node;
pthread_mutex_unlock (& ​​(dummy-> lock));
pthread_mutex_unlock (& ​​(current-> lock));
pthread_mutex_unlock (& ​​(new_node-> lock));
return;
}
}
}

// remove the first appearance of a value from the list if it exists in the list
void remove_value (list * list, int value)
{
if (list == NULL) returns; // if the pointer in the list is NULL, do nothing

node * temp;
node * current = list-> head;

if (current == NULL) return; // if the list header is NULL, just go to a new line

pthread_mutex_lock (& ​​(current-> lock)); // lock the head of the list

if (current-> value == value) // delete the beginning of the list if its value is equal to the given value
{
temp = current;
list-> head = current-> next;
pthread_mutex_unlock (& ​​(temp-> lock));
pthread_mutex_destroy (& (temp-> lock));
free (temp);
return;
}

other
{
temp = current-> next;

if (temp == NULL)
{
pthread_mutex_unlock (& ​​(current-> lock));
return;
}

pthread_mutex_lock (& ​​(temp-> lock)); // lock the successor of the head

// perform the hand-to-hand course of the list
// and check if temp reaches the end of the list (NULL)

while (temp-> value! = value) // find the first appearance of a node
which has a value identical to that given
{
pthread_mutex_unlock (& ​​(current-> lock));
current = temp;
temp = temp-> next;
if (temp == NULL) pause;
pthread_mutex_lock (& ​​(temp-> lock));
}

if (temp == NULL) // value not found
{
pthread_mutex_unlock (& ​​(current-> lock));
return;
}

else // delete the appropriate node
{
current-> next = temp-> next;
pthread_mutex_unlock (& ​​(current-> lock));
pthread_mutex_unlock (& ​​(temp-> lock));
pthread_mutex_destroy (& (temp-> lock));
free (temp);
return;
}
}
}

// print the complete list
void print_list (list * list)
{
if (list == NULL) // if the pointer in the list is NULL, then just move to a new line
{
printf (" n");
return;
}

node * current = list-> head;

if (current == NULL) // if the list header is NULL, then just move to a new line
{
printf (" n");
return;
}

pthread_mutex_lock (& ​​(current-> lock)); // lock the head of the list

print_node (current); // show the top of the list

node * temp = current-> next;

if (temp == NULL) // a list with 1 element
{
printf (" n");
pthread_mutex_unlock (& ​​(current-> lock));
return;
}

pthread_mutex_lock (& ​​(temp-> lock)); // lock the successor of the list

while (1)
{
pthread_mutex_unlock (& ​​(current-> lock)); // unlock the current node
current = temp; // current becomes his successor
print_node (current); // display the current node
temp = temp-> next; // // temp becomes his successor
if (temp == NULL) pause; // exit loop if we reach the end of the list
pthread_mutex_lock (& ​​(temp-> lock)); // lock time
}

pthread_mutex_unlock (& ​​(current-> lock)); // unlock the last list
element
printf (" n");
}

// print the number of nodes in the list satisfying a given predicate function
void count_list (list * list, int (* predicate) (int))
{

int account = 0;

if (list == NULL) // if the pointer in the list is NULL, then display the number =
0 and finish
{
printf ("% d elements have been counted  n", count);
return;
}

node * current = list-> head;

if (current == NULL) // if the list header is NULL, then print the number
0 and finish
{
printf ("% d elements have been counted  n", count);
return;
}

pthread_mutex_lock (& ​​(current-> lock)); // lock the list head

if (predicate (current-> value)) count ++; // check the predicate for
the head of the list

node * temp = current-> next;

if (temp == NULL) // the list has only one element
{
pthread_mutex_unlock (& ​​(current-> lock));
printf ("% d elements have been counted  n", count);
return;
}

pthread_mutex_lock (& ​​(temp-> lock)); // lock the successor of the list

while (1)
{
pthread_mutex_unlock (& ​​(current-> lock)); // unlock the current node
current = temp; // current becomes his successor
if (predicate (current-> value)) count ++; // check the predicate for the current node
temp = temp-> next; // // temp becomes his successor
if (temp == NULL) pause; // exit loop if we reach the end of the list
pthread_mutex_lock (& ​​(temp-> lock)); // lock time
}

pthread_mutex_unlock (& ​​(current-> lock)); // unlock the last item in the list

printf ("% d elements have been counted  n", count); // number of impressions
}

Web crawlers – If all web pages are interchangeably linked by taxonomy (categories), do I still need a site map for SEO?

I have a mediaWiki website with about 350 web pages.

If all web pages, without exception, are interchangeably linked by taxonomy (categories)and, in addition, there are also other indicators for web pages, such as a "page of all web pages" or a "recent changes page",
do i still need a sitemap for SEO?

A problem can occur if I forget to add a category to a page.

query – Job Information – Query [msdb].[dbo].SYSJOBS_VIEW via the linked server

I'm trying to create a report to query all my SQL server jobs and their status since the previous night. In order to have a single report instead of a separate report for each server, I use linked server connections to query each SQL server from the report.

When I try to run the query through a linked server connection, I do not get the data from the origin_server column. [msdb].[dbo].SYSJOBS_VIEW, or any column in this view. That's for me to know where the job is running.

When I run the query on a local server, everything goes well and gives me the original server as expected.

Is this a problem of permissions? The user connecting to db_datareader on the msdb database on the linked server.

DECLARE @YEAR INT, @ MONTH INT, @ DAY INT, @ DAY2 INT
DECLARE @DATEs VARCHAR (10), @ DATES2 VARCHAR (10)
DECLARE @LENTGH VARCHAR (8)
SET @ YEAR = YEAR (GETDATE ())
SET @ MONTH = MONTH (GETDATE ())
SET @DAY = DAY (GETDATE ())
SET @ DAY2 = DAY (DATEADD (DAY, -1, GETDATE ()))
SET @DATES = CONVERT (VARCHAR (10), GETDATE (), 121)
SET @ DATES2 = CONVERT (VARCHAR (10), DATEADD (DAY, -1, GETDATE ()), 121)



SELECT JOB.NAME
, JOBVIEW.ORIGINATING_SERVER AS SERVERNAME
,CASE
WHEN JOB.ENABLED = 1 THEN & # 39; ACTIVE & # 39;
WHEN JOB.ENABLED = 0 THEN & # 39; INACTIVE & # 39;
ACTIVE END
,CASE
WHEN LAST_RUN_OUTCOME = 0 THEN & # 39; FAIL & # 39;
WHEN LAST_RUN_OUTCOME = 1 THEN SUCCEED & # 39;
WHEN LAST_RUN_OUTCOME = 3 THEN CANCEL & # 39;
ELSE & # 39; UNKNOWN & # 39;
END OF STATUS
, LAST_OUTCOME_MESSAGE
, LAST_RUN_DATE
, NEXT_RUN_DATE
, LAST_RUN_DURATION
OF [linkedserver].[msdb].[dbo].SYSJOBS JOB
OUTER EXTERNAL JOINT [linkedserver].[msdb].[dbo].SYSJOBSERVERS JOBSERVER ON JOB.JOB_ID = JOBSERVER.JOB_ID
OUTER EXTERNAL JOINT [linkedserver].[msdb].[dbo].SYSJOBSCHEDULES JOBSCH ON JOB.JOB_ID = JOBSCH.JOB_ID
OUTER EXTERNAL JOINT [linkedserver].[msdb].[dbo].SYSJOBS_VIEW JOBVIEW ON JOB.JOB_ID = JOBVIEW.JOB_ID
WHERE LAST_RUN_DATE IN (REPLACE (@DATES, '-'), REPLACE (@ DATES2, -, & # 39; & # 39; & # 39; & # 39;) 39;))

When I give the user sysadmin, I get the information I need, but I do not really want this user to have sysadmin. Is there a specific permission I can grant to users?

c ++ – what's wrong with my copy constructor for an individually linked list?

I am trying to write a linked list individually and I am blocked by the copy constructor. The addition and display worked before that, and I tried to use the add for the copy constructor, but it just left the program with the code of output -1 on fold. I asked my friend about it and he made it work on xcode. But I tried to reproduce visual studio and netbeans without success. My node class is just a structure with an int and a pointer to another node. Can you help me with this? Thank you

my member functions:

Flist :: Flist (const Flist & other) {
Node * x = other.head;
if (other.head == nullptr) {
head = nullptr;
} other {
while (x! = nullptr) {
add (x-> val);
x = x-> next;
}
}
}

void Flist :: add (const int & value) {
Node * x = head;
if (x == nullptr) {
head = new Node {value, nullptr};
} other {
while (x-> next! = nullptr) {
x = x-> next;
}
Node * n = new Node {value, nullptr};
x-> following = n;
}
++ size_;
}

void Flist :: display () {
Node * x = head;
if (x == nullptr) {
std :: cout << << empty;
} other {
while (x! = nullptr) {
std :: cost << x->val;
x = x-> next;
}
}
}

Add and display jobs and outputs: 56

Flist a;
a.add (5);
a.add (6);
a screen();

but that ends with -1 on replit

Flist a;
a.add (5);
a.add (6);
Flist b (a);
b.display ();

Check out my linked website.

Hello,

I've created a website to watch movies online for free https://www.linkedfilm.com/

I've combined the social media service and the online movie service together. Thus, registered users can exchange opinions on movies, share them, etc., while unregistered users can only watch movies.
SEMrush

I would appreciate it, if you visit the website and give me your opinion about it, it will help me.

Thank you in advance.

c – Understand locking in linked lists

I am currently learning locks with mutex and multithreaded data structures. I'm trying to implement a competing sorted linked list data structure that supports inserting, deleting, printing and releasing the entire list and I've write all the functions. Unfortunately for me, I am quite new to the concept of locking in threads. I've tried to implement the linked list sorted with the hand-on-hand lock, but inserting and removing items did not work (I tried the functions on a Red Hat virtual machine) and I do not know if the print function is correct either. have a problem with debugging with Linux because I'm new enough for that. Do you have suggestions to correct my code below? Note that I am looking for an explanation on how to implement the hand-to-hand lock in the best possible way and not on an entire code as an answer.
Thank you in advance.

concurrent_list.h:

a header file for function and structure declarations.

    typedef struct node node;
typedef struct list list;

list * create_list ();
void delete_list (list * list);
void print_list (list * list);
void insert_value (list * list, int value);
void remove_value (list * list, int value);
void count_list (list * list, int (* predicate) (int));

concurrent_list.c

The file whose implementation of the functions in the header file and
also more functions.

#understand 
#understand 
#understand 
#understand 
#include "competitor_list.h"

structured node {
int value;
next node *;
pthread_mutex_t lock; // hand on hand implies a lock for each node
};

list of structures {
knot * head;
};

// display the value of a node
void print_node (node ​​* node)
{
if (node)
{
printf ("% d", node-> value);
}
}

// create a new empty list
list * create_list ()
{
list * new_list = (list *) malloc (sizeof (list));

if (new_list == NULL)
{
return NULL;
}

new_list-> head = NULL;

returns new_list;
}

// remove the complete list (lock the current item for other threads)
void delete_list (list * list)
{
node * temp = list-> head;
node * curr;

if (temp == NULL) returns;

while (temp! = NULL)
{
pthread_mutex_lock (& ​​(temp-> lock));
curr = temp;
free (curr);
temp = temp-> next;

}
}

// insert a function for a new value if a value already exists, do nothing
// lock current and previous items for other threads
void insert_value (list * list, int value)
{
if (list == NULL) returns;

node * new_node = (node ​​*) malloc (sizeof (node));

if (new_node == NULL) returns;

new_node-> value = value;

if (list-> head == NULL)
{
list-> head = new_node;
list-> head-> next = NULL;
}

node * prev = list-> head;
pthread_mutex_lock (& ​​prev-> lock);

node * curr = prev-> next;

if (curr == NULL)
{
if (prev-> value> value)
{
new_node-> next = prev;
prev-> next == NULL;
}

if not (prev-> value < value)
        {
            prev->next = new_node;
new_node-> next = NULL;
}

other
{
free (new_node);
}

pthread_mutex_unlock (& ​​prev-> lock);

return;
}

pthread_mutex_lock (& ​​curr-> lock);

while (curr-> value < value)
    {
      pthread_mutex_unlock(&prev->lock);
prev = curr;
curr = prev-> next;

if (curr == NULL)
{
pthread_mutex_unlock (& ​​prev-> lock);
return;
}

pthread_mutex_lock (& ​​curr-> lock);
}

if (curr-> value == value)
{
pthread_mutex_unlock (& ​​curr-> lock);
pthread_mutex_unlock (& ​​prev-> lock);
return;
}

new_node-> next = curr;
prev-> next = new_node;
pthread_mutex_unlock (& ​​curr-> lock);
pthread_mutex_unlock (& ​​prev-> lock);
}

// remove the first appearance of a value from the list if it exists in the list
// lock current and previous items for other threads
void remove_value (list * list, int value)
{
if (list == NULL || list-> header == NULL) returns;

node * prev = list-> head;
pthread_mutex_lock (& ​​prev-> lock);

node * curr = prev-> next;

if (curr == NULL)
{
if (prev-> value == value)
{
prev-> next == NULL;
}

pthread_mutex_unlock (& ​​prev-> lock);

return;
}

pthread_mutex_lock (& ​​curr-> lock);

while (curr-> value < value)
    {
      pthread_mutex_unlock(&prev->lock);
prev = curr;
curr = prev-> next;

if (curr == NULL)
{
pthread_mutex_unlock (& ​​prev-> lock);
return;
}

pthread_mutex_lock (& ​​curr-> lock);
}

if (curr-> value == value)
{
prev-> next = curr-> next;
}
pthread_mutex_unlock (& ​​curr-> lock);
pthread_mutex_unlock (& ​​prev-> lock);
}

// print the complete list
// lock the current item for other threads
void print_list (list * list)
{
node * curr = list-> head;

while (curr! = NULL)
{
pthread_mutex_lock (& ​​curr-> lock);
print_node (curr);
pthread_mutex_unlock (& ​​curr-> lock);
curr = curr-> next;
}
printf (" n");
}

// print the number of nodes in the list satisfying a given predicate function
// lock the current item for other threads
void count_list (list * list, int (* predicate) (int))
{
int account = 0;
node * curr = list-> head;

while (curr! = NULL)
{
pthread_mutex_lock (& ​​curr-> lock);

if (predicate (curr-> value))
{
count ++;
}

pthread_mutex_unlock (& ​​curr-> lock);

curr = curr-> next;
}

printf ("% d elements have been counted  n", count);
}
`` `

C ++ implementation of the linked list

I've recently tried learning C ++ myself and would like to have general comments on how to improve my code up to now. Also, since I'm more accustomed to other languages ​​(garbage collection) like Python and Java, I would like to know if I handle memory correctly or if I make fundamental rookie mistakes.

I have tried to implement a linked list, shown below in LinkedList.h.

#pragma once
#understand 
#understand 

/ *
This is a linked generic type list implemented without using the C ++ STL.
Member functions:
empty append (const T &)
bool contains (const T &) const
const T & get (int) const
empty insertion (int, const T &)
int length () const
void prepend (const T &)
Delete (int)
bool removeValue (const T &)
* /
model 
LinkedList class {
public:
// Add an item to the end of the list
void append (const T & data) {
insert (len, data);
}

// return the data element to the given index
// Start std :: out_of_range if the index is not valid
const T & get (int index) const {
if (index < 0 || index >= len)
throw std :: out_of_range ("Invalid Index in LinkedList :: get (int)");
Node * ptr = Head;
// Traverse to the corresponding node
for (; index--;)
ptr = ptr -> next;
returns ptr -> data;
}

// Add the item to the beginning of the list
void prepend (const T & data) {
insert (0, data);
}

// Removes the item at a given index, if possible, and returns it
// Start std :: out_of_range if the index is not valid
T remove (int index) {
if (index < 0 || index >= len)
throw std :: out_of_range ("Invalid Index in LinkedList :: remove (int)");
Node * old;
if (index == 0) {// Deleting the head
old = head; // save the deleted node to release it later
Head = Head -> next; // Ignore the node
}
other {
Node * ptr = Head;
for (; --index;) // Traverse just before the corresponding node
ptr = ptr -> next;
old = ptr -> next; // save the deleted node to release it later
ptr -> next = old -> next; // Ignore the node
}
T ret = old -> data; // save deleted data for later return
delete old; // Remove the node from the memory
len--;
return ret;
}

// Removes item by value, if it is found, and returns if it succeeds or not
bool removeValue (const T & data) {
Node * ptr = Head;
if (! ptr) // Empty list
returns false;
Node * old;
if (ptr -> data == data) {// Deleting the head
old = head; // save the deleted node to release it later
Head = old -> next; // Ignore the node
}
other {
// advance to the end of the list, or just before the object is found
while (ptr -> next && ptr -> next -> data! = data)
ptr = ptr -> next;
if (! ptr -> next) // end of the list
returns false;
// the object has been found
Node * old = ptr -> next; // save the deleted node to release it later
ptr -> next = old -> next; // Ignore the node
}
delete old; // Remove the node from the memory
len--;
return true;
}

// Insert an element at a given index
// Start std :: out_of_range if the index is not valid
void insert (index int, const T & data) {
if (index < 0 || index > len)
throw std :: out_of_range ("Invalid Index in LinkedList :: insert (int, const T &)");
if (index == 0)
Head = new node (data, Head);
other {
Node * ptr = Head;
// Crosses to a node before inserting
for (; --index;)
ptr = ptr -> next;
ptr -> next = new Node (data, ptr -> next);
}
len ++;
}

// return if the list contains a given element or not
bool contains (const T & data) const {
Node * ptr = Head;
while (ptr! = nullptr) {
if (ptr -> data == data)
return true;
ptr = ptr -> next;
}
returns false;
}

// return the length of the list
int length () const {
send back len;
}

// Removes all nodes from the list
~ LinkedList () {
Node * ptr = Head, * next;
// browse the list
while (ptr) {
next = ptr -> next;
delete ptr;
ptr = next;
}
}

private:
Node class {public:
data const t;
Node * next;
Node (const T & data, Node * next = nullptr): data (data), next (next) {}
};
int len ​​= 0;
Node * Head = nullptr;
model 
        friend std :: ostream & operator << (std :: ostream &, const LinkedList&);
};

model 
std :: ostream & operator << (std :: ostream & os, const LinkedList& ls) {
os << "[ ";
list_name LinkedList:: Node * ptr = ls.Head, * next;
// browse the list
while (ptr) {
os << ptr -> The data;
next = ptr -> next;
if (next) // If it is not at the end of the list
os << ",";
ptr = next;
}
os << "]";
return bones;
}

In addition, I wrote code to test most of the features that I called LinkedList.cpp.

#understand 
#understand 
#include "LinkedList.h"
// Note that this file uses features of the C ++ 17 standard, namely std :: size.

int main () {
LinkedList * L = new LinkedList;
// It can also be done without pointers:
// LinkedList L2;

// test the head
int x = 3;
L -> append (x);
// L2.append (x);
std :: cout << "Expected: 3  tActual:" << L -> get (0) << std :: endl << std :: endl;
// std :: cout << "Expected: 3  tActual:" << * (L2.get (0)) << std :: endl << std :: endl;

// repeated test adds
int arr[] = {45, 10, 32, 12, 11, 12, 1, -1, 0, 56};
for (unsigned int i = 0; i < std::size(arr); i++)
        L -> append (arr[i])
for (unsigned int i = 0; i <std :: size (arr); i ++)
std :: cout << << expected: << << arr[i] << " tActual:" << L -> get (i + 1) << std :: endl;
std :: cost << std::endl;

    // Test remove and length
    x = L -> remove (3);
std :: cout << << expected: 32  tActual: "<< x << std :: endl;
int newArr[] = {3, 45, 10, 12, 11, 12, 1, -1, 0, 56};
for (int i = 0; i < L -> length(); i ++)
std :: cout << << Expected: << << newArr[i] << " tActual:" << L -> get (i) << std :: endl;
std :: cost << std::endl;

    // Test insert and prepend
    L -> prepend[0])
L -> insert (1, arr[1])
for (int i = 0; i <2; i ++)
std :: cout << << expected: << << arr[i] << " tActual:" << L -> get (i) << std :: endl;

// Test contains
std :: cout << << pending: 1  tActual: "<< L -> contains (arr[1]) << std :: endl;
std :: cout << "Expected: 0  tActual:" << L -> contains (arr[2]) << std :: endl;
std :: cout << << pending: 1  tActual: "<< L -> contains (arr[3]) << std :: endl;
std :: cout << std :: endl;

// Test output operator
std :: cout << << Actual:  t[ 45, 10, 3, 45, 10, 12, 11, 12, 1, -1, 0, 56 ]"<< std :: endl;
std :: cout << << Expected:  t "<< * L << std :: endl;
std :: cout << std :: endl;

// Test removeValue
std :: cout << << pending: 1  tActual: "<< L -> removeValue (0) << std :: endl;
std :: cout << "Expected: 0  tActual:" << L -> removeValue (9000) << std :: endl;
std :: cout << << pending: 1  tActual: "<< L -> removeValue (45) << std :: endl;
std :: cout << << pending: 1  tActual: "<< L -> removeValue (45) << std :: endl;
std :: cout << << pending: 1  tActual: "<< L -> removeValue (3) << std :: endl;
std :: cout << "Expected: 0  tActual:" << L -> removeValue (3) << std :: endl;
std :: cout << << pending: 1  tActual: "<< L -> removeValue (56) << std :: endl;
std :: cout << << Actual:  t[ 10, 10, 12, 11, 12, 1, -1 ]"<< std :: endl;
std :: cout << << Expected:  t "<< * L << std :: endl;
std :: cout << std :: endl;

delete L;
returns 0;
}

Thank you so much! I appreciate all the advice or comments.

Data structure with C ++ linked list implementation

I need to create an appropriate insert constructor, deletion, copy, and assignment operator for a certain data structure. This is a hash table containing pointers that are linked lists. It works on tests that I wrote and valgrind says that there is no memory leak. STL is forbidden, as well as to change the data structure. I am especially worried if I was wrong first, last, next and previous order and next hash.

#understand 
#understand 
#understand 
using namespace std;

struct TItem {
TItem (string key, val value string, TItem * nextHash, TItem * nextOrd, TItem * prevOrd)
: m_Key (key), m_Val (val), m_NextHash (nextHash), m_NextOrder (nextOrd), m_PrevOrder (prevOrd) {}

m_Key string, m_Val;
TItem * m_NextHash, * m_NextOrder, * m_PrevOrder;
};

class CHash {
public:
Chash (int m): m_Table (NULL), m_Size (m), m_PremierOrder (NULL), m_LastOrder (NULL)
{
init (m);
}

~ Chash ()
{
finalize();
}

IsSet bool (string key)
{
TItem * temp = m_Table[hashFn(key)];
if (temp == NULL)
returns false;
while (temp! = NULL)
{
if (temp -> m_Key == key)
return true;
temp = temp -> m_NextOrder;
}
returns false;
}

Chash (Chash const & src)
{
init (src.m_Size);
copy (src.m_FirstOrder);
}

Chash & operator = (chash const & src)
{
finalize();
init (src.m_Size);
copy (src.m_FirstOrder);
return * this;
}

bool Ins (const string and key, const string and val)
{
string help = key;
if (IsSet (help))
returns false;
if (m_FirstOrder == NULL)
{
TItem * tmp01 = new TItem (key, val, NULL, NULL, NULL);
m_Table[hashFn(help)] = tmp01;
m_FirstOrder = m_LastOrder = tmp01;
return true;
}
other
{
TItem * temp = m_Table[hashFn(help)];
if (temp == NULL)
{
TItem * tmp02 = new TItem (key, val, NULL, NULL, m_LastOrder);
m_Table[hashFn(help)] = tmp02;
m_LastOrder -> m_NextOrder = tmp02;
m_LastOrder = tmp02;
return true;
}
while (temp -> m_NextHash! = NULL)
{
if (temp -> m_Key == key)
returns false;
temp = temp -> m_NextHash;
}
TItem * tmp03 = new TItem (key, val, NULL, NULL, m_LastOrder);
m_Table[hashFn(help)] -> m_NextHash = tmp03;
m_LastOrder -> m_NextOrder = tmp03;
m_LastOrder = tmp03;
return true;
}
}

bool Del (string and key const)
{
string help = key;
TItem * temp = m_Table[hashFn(help)];
if (temp == NULL)
returns false;
while (temp! = NULL)
{
if (temp -> m_Key == key)
Pause;
temp = temp -> m_NextHash;
}

if (temp == NULL)
returns false;

if (m_FirstOrder == temp)
m_FirstOrder = m_FirstOrder -> m_NextOrder;
other
temp -> m_PrevOrder -> m_NextOrder = temp -> m_NextOrder;
if (m_LastOrder == temp)
m_LastOrder = m_LastOrder -> m_PrevOrder;

m_Table[hashFn(help)] = temp -> m_NextHash;
delete temp;
return true;
}

model 
    void ForEach (function f)
{

}
void printAll ()
{
TItem * temp = m_FirstOrder;
while (temp! = NULL)
{
cost << temp -> m_Key << endl;
    temp = temp -> m_NextOrder;
}
}

private:
void init (int m)
{
m_Size = m;
m_Table = new TItem * [m];
for (int i = 0; i < m; i++)
        m_Table[i] = NULL;
      m_FirstOrder = NULL;
      m_LastOrder = NULL;
    }

    void finalize ()
    {
      TItem * temp = m_FirstOrder;
      while (temp != NULL)
      {
        TItem * tmp = temp;
        temp = temp -> m_NextOrder;
delete tmp;
}
wipe off [] m_Table;
}

null copy (TItem * src)
{
while (src! = NULL)
{
Ins (src -> m_Key, src -> m_Val);
src = src -> m_NextOrder;
}
}

TItem ** m_Table;
unsigned int m_Size;
TItem * m_FirstOrder, * m_LastOrder;
unsigned int hashFn (string & str) {
std :: hash hash_fn;
returns hash_fn (str)% m_Size;
}
};

int main (int argc, char ** argv) {

Chash hash table (100);
Chash hash2 (50);
hashtable.Ins ("h1", "car");
assert (! hashtable.Ins ("h1", "phone"));
hashtable.Ins ("h2", "field");
hashtable.Ins ("h3", "house");
hashtable.Ins ("h4", "tree");
hashtable.printAll ();
assert (hashtable.Del ("h3"));
assert (! hashtable.Ins ("h4", "tree"));
assert (! hashtable.Del ("h4d"));
assert (hashtable.Del ("h1"));
assert (! hashtable.Del ("h3"));
assert (! hashtable.Del ("h1"));
cost << "ok" << endl;

hash2 = hashtable;
hashtable.printAll ();
hash2.printAll ();
Chash b (hash2);
b.printAll ();


hashtable.ForEach ([](TItem * it) {
cost <m_Key << "-" <m_Val << endl;
});

returns 0;
}

Worksheet – Lock Sharepoint Excel Linked to Microsoft Forms

I was able to create a Microsoft form linked to an Excel sheet stored in SharePoint. Multiple users will have access to the sheet. I want to lock a column with a password. I select the edit range and set a password for the M column, then the rest of the range to be edited by anyone. Excel indicates that the changes will only take effect if I lock the sheet. After the sheet is locked, the responses on the Microsoft form do not reach the document. As if I had prevented SharePoint from modifying its own spreadsheet! I need a locked column but I need Microsoft forms to fill the rest every time we have a new answer. Help me?