代写C++代码 代做C++程序 C++辅导 C++教学

C++网络家教 远程写代码 在线Debug 讲解答疑 不是中介,本人直接写

微信: ittutor QQ: 14061936 Email: ittutor@qq.com

导航

Files and Packets

 Write C++ code that will convert files into a queue of packets and reassemble a queue of packets back into the original file. Both of these functions will be used in homework 8 where we will simulate sending files through a network as packets and reassembling them at their destinations.

Persistent Data Structures

A peristent data structure is one in which we can make changes (such as inserting and removing elements) while still preseving the original data structure Of course, an easy way to do this is to create a new copy of the entire data structure every time we perform an operation that changes the data structure, but it is much more efficient to only make a copy of the smallest possible portion of the data structure.

text-retrieval system

In the remaining problems, you will develop a realistic program which implements a text-retrieval system similar to Google.

You will extend a basic program called Minipedia that maintains a database of articles on various subjects. We supply a folder of >2500 articles culled from Wikipedia (first paragraphs only), two test articles Test1 and Test2, and also the code to access this collection. The basic user interaction is provided, as well as a bare-bones implementation of the database as a dumb unordered list. You must extend the functionality in several interesting ways, and also provide a more intelligent data structure using a hash table.

a simple calculator

In this assignment you are to prepare a C/Objective-C program that will act as a simple
calculator. The calculator will be run from the command line and will only work with integer
numbers and the following arithmetic operators + - x / %. The % operator is the
modulus operator, not the percentage.
For example, if the C/Objective-C program is compiled to calc, the following demonstrates
how it will work
./calc 3 + 5 - 7
1
In the command line, the arguments are a repeated sequence in the form
number operator
and ending in a
number
Hitting the enter key will cause the program to evaluate the arguments and print the result.
In this case 1.
The program must follow the usual laws of arithmetic which says
1. The x / and % operators must all be evaluated before the + and operators.
2. Operators must be evaluated from left to right.
For example, using Rule 1
2 + 4 x 3 – 6
becomes
2 + 12 – 6
which results in
8
Assignment 1 – Autumn 2016 Page 2 of 6
If we did not use Rule 1 then 2 + 4 x 3 – 6 would become 6 x 3 – 6 and then 18 – 6 and finally
12. This is an incorrect result.
If we do not use Rule 2 then the following illustrates how it can go wrong
4 x 5 % 2
Going from left to right we evaluate the x first, which reduces the expression to 20 % 2
which becomes 0. If we evaluated the % first then the expression would reduce to 4 x 1
which becomes 4. This is an incorrect result.
Remember, we are using integer mathematics when doing our calculations, so we get
integer results when doing division. For example
./calc 20 / 3
6
Also note that we can use the unary + and 浏览:795

Java Battleship

Suppose you want to develop and play a PC-based, single-user, simplified version of battleship (google “battleship game” if you aren’t familiar with it). Just like with most single-user games, you will not play against a real opponent, but rather against a simulated opponent, whose initial map is stored in a text file containing a description of where your opponent’s ships are located The idea is that when your program starts, it will read the description of the opponents map from the file and store it in a 2-d array. The person playing the game, of course, will not see the file or the 2-d array, except at the end of the game. Throughout the game, the player repeated trys to guess where battleships are located by specifying individual map coordinates (just like in the actual game). For each guess, the program will tell the player if they hit or miss. After each time the player makes a guess, the program will print out an “ASCII art” representation of the playing field (the currently known portion of the map). This will allow the player to see their progress as they play the game. 

The user will enter up to 25 integer values to be stored in an array starting at index zero

CS 158/159 

This assignment is worth 15 points and will be due Monday November 23, 2015 at 11:00pm. All 

assignment deadlines are firm and the ability to submit your assignment will be disabled after the 

deadline elapses. No late work will be accepted. You are encouraged to start this assignment as soon as 

String Library

In this assignment, you'll create your own library of string functions. 

You'll have the opportunity to practice manipulating strings and 

managing memory. Additionally, you'll learn the role of header and 

forest fire

CS:2230 Computer Science II: Data Structures

Instructions

1 Types in college

In this problem, you are to implement the following classes types in package

edutypes: Instructor, Professor, Student, TeachingAssistant. The

Parallel Computing Programming

