Note that there are some explanatory texts on larger screens.

plurals
  1. POData structure for mapping URLs or local paths
    primarykey
    data
    text
    <p>I've been trying to workout a good way of doing this fast but I'm not sure what will be the most optimal, I'm hoping some of you more experienced developers can assist via your Data Structures knowledge :-)</p> <p>Essentially I have a list of paths (Eg. C:\inetpub\wwwroot\, C:\www\websites\vhosts\somesite.com\, D:\www-mirror\websites\vhosts\somesite.co.uk), I have to check that the current file I'm working on (say C:\inetpub\wwwroot\styles\style.css) exists in the preconfigured list of paths.</p> <p>So what I initially thought was to interate my list of items and do a CurrentFilename.StartsWith(PreconfigureListOfPathsPathName). But I'm iterating through the list quite regularly and it slows down as the list can contain sometimes 10, othertimes 1000 (clients on a server) paths.</p> <p>What would you suggest as a fast solution for this problem? I'm writing in C# 3.5, this is only a small (but a critical) section of the project.</p> <p>I thought about binary search trees, breaking down the paths and then doing a treemap and iterating through each path. But I'm not sure if its correct as we could have lots of nodes.</p> <pre><code>D:\www-mirror\websites\vhosts\somesite.co.uk\ D:\www-mirror\websites\vhosts\somesite.com\ D:\www-mirror\websites\vhosts\somesite.org\ D:\www-mirror\websites\vhosts\somesite.pl\ </code></pre> <p>Tree map:</p> <pre><code>www-mirror-&gt;websites-&gt;vhosts-&gt;somesite* (has 4 nodes) www-mirror-&gt;blah-&gt;woah-&gt;okay </code></pre> <p>But it looks a bit wonky.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload