You have been hired to analyze a hacked database. The data is stored in a linked lis constructed from nodes described as follows: struct node{ char *fname; char *lname; struct node *next; }; The list has a sentinel node, which is accessible with the already-initialized variable struct node *sent:

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter8: Advanced Data Handling Concepts
Section: Chapter Questions
Problem 20RQ
icon
Related questions
Question
You have been hired to analyze a hacked database. The data is stored in a linked list,
constructed from nodes described as follows:
struct node{
char *fname;
char *Iname;
struct node *next;
};
The list has a sentinel node, which is accessible with the already-initialized variable
struct node *sent;
The hacker created a series of records where the first name and the last name are the same. Your
goal is to determine how many hacked records exist.
(a) write a function with the protoype
int hackCount(struct node *);
whose purpose is to count the number of nodes where the first name is equal to the last name,
and return that value.
(b) write a function with the prototype
tag(struct node*);
that accepts a sentinel node, and inserts a new node at the beginning of the list (immediately after
the sentinel) with fname and Iname each set to the string "hacked"
Transcribed Image Text:You have been hired to analyze a hacked database. The data is stored in a linked list, constructed from nodes described as follows: struct node{ char *fname; char *Iname; struct node *next; }; The list has a sentinel node, which is accessible with the already-initialized variable struct node *sent; The hacker created a series of records where the first name and the last name are the same. Your goal is to determine how many hacked records exist. (a) write a function with the protoype int hackCount(struct node *); whose purpose is to count the number of nodes where the first name is equal to the last name, and return that value. (b) write a function with the prototype tag(struct node*); that accepts a sentinel node, and inserts a new node at the beginning of the list (immediately after the sentinel) with fname and Iname each set to the string "hacked"
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Hash Table
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage