Searching: Uniform Binary Search-2

本文深入探讨了AlgorithmC,一种使用辅助表进行搜索的算法,详细介绍了其工作原理,包括初始化步骤、比较、减少和增加操作等。通过Java程序实现并展示实际应用效果。

Algorithm C

Algorithm C (Uniform binary search). This algorithm is just like Algorithm U,
but it uses an auxiliary table in place of the calculations involving m. The table
entries are
DELTA[j] = floor((N+2^(j-1))/2^j), for 1 <= j <= floor(lgN)+2. (6)
C1. [Initialize.] Set i <– DELTA[1], j <–2.
C2. [Compare.] If K < Ki, go to C3; if K > Ki, go to C4; and if K = Ki, the
algorithm terminates successfully.
C3. [Decrease i.] If DELTA[j] = 0, the algorithm terminates unsuccessfully.
Otherwise, set i <– i-DELTA[j], j <– j + 1, and go to C2.
C4. [Increase i.] If DELTA[j] = 0, the algorithm terminates unsuccessfully.
Otherwise, set i <– i+DELTA[j] , j <– j + 1, and go to C2. |


Comparison tree

Uniform Binary Search-2:Searching


Java program

In this program, R1,…,RN were simplified to K1,…,KN.

/**
 * Created with IntelliJ IDEA.
 * User: 1O1O
 * Date: 12/11/13
 * Time: 6:52 PM
 * :)~
 * Uniform Binary Search-2:Searching
 */
public class Main {

    public static void main(String[] args) {
        int N = 16;
        int[] K = new int[17];

        /*Prepare the ordered data table*/
        K[1] = 61;
        K[2] = 87;
        K[3] = 154;
        K[4] = 170;
        K[5] = 275;
        K[6] = 426;
        K[7] = 503;
        K[8] = 509;
        K[9] = 512;
        K[10] = 612;
        K[11] = 653;
        K[12] = 677;
        K[13] = 703;
        K[14] = 765;
        K[15] = 897;
        K[16] = 908;

        /*Output sorted Ks*/
        System.out.println("Sorted Ks:");
        for(int i=1; i<=N; i++){
            System.out.println(i+":"+K[i]);
        }
        System.out.println();

        /*Kernel of the Algorithm!*/
        int Key = 653;                  /*Key to be found*/
        K[0] = -10000;                /*Negative Infinite*/
        int i = (int)Math.floor((N+Math.pow(2, 1-1))/Math.pow(2, 1));
        int j = 2;
        int deltaJ;

        do{
            deltaJ = (int)Math.floor((N+Math.pow(2, j-1))/Math.pow(2, j));
            if(Key < K[i]){
                if(deltaJ == 0){
                    System.out.println("Outputs: "+Key+" not found.");
                    break;
                }else {
                    i = i-deltaJ;
                    j++;
                }
            }else if(Key > K[i]){
                if(deltaJ == 0){
                    System.out.println("Outputs: "+Key+" not found.");
                    break;
                }else {
                    i = i+deltaJ;
                    j++;
                }
            }else {
                System.out.println("Outputs: "+Key+" in K["+i+"].");
                break;
            }
        }while (true);
    }
}

Outputs

Sorted Ks:
1:61
2:87
3:154
4:170
5:275
6:426
7:503
8:509
9:512
10:612
11:653
12:677
13:703
14:765
15:897
16:908

Outputs: 653 in K[11].

Reference

<< The art of computer programming: Sorting and Searching >> VOLUME 3, DONALD E. KNUTH