Department of Computer Science Intro to Parallel Computing Programming Sets Recall that a set is just a collection of objects. The order in which the objects are listed doesn’t matter. So the set A = {3, 1, 2} is the same as the set B = {2, 3, 1}. Repetitions also don’t matter. So the sets A and B are the same as the set C = {3, 1, 2, 1}. The union of two sets D and E is the set whose elements are the elements that belong to D, to E, or to both D and E. For example, if D = {1, 3, 5, 7} and E = {1, 2, 3, 4}, then their union is D ∪ E = {1, 3, 5, 7} ∪ {1, 2, 3, 4} = {1, 2, 3, 4, 5, 7}. The intersection of two sets D and E is the set of elements that they have in common. So the intersection of the sets D and E is D ∩ E = {1, 3, 5, 7} ∩ {1, 2, 3, 4} = {1, 3}. The difference of two sets D and E is the set of elements belonging to the first, but not the second. So the difference of the sets D and E is D − E = {1, 3, 5, 7} − {1, 2, 3, 4} = {5, 7}. Program 2 For programming assignment 2, you should write a C program that implements a set abstract data type with operations union, intersection and set difference. Input to the program will be a sequence of single characters separated by white space. These indicate which operations should be carried out: ’u’ or ’U’: Find the union of two sets, ’i’ or ’I’: Find the intersection of two sets, and ’d’ or ’D’: Find the difference of two sets. ’q’ or ’Q’: Quit (freeing any allocated memory), For the union, intersection, or difference, the user will enter two sets A and B, and your program should output the result of the operation on the sets. The elements of the sets will be nonnegative ints, listed in increasing order, without repetitions. The last element in an input set will be followed by a negative value. For example, the set D = {1, 3, 5, 7} would be entered as 1 1 3 5 7 -1 You can assume that input sets will be sorted lists of nonnegative ints in increasing order with no duplicates, and each input set will be terminated by a negative value. So you don’t need to check the input sets for correctness. Implementation Details Each set should be implemented as a sorted, singly linked list of ints, and there should be no repeated values in the stored linked list. So D should be stored as head_p -> 1 -> 3 -> 5 -> 7 \ (The backslash (\) denotes the NULL pointer.) The set D should not be stored as head_p -> 3 -> 1 -> 7 -> 5 \ or head_p -> 1 -> 3 -> 3 -> 5 -> 7 \ Note that the restriction that the lists are sorted and that they don’t store duplicates doesn’t mean that we can’t accurately represent sets: any set of nonnegative ints can have its elements listed in increasing order with no repeated values. The purpose of the restrictions is to reduce the complexity of the program’s internal storage, and to make it possible to efficiently implement the operations. Since the sets are stored in sorted order, all three operations can be implemented as variations on the merge operation. Recollect that we merge two sorted lists by comparing the elements of the list pairwise and appending the smaller element to the new list. If the input lists are A and B, and the merged list is C, we can define pointers a_p, b_p and c_p that reference the current element in each list, respectively. So the merge operation proceeds as follows: while (a_p != NULL && b_p != NULL) if (a_p->data <= b_p->data) { c_p = Append(&C, c_p, a_p->data); a_p = Advance(a_p); } else { // b_p->data < a_p->data c_p = Append(&C, c_p, b_p->data); b_p = Advance(b_p); } while (a_p != NULL) { c_p = Append(&C, c_p, a_p->data); a_p = Advance(a_p); 2 } while (b_p != NULL) { c_p = Append(&C, c_p, b_p->data); b_p = Advance(b_p); } You should use this algorithm as the basis of your implementations. Note that at no point do you sort any of the lists! Each of the set operations, A ∪ B, etc., should be implemented by a function. These functions should not change the input arguments A and B. If the result of the operation (e.g., C) is passed in to the function (instead of being created and returned by the function), then, of course, the function can change it. Note that none of the functions implementing the operations should do any I/O (except for debug I/0). The results should be printed by the calling function (e.g., main). Since each new operation in the program reads in new sets, your program won’t be reusing the elements of the sets involved in the previous operation. So if you don’t free the nodes in each of the lists after printing the results of an operation, your program will have a memory leak: memory allocated from the heap will be lost. Development You should compile and test your program using Linux, since the parallel computers we have access to all use Linux (rather than Windows or MacOS X). Working with linked lists and pointers can be confusing

Linked List API and Testing

Description

In this assignment, you will use doubly and singly linked lists. You will add new functionality to our original singly linked and doubly linked list implementations. For the second part of the assignment, you will create JUnit tests to make sure that all of your methods are implemented correctly.

分页: 首页 12345678 尾页