二叉树的括号表示(广义表示)转换
写在前面
笔试时候发现很多二叉树括号表示的题目, 了解一下.
转换规则
举例
  
    mhy 的题目:
    
      4.假设存在一棵树,其括号表示为A(B(F,G),C(H, (L)),D(J,K(M),E(N(O),P)),若将该树转换为二叉树,则该二叉树的后序遍历为
      () 。
      A GLIHFMKJPNEODCBA
      B BFGCHILDJKMENOP
      C ABGLIHEMKJPNEODC
      D GFLIHMKJOPNEDCBA
堆地址和栈地址的区分
printf("main addr: %p\n", (void *)main);
    int a = 1;
    printf("stack addr: %p\n", &a);
    int *p = (int *)malloc(sizeof(int));
    printf("heap addr: %p\n", p);
    free(p);
    /*
    main addr: 0x102257ee4
    stack addr: 0x16dbaab24
    heap addr: 0x600002c28050
    */
只是一个很简单的区分方法, 实际上还要受制于架构和指令集等情况.
Python牛客acm模式io题目答案
牛客竞赛_ACM/NOI/CSP/CCPC/ICPC算法编程高难度练习赛_牛客竞赛OJ;
1
import sys
for l in sys.stdin:
    a, b = l.split()
    print(int(a) + int(b))
2
import sys
n = input()
for l in sys.stdin:
    a, b = l.split()
    print(int(a) + int(b))
3
import sys
for l in sys.stdin:
    a, b = l.split()
    if a != '0' or b != '0':
        print(int(a) + int(b))   ...
Gcc工具链常见参数详解
写在前面
单文件编译
#include <cstdio>
#define out(x) printf(x)
int main(int argc, char *argv[]) {
    const int a [[maybe_unused]] = 7; // stdc++17
    out("hello cpp\n");
    return 0;
}
预处理-E
    g++ -E aa.cpp -o aa.i
  # cpp aa.cpp > aa.i # 或者用 cpp 预处理器 (The C Preprocessor)
  
aa.i的部分结果:
# 4 "aa.cpp"
int main(int argc, char *argv[])...
关于stl迭代器前置++和后置++性能的汇编层面分析
源码
  /opt/homebrew/Cellar/llvm/16.0.4/include/c++/v1/__iterator/wrap_iter.h
// clang llvm
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter& operator++()
    _NOEXCEPT {
    _LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
                         "Attempted to increment a non-incrementable iterator");
   ...
共计 478 篇文章,60 页。
您是Zorch的第 个小伙伴
Hits