小编Avi*_*ash的帖子

编程竞赛方法

这是一个广泛的问题,但想知道专家的意见.我遇到了一个文档后缀数组 - 一个竞赛方法,也发现了一些参与者应该准备好这些数据结构的评论.现在,很多在线编程难题都有时间限制.所以我想知道应该准备好的其他数据结构/算法是什么.

algorithm data-structures

6
推荐指数
2
解决办法
1162
查看次数

在Scala中实现多级Java接口

我有以下等级java为我的interface

public interface Identifiable<T extends Comparable<T>> extends Serializable {
    public T getId();
}
public interface Function extends Identifiable {
    public String getId();
}
public abstract class Adapter implements Function {
    public abstract String getId();
}
Run Code Online (Sandbox Code Playgroud)

当我尝试按如下方式实施Adapterscala

class MultiGetFunction extends Adapter {
  def getId() : String = this.getClass.getName
}
Run Code Online (Sandbox Code Playgroud)

我收到了以下错误

Multiple markers at this line
    - overriding method getId in trait Identifiable of type ()T; method getId has incompatible 
     type
    - overrides Adapter.getId
    - implements …
Run Code Online (Sandbox Code Playgroud)

java generics scala scala-java-interop

6
推荐指数
1
解决办法
476
查看次数

Wix,Heat 和 Wxi 文件

我正在使用 heat.exe 来生成文件列表,我需要替换 File/@Source="SourceDir" 所以我传递了 -var 和目录名,但是这些变量是在我的 .wxi 文件中定义的我如何包含 .wxi 文件在热生成的 wxs 文件中。因为每次我进行构建时都会生成这个文件。

wix

5
推荐指数
1
解决办法
3378
查看次数

文件时间戳不会随着数据更新而改变

我有客户声称他有一个应用程序可以更新日志文件中的数据,但该应用程序不会更改日志文件的时间戳。

我有疑问为什么任何应用程序都会有这种行为。

windows file-io

5
推荐指数
1
解决办法
9296
查看次数

最近单词的最佳算法是什么

最近单词的最佳算法是什么.

给出了可能的单词字典,输入单词中的第一个字符可能是错误的.

algorithm

5
推荐指数
1
解决办法
3014
查看次数

C++和表格式打印

我正在寻找如何在C++中打印,以便表格列宽度是固定的.目前我一直在使用的空间,做|-,但只要数去两位数所有的走线变坏.

|---------|------------|-----------|
| NODE    |   ORDER    |   PARENT  |
|---------|------------|-----------|
|  0      |     0      |           |
|---------|------------|-----------|
|  1      |     7      |     7     |
|---------|------------|-----------|
|  2      |     1      |     0     |
|---------|------------|-----------|
|  3      |     5      |     5     |
|---------|------------|-----------|
|  4      |     3      |     6     |
|---------|------------|-----------|
|  5      |     4      |     4     |
|---------|------------|-----------|
|  6      |     2      |     2     |
|---------|------------|-----------|
|  7      |     6      |     4     |
|---------|------------|-----------|
Run Code Online (Sandbox Code Playgroud)

c++

5
推荐指数
2
解决办法
2万
查看次数

在抛出'std :: bad_alloc'的实例后调用终止what():std :: bad_alloc中止

bad_alloc在我的程序中遇到异常.

这些是约束:

  • 1 <= T <= 10
  • 每个字符串的长度最多为100000,仅包含小写字符.

有了这些限制,我无法弄清楚为什么我的程序会得到bad_alloc.

#include <string>
#include <algorithm>
#include <iostream>
#include <vector>

class SuffixArray {
    std::vector<std::string> suffixes;
    size_t N;
public:
    SuffixArray(std::string& s) {
        N = s.length();
        suffixes.resize(N);
        for (size_t i = 0; i < N; i++)
            suffixes[i] = s.substr(i);
        std::sort(suffixes.begin() , suffixes.end());
    }
    ~SuffixArray() {
    }
    size_t lcp(std::string& s, std::string& t) {
        size_t N = std::min(s.length(), t.length());
        for (size_t i = 0; i < N; i++)
            if (s[i] != t[i]) 
                return …
Run Code Online (Sandbox Code Playgroud)

c++ stl

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

std :: multiset并找到中间元素

我有std::multiset哪个如果我迭代std::multiset::begin()std::multiset::end()我将获得排序元素.如何获取中间元素在此std::multiset除了从迭代std::multiset::begin()std::multiset::begin() + size() / 2

c++ stl

5
推荐指数
1
解决办法
3985
查看次数

如何在Windows C++上分离线程

如何在Windows上分离一个线程C++.在Posix我们有pthread_detach(pthread_self());.如何在Windows环境中实现这一点.

c++ windows multithreading

5
推荐指数
1
解决办法
4821
查看次数

C ++中的内存池

我有非常高性能的C ++库。我正在考虑编写一个内存池,这样就不必使用global newdelete。我读了一些书。但是想知道这将有助于我减少性能和内存泄漏。

c++ memory-management pool

5
推荐指数
1
解决办法
1747
查看次数