11:47:50: Information - CPreRequisiteInstallerApp::InitializeLog(273) - * Version: 25.3.10.69 11:47:50: Information - CPreRequisiteInstallerApp::InitializeLog(275) - * Build Date: Jul 7 2025 11:47:50: Information - CPreRequisiteInstallerApp::InitializeLog(276) - * Build Time: 03:52:09 11:47:50: Information - CPreRequisiteInstallerApp::InitializeLog(277) - * Command Line: OfflineInstaller 11:47:50: Information - CPreRequisiteInstallerApp::Run(308) - Prerequisite Installation via UI is triggered. Progress dialog will show up now.. 11:47:50: Information - PreRequisiteUI::ProgressDialog(82) - PreRequsiteUI.cpp : Entry to progress dialog function 11:47:50: Information - CPreRequisiteVerification::IsDotNetInstalled(98) - Checking if .NET Framework is present with Min Release No 528040 11:47:50: Information - CPreRequisiteVerification::IsDotNetInstalled(121) - The.NET Framework requirement satisfied 11:47:50: Information - CPreRequisiteVerification::IsDotNetCoreInstalled(65) - Searching for Desktop Runtime 8.0.15, currently found 8.0.15 11:47:50: Information - CPreRequisiteVerification::IsDotNetCoreInstalled(79) - Found Desktop Runtime 8.0.15 that is greater than or equal to 8.0.15, the .net 8 requirement is satisfied 11:47:50: Information - CPreRequisiteVerification::IsRequireToInstallVCRedist(131) - Checking for installed VC Redist 11:47:50: Information - CPreRequisiteVerification::IsRequireToInstallVCRedist(136) - Found the installed VC Redist version details as 14.42.34433.00, 14.44.35208.00 11:47:50: Information - CPreRequisiteVerification::IsEdgeWebView2Installed(155) - Checking if Microsoft Webview2 Runtime is present on the system. 11:47:50: Information - CPreRequisiteVerification::IsEdgeWebView2Installed(219) - Status of Edge runtime on system : 1 11:47:50: Information - InstallationWorkerFunction(17) - Installation completed ... 11:47:52: Information - CPreRequisiteInstallerApp::ExitInstance(369) - Exit Code = 0
最新发布
07-10
<think>我们正在解决 Citrix Workspace App 安装错误 0x8A150006,该错误通常与证书验证或系统组件问题有关。根据之前的解决方案,用户可能已经尝试了重置商店缓存、修复证书链等方法,但问题可能出现在先决条件组件的安装上。此时,我们需要分析安装日志以确定具体原因。 步骤: 1. 定位安装日志:Citrix Workspace App 的安装日志通常位于 `%windir%\Logs\CITRIX` 或 `%temp%` 目录下,文件名可能包含 `Citrix` 和 `Workspace`。 2. 分析日志:查找错误代码 0x8A150006 或相关错误信息,特别是与证书验证、组件安装失败相关的条目。 3. 针对性修复:根据日志中的具体失败点进行修复。 由于用户提到“先决条件组件安装错误”,我们重点检查以下方面: - 系统证书存储:是否缺少必要的根证书(如Microsoft Root Certificate Authority 2011)? - 系统服务:Windows Installer服务、Cryptographic服务是否正常运行? - 权限问题:当前用户是否有足够的权限安装系统组件? - 组件冲突:是否已有旧版本Citrix组件残留? 具体步骤: 一、获取安装日志 1. 打开文件资源管理器,在地址栏输入 `%temp%` 并按回车,查找以 `Citrix_Workspace_App_Install` 开头的日志文件(通常为 `.log` 扩展名)。 2. 如果上述位置没有,检查 `C:\Windows\Logs\CITRIX` 目录。 二、分析日志中的关键错误 打开日志文件,搜索以下关键字: - `0x8A150006` - `Certificate` - `Prerequisite` - `Failed` - `Error` 示例分析: 假设日志中出现: ``` [Error] [日期时间] : Component 'Certificate Install' failed with error code 0x8A150006: Certificate chain validation failed. ``` 这表明证书链验证失败,需要安装缺失的根证书(如前所述)。 三、针对性解决方案 情况1:证书链验证失败 解决方案: 1. 下载并安装 Microsoft Root Certificate Authority 2011 证书(如前所述)。 2. 更新受信任的根证书: - 打开命令提示符(管理员): ```cmd certutil -generateSSTFromWU roots.sst certutil -addstore root roots.sst ``` 情况2:先决条件组件(如.NET Framework、VC++ Redistributable)安装失败 解决方案: 1. 手动安装所需组件: - .NET Framework 4.8:通过 [官方下载](https://dotnet.microsoft.com/download/dotnet-framework/net48) 安装 - Visual C++ Redistributable:下载 [最新版本](https://aka.ms/vs/17/release/vc_redist.x64.exe) 安装 2. 重启计算机后重新尝试安装Citrix Workspace App。 情况3:权限不足 解决方案: 1. 以管理员身份运行Microsoft Store或离线安装程序。 2. 检查用户账户控制(UAC)设置:确保不是“从不通知”。 情况4:旧版本残留 解决方案: 1. 使用Citrix官方卸载工具(参考引用[1][2])彻底卸载旧版本。 - 下载地址:https://gitcode.com/open-source-toolkit/113f9 - 运行工具后重启计算机。 2. 重新安装。 四、其他高级修复 - 重置Windows Update组件(如前所述)。 - 执行系统文件检查: ```cmd sfc /scannow ``` - 执行DISM修复: ```cmd DISM /Online /Cleanup-Image /RestoreHealth ``` 五、预防措施(如前所述) 如果以上步骤仍无法解决,请提供具体的日志片段以便进一步分析。 相关问题: 1. 如何解读Citrix Workspace安装日志中的错误代码? 2. 安装Citrix Workspace需要哪些系统先决条件? 3. 如何彻底卸载Citrix Workspace以解决安装冲突?</think>### Citrix Workspace App 先决条件组件安装错误分析与修复(错误代码 0x8A150006) 当 Citrix Workspace App 安装失败并显示错误代码 `0x8A150006` 时,通常表示系统在安装先决条件组件时遇到证书验证问题。以下是详细的日志分析和解决方案: --- #### **一、错误日志关键分析** 在安装日志(路径:`%temp%\Citrix_Workspace_App_Install.log`)中查找以下关键字段: ```log [PrerequisiteEngine] ERROR: Component 'CertificateInstall' failed ErrorCode=0x8A150006 | Certificate chain validation failed [CertificateStore] Trusted Root CA missing: CN=Microsoft Root Certificate Authority 2011 ``` 这表明: 1. 系统缺失 Microsoft Root CA 2011 证书 2. 证书链验证失败(错误代码 0x8A150006) 3. 先决条件组件安装被阻止 --- #### **二、分步修复方案** 1. **手动安装缺失证书** ```powershell # 下载证书 Invoke-WebRequest -Uri "https://www.microsoft.com/pkiops/certs/MicrosoftRootCertificateAuthority2011.crt" -OutFile "$env:TEMP\RootCA2011.crt" # 安装到受信任根证书 certutil -addstore -f root "$env:TEMP\RootCA2011.crt" ``` > 验证安装:运行 `certmgr.msc` → 展开 **受信任的根证书颁发机构** → 确认存在 **Microsoft Root Certificate Authority 2011** 2. **重置证书存储** ```cmd :: 停止相关服务 net stop cryptSvc net stop CertPropSvc :: 清除缓存 del /q /f %windir%\System32\Catroot2\*.* del /q /f %windir%\SysWOW64\Catroot2\*.* :: 重启服务 net start cryptSvc net start CertPropSvc ``` 3. **修复系统组件** ```powershell # 重置 Microsoft Store 组件 Get-AppXPackage *WindowsStore* | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} # 修复系统映像 DISM /Online /Cleanup-Image /RestoreHealth sfc /scannow ``` 4. **使用离线安装绕过证书验证** 从 [Citrix 官网](https://www.citrix.com/downloads/workspace-app/windows/workspace-app-for-windows-latest.html) 下载 **Standalone 版本**: ```powershell # 静默安装(跳过证书检查) Start-Process -FilePath "CitrixWorkspaceApp.exe" -ArgumentList "/silent /noreboot /forceinstall" -Wait ``` --- #### **三、预防性措施** - **时间同步**:确保系统时间误差 < 2 分钟(证书有效期验证依赖时间) - **证书链完整性**:定期运行: ```cmd certutil -verifystore -v root > "%userprofile%\Desktop\cert_check.log" ``` - **清理旧版本**:使用 [Citrix Workspace 卸载工具](https://gitcode.com/open-source-toolkit/113f9) 彻底移除残留组件[^2] > **验证修复**:重新安装后检查日志中的新条目: > ```log > [PrerequisiteEngine] SUCCESS: All components installed > [CertificateStore] Trust chain validated for: Citrix Workspace Authentication > ``` --- #### **四、底层原理** 错误代码 `0x8A150006` 对应 Windows 证书验证错误 `CERT_E_CHAINING`(代码 0x800B010A),由以下条件触发: $$ \text{验证失败} \iff \exists \text{缺失证书} \ C \in \text{证书链} \ \land \ \text{系统时间} \notin [\text{证书生效期}] $$ 最新版 Citrix Workspace 2024.9 已优化证书验证流程[^3],建议升级后观察是否复现该问题。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值