面试总结之 各种定义题 英文口语

Singleton算法

private static Singleton firstInstance = null;
    public static Singleton getInstance() {
        if(firstInstance == null) {
            
            // This is here to test what happens if threads try
            // to create instances of this class
            
            if(firstThread){
            
                firstThread = false;
                
                try {
                    Thread.currentThread();
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                
                    e.printStackTrace();
                }
            }
            
            // Here we just use synchronized when the first object
            // is created
            
            synchronized(Singleton.class){ 
            
                if(firstInstance == null) {
                    // If the instance isn't needed it isn't created
                    // This is known as lazy instantiation
            
                    firstInstance = new Singleton();
            
                    // Shuffle the letters in the list
                    Collections.shuffle(firstInstance.letterList);
                    
                }
            
            }
            
        }
        
        // Under either circumstance this returns the instance
        
        return firstInstance;
    }
In software engineering, the singleton pattern is a design pattern that restricts
 the instantiation of a class to one object. This is useful when exactly one object
  is needed to coordinate actions across the system. The concept is sometimes generalized
   to systems that operate more efficiently when only one object exists, or that restrict
    the instantiation to a certain number of objects. The term comes from the mathematical
     concept of a singleton.

 

 

Factory 编程

// This is a factory thats only job is creating ships
// By encapsulating ship creation, we only have one
// place to make modifications

public class ENEMYSHIPFACTORY{
    
    // This could be used as a static method if we
    // are willing to give up subclassing it
    
    public ENEMYSHIP makeEnemyShip(String newShipType){
        
        //ENEMYSHIP newShip = null;
        
        if (newShipType.equals("U")){
            
            return new UFOENEMYSHIP();
            
        } else 
        
        if (newShipType.equals("R")){
            
            return new ROCKETENEMYSHIP();
            
        } else 
        
        if (newShipType.equals("B")){
            
            return new BIGUFOENEMYSHIP();
            
        } else return null;
        
    }
    
}
When a method returns one of several possible classes that share a commom super class

the factory pattern allows you to create objects without specifying the exact class of 
object that will be created.

 

 

 a virtual function or virtual method is a function or method whose behavior can be overridden within an inheriting class by a function with the same signature. This concept is a very important part of the polymorphism portion of object-oriented programming (OOP).数组

 

"A pure virtual function or pure virtual method is a virtual function that is required to be implemented by a derived class that is not abstract" - Wikipedia浏览器

So, the virtual function can be overriden and the pure virtual must be implemented.缓存

 

As the name inheritance suggests an object is able to inherit characteristics from another object. In more concrete terms, an object is able to pass on its state and behaviors to its children. For inheritance to work the objects need to have characteristics in common with each other.服务器

 

static:网络

 

static variables are shared by the entire class, not a specific instance (unlike normal member variables)
static methods are also shared by the entire class

static can be used around a block of code in a class to specify code that runs when the virtual machine is first started up, before instances of the class are created.

 

 

