墨爾本代寫-線上編程學術專家

Best代寫-最專業靠譜代寫IT | CS | 留學生作業 | 編程代寫Java | Python |C/C++ | PHP | Matlab | Assignment Project Homework代寫

C/C++代寫 | Memory Allocation Implemention

C/C++代寫 | Memory Allocation Implemention

本次加拿大代寫是C,C++內存分配器的Assignment

Part 1: Memory Allocation

The goal of this part of the assignment is to write your own memory allocator,
using the free list algorithm. We will start with two warm-up problems to get you
used to working with memory at a low level. Then you will write a memory
allocator that only allocates fixed-size blocks. Finally, you will write a full-fledged
墨尔本代写assignment,加拿大美国论文代写,北美essay代写-Panda Scholar memory allocator that handles variable-size blocks.

Problem 1 — 15 marks of 100, 9 secret marks (filename: wrapper-p1.cc)

We have provided a header a10p1.h and an object file a10p1.o that provide a
function

int64_t *arena() // Note: we are using int64_t instead of int on this
assignment,
// so that our numeric values are the same width as our
pointers (i.e., 64 bits)

The arena function returns the address of the beginning of a block of RAM that
may be used for dynamic memory allocation. Initially, the size of the arena (in
bytes) is stored in the first word. That is, the expression *arena() returns the size
of the arena, which will not be less than 223 or greater than 231. You may also
assume it is a multiple of 8.

Aside from the first word, which contains the size of the arena in bytes, you can
assume that every word in the arena is initialized to 0.

In C++, using the provided p1starter.cc as a starter, write a
function wain(a,n) where a is the address of the first of n 64-bit words of RAM.
Each word will contain a number between 1 and 1,000,000. Your wain function
should return the number of times that the most frequent element occurs.

Restrictions

You must solve this problem in linear time (i.e., O(n) where n is the size of the
墨尔本代写assignment,加拿大美国论文代写,北美essay代写-Panda Scholar input array). Otherwise, you will likely fail some of the TestingSystem tests.

Apart from the stack space occupied by ordinary program variables, and the heap
space occupied by user input, all of the memory your program uses (i.e., for arrays,
墨尔本代写assignment,加拿大美国论文代写,北美essay代写-Panda Scholar etc.) must come from the memory returned by arena.

More specifically, the code you write is not permitted to
use new, delete, malloc, calloc, realloc, free, or any STL containers, or any other
function that accomplishes a similar purpose to these.

You are allowed to use a few integer, pointer and char variables for things like
important values or addresses, loop counters, etc. but you should not store large
amounts of data using these variables. In particular, do not create any array
墨尔本代写assignment,加拿大美国论文代写,北美essay代写-Panda Scholar variables (e.g. int64_t array[1000000];).

You are not allowed to #include anything other than the headers already included
by the starter code p1wrapper.cc, and the header <cstdio> (C style input/output).

You do not need <cstdio> at all for this problem, but TestingSystem accepts it,
mostly for consistency with Problem 2 (where you are allowed to use it for I/O if
you prefer it to C++ streams). Perhaps you can use it for debugging if you are a fan
墨尔本代写assignment,加拿大美国论文代写,北美essay代写-Panda Scholar of printf.

Essay_Cheery

評論已關閉。

在線客服

售前咨詢
售后咨詢
微信號
Essay_Cheery
微信
北美代写,论文Essay代写,留学作业代写,-北美最专业的代写专家 堪培拉代写assignment,论文代写,留学作业代写-peaking代写 essay代写,assignment代写,留学生作业代写网课代做-锐 泽 代写 阿德莱德代写assignment,北美网课代修领导者,留学生网课代修代考 珀斯代写assignment,CS代写,留学生CS程序代写-Custom Writing代写 新西兰代写,math代写,新西兰Assignment代写-美 伦 代写 怎么样? 留学生CS代写,Java编程代写,网课代上代修-ezace留学生代写 达尔文代写assignment,留学生作业代写,留学代写-菠萝 菠萝蜜 代写 代写assignment,网课代上代考,考试代考论文代写-全球最好的华人代写机构 留学生代写,经济代写,代写作业-【靠谱】服务澳洲加拿大英国美国等地区