数据结构代写:Data Structures CS225 代写

数据结构是一种用于组织、处理、检索和存储数据的特殊格式。有几种基本和高级类型的数据结构,所有这些都旨在安排数据以适应特定目的。数据结构使用户可以轻松地以适当的方式访问和使用他们需要的数据。最重要的是,数据结构构成了信息的组织结构,以便机器和人类能够更好地理解它。

为什么数据结构很重要?

大多数计算机编程语言中可用的典型基本数据类型(例如整数或浮点值)通常不足以捕捉数据处理和使用的逻辑意图。然而,摄取、操作和生成信息的应用程序必须了解应如何组织数据以简化处理。数据结构以逻辑方式将数据元素组合在一起,并促进数据的有效使用、持久性和共享。它们提供了一个描述数据元素组织方式的正式模型。

数据结构是如何使用的?

通常,数据结构用于实现抽象数据类型的物理形式。数据结构是设计高效软件的关键部分。它们还在算法设计以及这些算法如何在计算机程序中使用方面发挥着关键作用。

早期的编程语言——例如 Fortran、C 和 C++——使程序员能够定义自己的数据结构。今天,许多编程语言都包含大量内置数据结构来组织代码和信息。例如,Python列表和字典以及JavaScript数组和对象是用于存储和检索信息的常见编码结构。

软件工程师使用与数据结构紧密耦合的算法——例如列表、队列和从一组值到另一组值的映射。这种方法可以融合在各种应用程序中,包括管理关系数据库中的记录集合以及使用称为二叉树的数据结构创建这些记录的索引。

数据结构的特点

数据结构通常按其特征分类。以下三个特征是示例:

线性或非线性:该特征描述了数据项是按顺序排列的,例如数组,还是无序排列,例如图形。

同质或异质:此特征描述给定存储库中的所有数据项是否属于同一类型。一个例子是数组中元素的集合,或各种类型的元素,例如在 C 中定义为结构的抽象数据类型或在 Java 中定义为类规范。

静态或动态:这个特性描述了数据结构是如何编译的。静态数据结构在编译时具有固定的大小、结构和内存位置。动态数据结构的大小、结构和内存位置可以根据用途缩小或扩大。

CS 225 Data Structures and Software Principle 数据结构代写实例

MC1 Consider the following C++ statements:

#include <iostream>

using namespace std;

int main(){

int *y;

int x = 36;

//code to be inserted here

(*y)++;

cout << x << endl;

return 0;

}

Which of the following choices, if inserted at the line marked, will result in 37 being sent to

standard ouput?

(a) y = x;

(b) y = &x;

(c) *y = x;

(d) *y = &x;

(e) None of these will give the result we want.

MC2 We need to write our own destructor (instead of using the default one) when.

(a) we have private members that are pointers.

(b) we have private members that are arrays.

(c) we have allocated dynamic memory in our constructors.

(d) two of these three require that we write our own destructor.

(e) all of the above require that we write our own destructor

MC3 Consider the following C++ statements:

#include <iostream>

using namespace std;

void myFun(int * x) {

int *y = new int;

*y = 16;

x=y;

delete y;

}

int main(){

int i = 9;

myFun(&i);

cout << i << endl;

return 0;

}

What is the result when this code is compiled and run?

(a) Nothing. This code does not compile.

(b) 16 is sent to standard out

(c) 9 is sent to standard out

(d) The address of iis sent to standard out

(e) This compiles fine, but will generate a segmentation fault when executed (runtime error)

MC4 Consider this prototype for a template function:

template <class Item>

void foo(Item x);

What is the right way to call the foo function with an integer argument i?

(a) foo( i );

(b) foo<int>( i );

(c) foo<Item>( i );

(d) foo( <int> i );

(e) foo( <Item> i);

MC5 Consider the following C++ statements:

class Ball {

public:

//constructors and other member functions

void setSameRadius(Ball & orig) const;

private:

int radius;

}

void Ball::setSameRadius(Ball & orig) const {

radius = orig.radius;

}

Consider the Ball class and the setSameRadius function shown above. This function is

expected to set the radius of this Ball object to the same value as the radius of the orig Ball

object.

This function: Answer: d

(a) compiles and runs without error but does not perform the desired task.

(b) compiles and runs without error and performs the desired task.

(c) encounters a run-time error.

(d) does not compile because of an error involving setSameRadius.

(e) compiles and runs without error, performs the desired task, but changes the value of

orig.

MC6 Suppose we have implemented a queue as a singly linked list with a tail pointer modeled here:

Which of the following best describes the running time of the enqueue and dequeue operations if the rear of the queue must be at the head of the linked memory structure? (nis the number

of elements in the queue.)

(a) O(1) for both enqueue and dequeue

(b) O(n) for both enqueue and dequeue

(c) O(1) for enqueue and O(n) for dequeue

(d) O(n) for enqueue and O(1) for dequeue (e) None of these is the correct choice.

contact

Assignment Exmaple

Recent Case

Service Scope

C|C++|Java|Python|Matlab|Android|Jsp|Prolo
g|MIPS|Haskell|R|Linux|C#|PHP|SQL|.Net|Hand
oop|Processing|JS|Ruby|Scala|Rust|Data Mining|数据库|Oracle|Mysql|Sqlite|IOS|Data Mining|网络编程|多线程编程|Linux编程操作系统|计算机网络|留学生|编程|程序|代写|加急|个人代写|作业代写|Assignment

Wechat:maxxuezhang

wechat