I need a Python script that can do the following. At the end of this book there
ID: 3576579 • Letter: I
Question
I need a Python script that can do the following.
At the end of this book there is an index (start at page 515, example shown below), which maps words to page numbers of pages containing the words. A line index is similar: It maps words to line numbers of text lines in which they appear. Develop, using the MapReduce framework, an application that takes as input the name of a text file (pick any text file you like) and creates a line index. Your application should output the index to a file so words appear in alphabetical order, one word per line; the line numbers, for each word, should follow the word and be output in increasing order.
(Bonus question) try to run it using multiple core (e.g. pool (2), pool (4), and pool(8) ) to compare the efficiency.
time C) time function, 105 time format directive, 106 time Standard Library module, 105-107 timing function, 351 timing Analysis() function, 352 Tk tkinter class, 292 tkinter Standard Library module, 292 coordinate system, 312 resources, 299 widgets. See widget unary operator, 20 undo Turtle method, 443, 444 Unicode, 183-186 uniform random module function, 188 Uniform Resource Locator, see URL uniqueness testing, 357 UNIX, 5 update C) dictionary method, 170, 171 UPDATE SQL statement, 409Explanation / Answer
#include <stdio.h>
#include <stdlib.h>
struct node
;
typedef struct node n;
n* create_node(int);
void add_node();
void insert_at_first();
void insert_at_end();
void insert_at_position();
void delete_node_position();
void sort_list();
void update();
void search();
void display_from_beg();
void display_in_rev();
n *new, *ptr, *prev;
n *first = NULL, *last = NULL;
int variety = 0;
void main()
come new;
}
/*
*ADDS NEW NODE
*/
void add_node()
next = new;
new->prev = last;
last = new;
last->next = first;
first->prev = last;
" id="tip_19">
}
/*
*INSERTS part initially
*/
void insert_at_first()
currently new node is inserted however at first");
initial = last = new;
first->next = last->next = NULL;
first->prev = last->prev = NULL;
}
else
}
/*
*INSERTS THE part AT GIVEN POSITION
*/
void insert_at_position()
{
int info, pos, len = 0, i;
n *prevnode;
printf(" enter the worth that you simply would love to insert:");
scanf("%d", &info);
printf(" enter the position wherever you have got to enter:");
scanf("%d", &pos);
new = create_node(info);
if (first == last && initial == NULL)
{
if (pos == 1)
{
initial = last = new;
first->next = last->next = NULL;
first->prev = last->prev = NULL;
}
else
printf(" empty coupled list you cant insert at that specific position");
}
else
}
}
for (ptr = initial, i = 0;i < number;ptr = ptr->next,i++)
printf(" %d", ptr->val);
}
}
/*
*DELETION is completed
*/
void delete_node_position()
zero, key, i, f = 0;
printf(" enter the worth to be searched:");
scanf("%d", &key);
if (first == last && initial == NULL)
printf(" list is empty no elemnets in list to search");
else
{
for (ptr = initial,i = 0;i < number;i++,ptr = ptr->next)
{
count++;
if (ptr->val == key)
{
printf(" the worth is found at position at %d", count);
f = 1;
}
}
if (f == 0)
printf(" the worth isn't found in linkedlist");
}
}
/*
*DISPLAYING IN starting
*/
void display_from_beg()
{
int i;
if (first == last && initial == NULL)
printf(" list is empty no elemnts to print");
else
{
printf(" %d variety of nodes square measure there", number);
for (ptr = initial, i = 0;i < number;i++,ptr = ptr->next)
printf(" %d", ptr->val);
}
}
/*
* DISPLAYING IN REVERSE
*/
void display_in_rev()
{
int i;
if (first == last && initial == NULL)
printf(" list is empty there aren't any elments");
else
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.