小编nat*_*928的帖子

求解递归:T(n)=3T(n/2)+n

我需要找到 n 的递归解,如果T(n)=3T(n/2)+nn>1 和 T(n)=1,则为2 的幂,否则。

使用替换n=2^m,S(m)=T(2^(m-1))I 可以归结为:

S(m)=2^m+3*2^(m-1)+3^2*2^(m-2)+?+3^(m-1) 2^1+3^m

但我不知道如何简单地做到这一点。

algorithm recurrence computer-science time-complexity

3
推荐指数
1
解决办法
4万
查看次数

C++动态转换

我有一个主要的抽象类,我必须创建基于这个类的子类(这不能被修改):

class Spaceship
{
  protected:
    string m_name;      // the name of the ship
    int m_hull;         // the hull strenght
  public:

    // Purpose: Default Constructor
    // Postconditions: name and hull strength set to parameters
    // -- INLINE
    Spaceship(string n, int h)
    {
      m_name = n;
      m_hull = h;
    }

    // Purpose: Tells if a ship is alive.
    // Postconditions: 'true' if a ship's hull strength is above zero,
    //                 'false' otherwize.
    // -- INLINE
    bool isAlive()
    {
      return (m_hull > 0); …
Run Code Online (Sandbox Code Playgroud)

c++ polymorphism inheritance dynamic

2
推荐指数
1
解决办法
954
查看次数

使用php回显字符/>

我试着这样做:

echo '<img src="'. $img_file .'" ' . $imgDem . ' /><br />';
Run Code Online (Sandbox Code Playgroud)

但它出来是这样的:

<img src="/images/content/user/3/127.jpg" height="451" width="804"><br>
Run Code Online (Sandbox Code Playgroud)

我怎么能得到它像:

<img src="/images/content/user/3/127.jpg" height="451" width="804" /><br />
Run Code Online (Sandbox Code Playgroud)

php

0
推荐指数
1
解决办法
65
查看次数

VMware Linux LAMP服务器互联网

我在一个VM中为LAMP服务器安装Ubuntu服务器12.04.我应该如何为VM配置网络,以便我可以从主机PC访问托管在其上的网页,以便VM仍然可以访问Internet,以下载更多软件包?

谢谢

linux vmware lamp

0
推荐指数
1
解决办法
496
查看次数