blob: dcfb2dd6aec16e2bbb2212df3f3be8a08aeb611f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
<h5 style="text-align: center;" id="description">Description</h5>
<p>Have you ever had to use one of those 2000+ page phone books full of various organizations and people's names, written in a small font and with multiple columns on each page? Finding the information you need in such books can be an ordeal. In fact, even computers struggle to search through the millions of entries in a directory.</p>
<p>In this project, you will create a phone book, implementing several algorithms, and comparing their efficiency when using a big dataset.</p>
<p>For this, you will need to download the file <a target="_blank" target="_blank" href="https://stepik.org/media/attachments/lesson/197761/directory.txt" rel="nofollow noopener noreferrer">directory.txt</a> that contains the phone numbers of over a million people in multiple cities.</p>
<p>At this stage, you should implement the simplest possible search to find the numbers of a few people whose names are listed in the file <a target="_blank" target="_blank" href="https://stepik.org/media/attachments/lesson/197761/find.txt" rel="nofollow noopener noreferrer">find.txt</a>.</p>
<p>It takes a time to find all the records from the big file. We recommend you manually test your program with the simplified data: <a target="_blank" target="_blank" href="https://stepik.org/media/attachments/lesson/210117/small_directory.txt" rel="noopener noreferrer nofollow">small_directory.txt</a> and <a target="_blank" target="_blank" href="https://stepik.org/media/attachments/lesson/210117/small_find.txt" rel="noopener noreferrer nofollow">small_find.txt</a>. But to pass all the tests you have to work with the big files above.</p>
<p>Note how long it takes you to do this when using a linear search so that you can compare results with other search methods.</p>
<p>To measure the time difference, you can use <code class="java">System.currentTimeMillis()</code>.</p>
<p>Also notice that you don't need to read the file "directory.txt" again and again after each query. You should load all lines into memory and measure only the search process.</p>
<p><div class="alert alert-warning">Please, do not keep the downloaded files inside your project directory because the server can reject large files and you will see the message <strong>"Failed to post submission to the Hyperskill"</strong>.</div></p>
<h5 style="text-align: center;" id="example">Example</h5>
<p>Below is an example of how your output should look:</p>
<pre><code class="java">Start searching...
Found 500 / 500 entries. Time taken: 1 min. 56 sec. 328 ms.</code></pre>
|