(计算机编程英语词汇)算法经常使用术语中英对照Data Structures 基本数据结构Dictionaries 字典Priority Queues 堆        Graph Data Structures 图Set Data Structures 集合Kd-Trees 线段树Numerical Problems 数值问题Solving Linear Equations 线性方程组Bandwidth Reduction 带宽压缩Matrix Multiplication 矩阵乘法Determinants and Permanents 行列式Constrained and Unconstrained Optimization 最值问题Linear Programming 线性规划Random Number Generation 随机数生成Factoring and Primality Testing 因子分解/质数断定Arbitrary Precision Arithmetic 高精度计算Knapsack Problem 背包问题Discrete Fourier Transform 离散Fourier 变换Combinatorial Problems 组合问题Sorting 排序Searching 查找Median and Selection 中位数Generating Permutations 排列生成Generating Subsets 子集生成Generating Partitions 划分生成Generating Graphs 图的生成Calendrical Calculations 日期Job Scheduling 工程安排Satisfiability 可知足性Graph Problems -- polynomial 图论-多项式算法Connected Components 连通分支Topological Sorting 拓扑排序Minimum Spanning Tree 最小生成树Shortest Path 最短路径Transitive Closure and Reduction 传递闭包Matching 匹配Eulerian Cycle / Chinese Postman Euler 回路/中国邮路Edge and Vertex Connectivity 割边/割点Network Flow 网络流Drawing Graphs Nicely 图的描绘Drawing Trees 树的描绘Planarity Detection and Embedding 平面性检测和嵌入Graph Problems -- hard 图论-NP 问题Clique 最大团Independent Set 独立集Vertex Cover 点覆盖Traveling Salesman Problem 旅行商问题Hamiltonian Cycle Hamilton 回路Graph Partition 图的划分Vertex Coloring 点染色Edge Coloring 边染色Graph Isomorphism 同构Steiner Tree Steiner 树Feedback Edge/Vertex Set 最大无环子图Computational Geometry 计算几何Convex Hull 凸包Triangulation 三角剖分Voronoi Diagrams Voronoi 图Nearest Neighbor Search 最近点对查询Range Search 范围查询Point Location 位置查询Intersection Detection 碰撞测试Bin Packing 装箱问题Medial-Axis Transformation 中轴变换Polygon Partitioning 多边形分割Simplifying Polygons 多边形化简Shape Similarity 类似多边形Motion Planning 运动规划Maintaining Line Arrangements 平面分割Minkowski Sum Minkowski 和Set and String Problems 集合与串的问题Set Cover 集合覆盖Set Packing 集合配置String Matching 模式匹配Approximate String Matching 模糊匹配Text Compression 压缩Cryptography 密码Finite State Machine Minimization 有穷自动机简化Longest Common Substring 最长公共子串Shortest Common Superstring 最短公共父串DP——Dynamic Programming——动态规划recursion ——递归编程词汇A2A integration A2A 整合abstract 抽象的abstract base class (ABC)抽象基类abstract class 抽象类abstraction 抽象、抽象物、抽象性access 存取、访问access level 访问级别access function 访问函数account 帐户action 动做activate 激活active 活动的actual parameter 实参adapter 适配器add-in 插件address 地址address space 地址空间address-of operator 取地址操做符ADL (argument-dependent lookup)ADO(ActiveX Data Object)ActiveX 数据对象advanced 高级的aggregation 聚合、汇集algorithm 算法alias 别名align 排列、对齐allocate 分配、配置allocator 分配器、配置器angle bracket 尖括号annotation 注解、评注API (Application Programming Interface)应用(程序)编程接口app domain (application domain)应用域application 应用、应用程序application framework 应用程序框架appearance 外观append 附加architecture 架构、体系结构archive file 归档文件、存档文件argument 引数(传给函式的值)。参见parameterarray 数组arrow operator 箭头操做符ASP(Active Server Page)活动服务器页面ASP.NET worker process ASP.NET 工做者进程assembly 装配件、配件assembly language 汇编语言assembly manifest 装配件清单assert(ion)断言assign 赋值assignment 赋值、分配assignment operator 赋值操做符associated 相关的、相关联的associative container 关联式容器(对应sequential container)asynchronous 异步的atomic 原子的atomic operation 原子操做attribute 特性、属性authentication service 验证服务authorization 受权audio 音频A.I. 人工智能B2B integration B2B 整合、B2B 集成(business-to-business integration)background 背景、后台(进程)backward compatible 向后兼容、向下兼容backup 备份backup device 备份设备backup file 备份文件bandwidth 带宽base class 基类base type 基类型batch 批处理BCL (base class library)基类库binary 二进制binary search 二分查找binary tree 二叉树binary function 双参函数binary large object 二进制大对象binary operator 二元操做符binding 绑定bit 位bitmap 位图bitwise 按位...bitwise copy 为单元进行复制;位元逐一复制,按位拷bitwise operation 按位运算block 块、区块、语句块bookkeeping 簿记boolean 布林值(真假值,true 或false)border 边框bounds checking 边界检查boxing 装箱、装箱转换brace (curly brace)大括号、花括号bracket (square brakcet)中括号、方括号breakpoint 断点browser applications 浏览器应用(程序)browser-accessible application 可经由浏览器访问的应用程序build 编连(专指编译和链接built-in 内建、内置bus 总线business 业务、商务(看场合)business Logic 业务逻辑business rules 业务规则buttons 按钮bug 臭虫by/through 经过byte 位元组(由8 bits 组成)cache 高速缓存calendar 日历call 调用callback 回调call-level interface (CLI)调用级接口(CLI)call operator 调用操做符candidate key 候选键(for database)cascading delete 级联删除(for database)cascading update 级联更新(for database)casting 转型、造型转换catalog 目录chain 链(function calls)character 字符character format 字符格式character set 字符集CHECK constraints CHECK 约束(for database)checkpoint 检查点(for database)check box 复选框check button 复选按钮child class 子类CIL (common intermediate language)通用中间语言、通用中介语言class 类class declaration 类声明class definition 类定义class derivation list 类继承列表class factory 类厂class hierarchy 类层次结构class library 类库class loader 类装载器class template 类模板class template partial specializations 类模板部分特化class template specializations 类模板特化classification 分类clause 子句client application 客户端应用程序client cursor 客户端游标(for database)code page 代码页cleanup 清理、清除CLI (Common Language Infrastructure) 通用语言基础设施client 客户、客户端
相关文章
相关标签/搜索