From 4154d33fcdfbe8eefc66149e4a13d41a814a5abd Mon Sep 17 00:00:00 2001 From: AlisaLinUwU Date: Sun, 26 Jan 2025 11:47:38 +0500 Subject: Initialize --- Phone Book/Need for speed/task.html | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Phone Book/Need for speed/task.html (limited to 'Phone Book/Need for speed/task.html') diff --git a/Phone Book/Need for speed/task.html b/Phone Book/Need for speed/task.html new file mode 100644 index 0000000..927e294 --- /dev/null +++ b/Phone Book/Need for speed/task.html @@ -0,0 +1,24 @@ +
Description
+ +

Let's use faster methods to sort the list of numbers and to search in the list.

+ +

As in the previous stage, you should first sort the list of phone numbers by the owner’s name and then search for the numbers of the 500 people from the list given in the first stage. Remember: to get decent and comparable results, you should put all the algorithms in the same initial conditions.

+ +

For sorting, use the quick sort algorithm, and for searching, use the binary search algorithm.

+ +
Example
+ +

Output all three approaches one after another and see which one is faster. The output example is shown below. Note that you can get totally different sorting and searching times!

+ +
Start searching (linear search)...
+Found 500 / 500 entries. Time taken: 1 min. 56 sec. 328 ms.
+
+Start searching (bubble sort + jump search)...
+Found 500 / 500 entries. Time taken: 9 min. 15 sec. 291 ms.
+Sorting time: 8 min. 45 sec. 251 ms.
+Searching time: 0 min. 30 sec. 40 ms.
+
+Start searching (quick sort + binary search)...
+Found 500 / 500 entries. Time taken: 1 min. 21 sec. 996 ms.
+Sorting time: 1 min. 17 sec. 381 ms.
+Searching time: 0 min. 4 sec. 615 ms.
\ No newline at end of file -- cgit v1.2.3